Skip to content

Commit 10c7c38

Browse files
sn0wfa11Brent Cook
authored andcommitted
Add subnet check for Android payloads
1 parent c49bd9e commit 10c7c38

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

modules/post/multi/manage/autoroute.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,17 @@ def autoadd_routes
243243

244244
begin
245245
session.net.config.each_route do | route |
246-
next unless is_routable?(route.subnet, route.netmask)
247246
next unless (Rex::Socket.is_ipv4?(route.subnet) && Rex::Socket.is_ipv4?(route.netmask)) # Pick out the IPv4 addresses
247+
subnet = get_subnet(route.subnet, route.netmask) # Make sure that the subnet is actually a subnet and not an IP address. Android phones like to send over their IP.
248+
next unless is_routable?(subnet, route.netmask)
248249

249-
if !Rex::Socket::SwitchBoard.route_exists?(route.subnet, route.netmask)
250-
found = true if add_route(route.subnet, route.netmask, "host's routing table")
250+
if !Rex::Socket::SwitchBoard.route_exists?(subnet, route.netmask)
251+
found = true if add_route(subnet, route.netmask, "host's routing table")
251252
end
252253
end
253254

254255
rescue ::Rex::Post::Meterpreter::RequestError => re
255-
print_status("Unable to get routes from session, trying other methods.")
256+
print_status("Unable to get routes from session, trying interface list.")
256257
end
257258

258259
if !autoadd_interface_routes && !found # Check interface list for more possible routes

0 commit comments

Comments
 (0)