Skip to content

Commit 6480ae2

Browse files
rootroot
authored andcommitted
Show message at the end
1 parent 288954a commit 6480ae2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

modules/post/windows/recon/outbound_ports.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def initialize(info={})
3939
OptInt.new('MIN_TTL', [true, 'Starting TTL value.', 1]),
4040
OptString.new('PORTS', [true, 'Ports to test (e.g. 80,443,100-110).','80,443']),
4141
OptInt.new('TIMEOUT', [true, 'Timeout for the ICMP socket.', 3]),
42-
OptBool.new('STOP', [true, 'Stop when it finds a public IP.', false])
42+
OptBool.new('STOP', [true, 'Stop when it finds a public IP.', true])
4343
], self.class)
4444
end
4545

@@ -161,6 +161,7 @@ def run
161161
ports = Rex::Socket.portspec_crack(datastore['PORTS'])
162162

163163
ports.each do |dport|
164+
pub_ip = false
164165
print_status("Testing port #{dport}...")
165166
0.upto(datastore['HOPS'] - 1) { |i|
166167
i = i + datastore['MIN_TTL']
@@ -172,17 +173,17 @@ def run
172173
hop = connections(remote, dport, h_icmp, h_tcp, to)
173174
if hop != nil
174175
print_good("#{i} #{hop}")
175-
if datastore['STOP'] == true and !Rex::Socket.is_internal?(hop)
176-
print_good("Public IP reached. The port #{dport} is not filtered")
177-
break
176+
if !Rex::Socket.is_internal?(hop)
177+
pub_ip = true
178+
break if datastore['STOP'] == true
178179
end
179180
else
180181
print_error("#{i} *")
181182
end
182-
183183
client.railgun.ws2_32.closesocket(h_tcp)
184184
client.railgun.ws2_32.closesocket(h_icmp)
185185
}
186+
print_good("Public IP reached. The TCP port #{dport} is not filtered") if pub_ip == true
186187
end
187188
end
188189
end

0 commit comments

Comments
 (0)