Skip to content

Commit 9c89599

Browse files
author
jvazquez-r7
committed
cleanup before merge external_ip
1 parent 546e24a commit 9c89599

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

modules/auxiliary/gather/external_ip.rb

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,19 @@ def initialize
2929

3030
register_options(
3131
[
32-
OptEnum.new('RHOST', [true, 'The ifconfig.me server to use','49.212.202.172',['49.212.202.172','133.242.129.236']]),
33-
OptString.new('VHOST', [true, "The VHOST to use", 'ifconfig.me' ]),
32+
Opt::RHOST('ifconfig.me'),
3433
OptBool.new('REPORT_HOST', [false, 'Add the found IP to the database', false])
3534
], self.class)
3635
end
3736

3837
def run
39-
begin
40-
connect
41-
res = send_request_raw({'uri' => '/ip', 'method' => 'GET' })
42-
our_addr = res.body.strip
43-
if Rex::Socket.is_ipv4?(our_addr) or Rex::Socket.is_ipv6?(our_addr)
44-
print_good("Source ip to #{ip} is #{our_addr}")
45-
report_host(our_addr) if datastore['REPORT_HOST']
46-
end
47-
48-
end
49-
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
50-
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::EHOSTUNREACH => e
51-
raise e
38+
connect
39+
res = send_request_raw({'uri' => '/ip', 'method' => 'GET' })
40+
our_addr = res.body.strip
41+
if Rex::Socket.is_ipv4?(our_addr) or Rex::Socket.is_ipv6?(our_addr)
42+
print_good("Source ip to #{rhost} is #{our_addr}")
43+
report_host(our_addr) if datastore['REPORT_HOST']
5244
end
5345
end
5446

47+
end

0 commit comments

Comments
 (0)