Skip to content

Instantly share code, notes, and snippets.

@tjmonsi
Created December 30, 2023 13:55
Show Gist options
  • Save tjmonsi/5bbe4dee8d1829fee48b0f61dc7c39a5 to your computer and use it in GitHub Desktop.
Save tjmonsi/5bbe4dee8d1829fee48b0f61dc7c39a5 to your computer and use it in GitHub Desktop.
scanlib2.src
import_code("/home/tjmonsi/scripts/lib/paramsparser.src")
import_code("/home/tjmonsi/scripts/lib/findindex.src")
import_code("/home/tjmonsi/scripts/lib/scanrouter.src")
import_code("/home/tjmonsi/scripts/lib/metaxploitscan.src")
config = tjx_params_parser(program_path.split("/")[-1], ["target_ip"], 1)
target_ip = null
if config.hasIndex("target_ip") then target_ip = config.target_ip
computer = get_shell.host_computer
networkGateway = computer.network_gateway
publicIp = get_router(networkGateway).public_ip
publicMainRouter = get_router(publicIp)
results = tjx_scanrouter(networkGateway)
if target_ip then
for device in results.deviceList
if device.deviceIp == target_ip then
print("exploiting without a port: " + device.parentIp)
tjx_metaxploit_scan(device.parentIp)
wait
router = get_router(device.parentIp)
usedPorts = router.used_ports
print("exploiting used ports: " + usedPorts.len + " ports - " + device.parentIp)
for port in usedPorts
print([router.port_info(port), port.port_number, port.get_lan_ip].join(" "))
tjx_metaxploit_scan(device.parentIp, port.port_number)
end for
devicePorts = router.device_ports(device.deviceIp)
print("exploiting device ports: " + devicePorts.len + " ports - " + device.parentIp)
for port in devicePorts
print([router.port_info(port), port.port_number, port.get_lan_ip].join(" "))
wait
tjx_metaxploit_scan(device.parentIp, port.port_number)
end for
wait
end if
end for
else
for device in results.routerList
print("exploiting without a port: " + device.routerIp)
tjx_metaxploit_scan(device.routerIp)
wait
router = get_router(device.routerIp)
usedPorts = router.used_ports
print("exploiting used ports: " + usedPorts.len + " ports - " + device.routerIp)
for port in usedPorts
print([router.port_info(port), port.port_number, port.get_lan_ip].join(" "))
wait
tjx_metaxploit_scan(device.routerIp, port.port_number)
end for
devicePorts = publicMainRouter.device_ports(device.routerIp)
print("exploiting device ports: " + devicePorts.len + " ports - " + device.routerIp)
for port in devicePorts
print([router.port_info(port), port.port_number, port.get_lan_ip].join(" "))
wait
tjx_metaxploit_scan(device.routerIp, port.port_number)
end for
wait
end for
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment