Skip to content

Commit 413ea53

Browse files
committed
Add found flag and touchup code
1 parent 3abb6fe commit 413ea53

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

modules/post/windows/manage/autoroute.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,17 +164,20 @@ def delete_route(opts={})
164164
# @return [void] A useful return value is not expected here
165165
def autoadd_routes
166166
switch_board = Rex::Socket::SwitchBoard.instance
167-
print_status("Searcing for subnets to auto route.")
167+
print_status("Searcing for subnets to autoroute.")
168+
found = false
169+
168170
session.net.config.each_route do | route |
169171
# Remove multicast and loopback interfaces
170172
next if route.subnet =~ /^(224\.|127\.)/
171173
next if route.subnet == '0.0.0.0'
172174
next if route.netmask == '255.255.255.255'
173175

174-
if not switch_board.route_exists?(route.subnet, route.netmask)
176+
if !switch_board.route_exists?(route.subnet, route.netmask)
175177
begin
176178
if Rex::Socket::SwitchBoard.add_route(route.subnet, route.netmask, session)
177179
print_good("Route added to subnet #{route.subnet}/#{route.netmask}")
180+
found = true
178181
else
179182
print_error("Could not add route to subnet #{route.subnet}/#{route.netmask}")
180183
end
@@ -184,6 +187,7 @@ def autoadd_routes
184187
end
185188
end
186189
end
190+
print_status("Did not find any new subnets to add.") if !found
187191
end
188192

189193
# Validates the command options

0 commit comments

Comments
 (0)