xmap.src
//command: xmap
//if params.len != 1 or params[0] == "-h" or params[0] == "--help" then exit(command_info("xmap_usage"))
//if not is_valid_ip(params[0]) then exit("xmap: invalid ip address")
if not get_shell.host_computer.is_network_active then exit("xmap: No internet access.")
isip = user_input( "<color=red>[" + "</color><color=blue>"+active_user+"</color><color=red>]</color>"+"<color=red>[" + "</color>" +"Ip:" + "</color>"+ "<color=red>]</color>")
ipAddress = isip
isLanIp = is_lan_ip(ipAddress)
if isLanIp then
router = get_router;
else
router = get_router(ipAddress)
end if
//"<color=red>[" + "</color>" + "<color=blue>" + "\nxmap: ip address not found </color>"+ "<color=red>]</color>"
if router == null then exit("<color=red>[" + "</color>" + "<color=blue>" + "\nxmap: ip address not found </color>"+ "<color=red>]</color>")
print_ports = function(ports)
info = "PORT STATE SERVICE VERSION LAN"
if typeof(ports) == "string" then return print(ports)
//"<color=red>[" + "</color>" + "<color=blue>" + "\nScan finished. No open ports. </color>"+ "<color=red>]</color>"
if ports.len == 0 then return print("<color=red>[</color>" + "<color=blue>" + "\nScan finished. No open ports. </color>"+ "<color=red>]</color>")
for port in ports
service_info = router.port_info(port)
lan_ips = port.get_lan_ip
port_status = "Activated"
if(port.is_closed and not isLanIp) then
port_status = "Deactivated"
end if
info = info + "\n" + port.port_number + " " + port_status + " " + service_info + " " + lan_ips
end for
//"<color=red>[</color>" + "<color=blue>" + info + "</color>"+ "<color=red>]</color>"
//info
print(format_columns(info) + "\n")
end function
print("<color=red>[" + "</color>"+"<color=blue>Starting xmap v1.2</color>"+"<color=red>]" + "</color>")
print_ports(router.used_ports)
ports = []
for lan in router.devices_lan_ip
ports = ports + router.device_ports(lan)
end for
print_ports(ports)