Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //command: nmap
- if params.len != 1 or params[0] == "-h" or params[0] == "--help" then exit(command_info("nmap_usage"))
- if not is_valid_ip(params[0]) then exit("nmap: invalid ip address")
- if not get_shell.host_computer.is_network_active then exit("nmap: No internet access.")
- ipAddress = params[0]
- isLanIp = is_lan_ip( ipAddress )
- if isLanIp then
- router = get_router;
- else
- router = get_router( ipAddress )
- end if
- if router == null then exit("nmap: ip address not found")
- print_ports = function(ports)
- //info = "<b>PORT STATE SERVICE VERSION LAN</b>"
- if typeof(ports) == "string" then return print(ports)
- if ports.len == 0 then return print("Scan finished, no open ports\n")
- if(ports.len == 0) then exit("Scan finished. No open ports.")
- for port in ports
- service_info = router.port_info(port)
- lan_ips = port.get_lan_ip
- //port_status = "open"
- port_status = "<color=#00FF00>open</color>"
- if(port.is_closed and not isLanIp) then
- // port_status = "closed"
- port_status = "<color=#FF0000>closed</color>"
- end if
- info = info + "\n<color=#EA31E4>" + port.port_number + "</color> " + port_status + " <color=#4690C2>" + service_info + "</color><color=#E2C73F> " + lan_ips + "</color>"
- end for
- print(format_columns(info) + "\n")
- end function
- print("\nStarting nmap v1.1 at " + current_date)
- print("Interesting ports on " + params[0] + "\n")
- print_ports(router.used_ports)
- ports = []
- for lan in router.devices_lan_ip
- ports = ports + router.device_ports(lan)
- end for
- print_ports(ports)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement