From 6480ae2c03b1f666630980acdd7409baeafabf54 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 15 Dec 2014 16:26:39 +0100 Subject: [PATCH] Show message at the end --- modules/post/windows/recon/outbound_ports.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/post/windows/recon/outbound_ports.rb b/modules/post/windows/recon/outbound_ports.rb index e888994f7c..02e403ce8a 100644 --- a/modules/post/windows/recon/outbound_ports.rb +++ b/modules/post/windows/recon/outbound_ports.rb @@ -39,7 +39,7 @@ class Metasploit3 < Msf::Post OptInt.new('MIN_TTL', [true, 'Starting TTL value.', 1]), OptString.new('PORTS', [true, 'Ports to test (e.g. 80,443,100-110).','80,443']), OptInt.new('TIMEOUT', [true, 'Timeout for the ICMP socket.', 3]), - OptBool.new('STOP', [true, 'Stop when it finds a public IP.', false]) + OptBool.new('STOP', [true, 'Stop when it finds a public IP.', true]) ], self.class) end @@ -161,6 +161,7 @@ class Metasploit3 < Msf::Post ports = Rex::Socket.portspec_crack(datastore['PORTS']) ports.each do |dport| + pub_ip = false print_status("Testing port #{dport}...") 0.upto(datastore['HOPS'] - 1) { |i| i = i + datastore['MIN_TTL'] @@ -172,17 +173,17 @@ class Metasploit3 < Msf::Post hop = connections(remote, dport, h_icmp, h_tcp, to) if hop != nil print_good("#{i} #{hop}") - if datastore['STOP'] == true and !Rex::Socket.is_internal?(hop) - print_good("Public IP reached. The port #{dport} is not filtered") - break + if !Rex::Socket.is_internal?(hop) + pub_ip = true + break if datastore['STOP'] == true end else print_error("#{i} *") end - client.railgun.ws2_32.closesocket(h_tcp) client.railgun.ws2_32.closesocket(h_icmp) } + print_good("Public IP reached. The TCP port #{dport} is not filtered") if pub_ip == true end end end