2013-03-06 04:42:31 +00:00
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/framework/
|
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
|
|
|
# Exploit mixins should be called first
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'External IP',
|
|
|
|
'Description' => 'This module checks for the public source IP address of the current route to the RHOST',
|
|
|
|
'Author' => ['RageLtMan'],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'URL', 'http://ifconfig.me/ip' ],
|
|
|
|
]
|
|
|
|
)
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
2013-03-07 23:34:12 +00:00
|
|
|
OptEnum.new('RHOST', [true, 'The ifconfig.me server to use','49.212.202.172',['49.212.202.172','133.242.129.236']]),
|
2013-03-06 04:42:31 +00:00
|
|
|
OptString.new('VHOST', [true, "The VHOST to use", 'ifconfig.me' ]),
|
|
|
|
OptBool.new('REPORT_HOST', [false, 'Add the found IP to the database', false])
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
2013-03-07 23:34:12 +00:00
|
|
|
def run
|
2013-03-06 04:42:31 +00:00
|
|
|
begin
|
|
|
|
connect
|
|
|
|
res = send_request_raw({'uri' => '/ip', 'method' => 'GET' })
|
|
|
|
our_addr = res.body.strip
|
|
|
|
if Rex::Socket.is_ipv4?(our_addr) or Rex::Socket.is_ipv6?(our_addr)
|
|
|
|
print_good("Source ip to #{ip} is #{our_addr}")
|
|
|
|
report_host(our_addr) if datastore['REPORT_HOST']
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
2013-03-07 23:34:12 +00:00
|
|
|
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::EHOSTUNREACH => e
|
|
|
|
raise e
|
2013-03-06 04:42:31 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|