@@ -39,7 +39,7 @@ def initialize(info={})
39
39
OptInt . new ( 'MIN_TTL' , [ true , 'Starting TTL value.' , 1 ] ) ,
40
40
OptString . new ( 'PORTS' , [ true , 'Ports to test (e.g. 80,443,100-110).' , '80,443' ] ) ,
41
41
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 ] )
43
43
] , self . class )
44
44
end
45
45
@@ -161,6 +161,7 @@ def run
161
161
ports = Rex ::Socket . portspec_crack ( datastore [ 'PORTS' ] )
162
162
163
163
ports . each do |dport |
164
+ pub_ip = false
164
165
print_status ( "Testing port #{ dport } ..." )
165
166
0 . upto ( datastore [ 'HOPS' ] - 1 ) { |i |
166
167
i = i + datastore [ 'MIN_TTL' ]
@@ -172,17 +173,17 @@ def run
172
173
hop = connections ( remote , dport , h_icmp , h_tcp , to )
173
174
if hop != nil
174
175
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
178
179
end
179
180
else
180
181
print_error ( "#{ i } *" )
181
182
end
182
-
183
183
client . railgun . ws2_32 . closesocket ( h_tcp )
184
184
client . railgun . ws2_32 . closesocket ( h_icmp )
185
185
}
186
+ print_good ( "Public IP reached. The TCP port #{ dport } is not filtered" ) if pub_ip == true
186
187
end
187
188
end
188
189
end
0 commit comments