2013-03-06 04:42:31 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2013-03-06 04:42:31 +00:00
|
|
|
##
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Auxiliary
|
2013-03-06 04:42:31 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
# Exploit mixins should be called first
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'Discover External IP via Ifconfig.me',
|
|
|
|
'Description' => %q{
|
|
|
|
This module checks for the public source IP address of the current
|
|
|
|
route to the RHOST by querying the public web application at ifconfig.me.
|
|
|
|
It should be noted this module will register activity on ifconfig.me,
|
|
|
|
which is not affiliated with Metasploit.
|
|
|
|
},
|
|
|
|
'Author' => ['RageLtMan'],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'URL', 'http://ifconfig.me/ip' ],
|
|
|
|
]
|
|
|
|
)
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RHOST('ifconfig.me'),
|
|
|
|
OptBool.new('REPORT_HOST', [false, 'Add the found IP to the database', false])
|
2017-05-03 20:42:21 +00:00
|
|
|
])
|
2013-03-06 04:42:31 +00:00
|
|
|
end
|
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def run
|
|
|
|
connect
|
|
|
|
res = send_request_cgi({'uri' => '/ip', 'method' => 'GET' })
|
|
|
|
|
|
|
|
if res.nil?
|
|
|
|
print_error("Connection timed out")
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
our_addr = res.body.strip
|
|
|
|
if Rex::Socket.is_ipv4?(our_addr) or Rex::Socket.is_ipv6?(our_addr)
|
|
|
|
print_good("Source ip to #{rhost} is #{our_addr}")
|
|
|
|
report_host(our_addr) if datastore['REPORT_HOST']
|
|
|
|
end
|
|
|
|
end
|
2013-03-11 19:35:25 +00:00
|
|
|
end
|