Keep other instances of via_string to the same convention

This commit is contained in:
Ashley Donaldson 2021-10-04 23:51:57 +11:00
parent 71aab90b53
commit 5196071c22
No known key found for this signature in database
GPG Key ID: 70277622B54D3BCE
3 changed files with 8 additions and 12 deletions

View File

@ -102,7 +102,7 @@ module Server
def start_service
begin
comm = _determine_server_comm
comm = _determine_server_comm(datastore['SRVHOST'])
self.service = Rex::ServiceManager.start(
Rex::Proto::DNS::Server,
datastore['SRVHOST'],

View File

@ -148,7 +148,7 @@ protected
#
# Determines appropriate listener comm
#
def _determine_server_comm(srv_comm = datastore['ListenerComm'].to_s)
def _determine_server_comm(ip, srv_comm = datastore['ListenerComm'].to_s)
case srv_comm
when 'local'
comm = ::Rex::Socket::Comm::Local
@ -157,7 +157,7 @@ protected
raise(RuntimeError, "Socket Server Comm (Session #{srv_comm}) does not exist") unless comm
raise(RuntimeError, "Socket Server Comm (Session #{srv_comm}) does not implement Rex::Socket::Comm") unless comm.is_a? ::Rex::Socket::Comm
when nil, ''
comm = nil
comm = Rex::Socket::SwitchBoard.best_comm(ip)
else
raise(RuntimeError, "SocketServer Comm '#{srv_comm}' is invalid")
end
@ -165,13 +165,9 @@ protected
comm
end
def via_string_for_ip(ip, comm)
comm_used = comm
comm_used ||= Rex::Socket::SwitchBoard.best_comm(ip)
comm_used ||= Rex::Socket::Comm::Local
if comm_used.respond_to?(:type) && comm_used.respond_to?(:sid)
via = "via the #{comm_used.type} on session #{comm_used.sid}"
def via_string(comm)
if comm.respond_to?(:type) && comm.respond_to?(:sid)
via = "via the #{comm.type} on session #{comm.sid}"
else
via = ""
end

View File

@ -57,7 +57,7 @@ module Exploit::Remote::TcpServer
def start_service(*args)
begin
comm = _determine_server_comm
comm = _determine_server_comm(srvhost)
self.service = Rex::Socket::TcpServer.create(
'LocalHost' => srvhost,
@ -106,7 +106,7 @@ module Exploit::Remote::TcpServer
raise e
end
via = via_string_for_ip(srvhost, comm)
via = via_string(comm)
hoststr = Rex::Socket.is_ipv6?(srvhost) ? "[#{srvhost}]" : srvhost
print_status("Started service listener on #{hoststr}:#{srvport} #{via}")
end