Update reverse_tcp to show TCP listener information

Also update the readable text to only output the listener information if
it differs from the payload information.
bug/bundler_fix
OJ 2016-12-12 15:56:26 +10:00
parent f0dca7abbf
commit 505cc19662
No known key found for this signature in database
GPG Key ID: D5DC61FB93260597
2 changed files with 24 additions and 3 deletions

View File

@ -674,6 +674,7 @@ class ReadableText
row[1] = framework.jobs[job_id].name
pinst = exploit_mod.respond_to?(:payload_instance) ? exploit_mod.payload_instance : nil
payload_uri = ''
if pinst.nil?
row[2] = ""
@ -682,7 +683,8 @@ class ReadableText
row[2] = pinst.refname
row[3] = ""
if pinst.respond_to?(:payload_uri)
row[3] << pinst.payload_uri
payload_uri = pinst.payload_uri.strip
row[3] << payload_uri
end
if pinst.respond_to?(:luri)
row[3] << pinst.luri
@ -694,7 +696,12 @@ class ReadableText
uripath ||= exploit_mod.datastore['URIPATH']
row[4] = uripath
row[5] = framework.jobs[job_id].start_time
row[6] = pinst.respond_to?(:listener_uri) ? pinst.listener_uri : ""
row[6] = ''
if pinst.respond_to?(:listener_uri)
listener_uri = pinst.listener_uri.strip
row[6] = listener_uri unless listener_uri == payload_uri
end
end
tbl << row
end

View File

@ -77,10 +77,24 @@ module ReverseTcp
"reverse TCP"
end
# A URI describing what the payload is configured to use for transport
def payload_uri
"tcp://#{datastore['LHOST']}:#{datastore['LPORT']}"
addr = datastore['LHOST']
uri_host = Rex::Socket.is_ipv6?(addr) ? "[#{addr}]" : addr
"tcp://#{uri_host}:#{datastore['LPORT']}"
end
# A URI describing where we are listening
#
# @param addr [String] the address that
# @return [String] A URI of the form +scheme://host:port/+
def listener_uri(addr=datastore['ReverseListenerBindAddress'])
addr = datastore['LHOST'] if addr.nil? || addr.empty?
uri_host = Rex::Socket.is_ipv6?(addr) ? "[#{addr}]" : addr
"tcp://#{uri_host}:#{bind_port}"
end
#
# Starts monitoring for an inbound connection.
#