Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //command: scnlan
- formatstring= function(len,string)
- newstring=" "*len
- newstring=""+newstring[0:len-string.len]+string
- return newstring
- end function
- if params.len then
- if is_valid_ip(params[0]) then
- info= "Scanning network @ <color=#00ff00>"+formatstring(15,params[0])+" "
- router = get_router(params[0])
- if router then
- ips = [router.local_ip]+router.computers_lan_ip
- end if
- else
- print("<b><u>Usage:</b></u>")
- print("<b>scnlan [Ip Adress]<b>")
- print("<i>scan a distant network and show all services running on the network</i>")
- print("<b>scnlan <b>")
- print("<i>scan a local network and show all services on all computers</i>")
- exit
- end if
- else
- info= "Scanning Local network "
- router = get_router
- ips = [router.local_ip]+router.computers_lan_ip
- end if
- if not router then
- info= "<B>invalid ip Scanning Local network</B>"
- router = get_router
- ips = [router.local_ip]+router.computers_lan_ip
- end if
- computer = get_shell.host_computer
- if not router or not computer.is_network_active then exit("Not connected to the network.")
- ips = [router.local_ip]+router.computers_lan_ip
- print("+----------------------------------------------+-----+")
- print("| Advanced Lan Scanner |<u>V.1.0</u>|")
- print("| "+info+" |")
- print("+-------------------+---------------------------------")
- for ipAddress in ips
- isRouterIp = router.local_ip == ipAddress
- ports = null
- isLanIp = is_lan_ip( ipAddress )
- info=""
- if not isLanIp or isRouterIp then
- ports = router.used_ports
- print("| "+formatstring(15,"[Router]")+" | |")
- print("| "+formatstring(15,ipAddress)+" | Port status informations |")
- else
- ports = router.computer_ports(ipAddress)
- if ports.len>0 then
- print("| "+formatstring(15,ipAddress)+" | Port status informations |")
- else
- print("| "+formatstring(15,ipAddress)+" | No opened ports detected |")
- end if
- end if
- if ports!= null then
- for port in ports
- service_info = router.port_info(port)
- lan_ips = port.get_lan_ip
- port_status = "open"
- if(port.is_closed and not isLanIp) then
- port_status = "closed"
- end if
- print( "| |"+formatstring(6,str(port.port_number)) + " " + formatstring(6,port_status) + " " + formatstring(15,service_info) + " |")
- end for
- end if
- print("+----------------------------------------------------+")
- end for
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement