From 9c89599737eba56d971a20ab9a43ea9bd2d6752a Mon Sep 17 00:00:00 2001 From: jvazquez-r7 Date: Mon, 11 Mar 2013 20:35:25 +0100 Subject: [PATCH] cleanup before merge external_ip --- modules/auxiliary/gather/external_ip.rb | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/modules/auxiliary/gather/external_ip.rb b/modules/auxiliary/gather/external_ip.rb index 2d64f771e7..f9098a2202 100755 --- a/modules/auxiliary/gather/external_ip.rb +++ b/modules/auxiliary/gather/external_ip.rb @@ -29,26 +29,19 @@ class Metasploit3 < Msf::Auxiliary register_options( [ - OptEnum.new('RHOST', [true, 'The ifconfig.me server to use','49.212.202.172',['49.212.202.172','133.242.129.236']]), - OptString.new('VHOST', [true, "The VHOST to use", 'ifconfig.me' ]), + Opt::RHOST('ifconfig.me'), OptBool.new('REPORT_HOST', [false, 'Add the found IP to the database', false]) ], self.class) end def run - 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 - rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::EHOSTUNREACH => e - raise e + 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 #{rhost} is #{our_addr}") + report_host(our_addr) if datastore['REPORT_HOST'] end end +end