Grey Hack

Grey Hack

how to capture nmap output and save to file?
I'm trying to write a script that captures output of nmap and saves the details to a text file but I'm having issues with it reading the output. Any ideas?
Originally posted by xjulep:
Although if you just want to log ips with certain ports you can change the logic to be like,

for port in ports
if port == 80 or whatever, add some record to a file
< >
Showing 1-4 of 4 comments
Knull 7 Mar @ 9:40am 
i think you can only use .devices_lan_ip, .device_ports(), .port_number, and .port_info() against a router object - which in turn would give you IP's of the device it's connected to. So it'd kinda be like nmap, but for a whole subnet of the LAN.
Safety 7 Mar @ 1:46pm 
Originally posted by Knull:
i think you can only use .devices_lan_ip, .device_ports(), .port_number, and .port_info() against a router object - which in turn would give you IP's of the device it's connected to. So it'd kinda be like nmap, but for a whole subnet of the LAN.

good to know but not exactly what I"m looking for. I'm trying to pretty much parse the output of the normal nmap <ip> so that if an output includes something like an open http or ftp port, it will save that IP to a file for review
xjulep 7 Mar @ 2:29pm 
Run CodeEditor.exe -code nmap to get nmap source, then edit it to output to file instead of printing:


< lines 1-26 above here> s = "" info = "PORT STATE SERVICE VERSION LAN" s = s + "\nStarting nmap v1.1 at " + current_date + "\n" s = s + "Interesting ports on " + params[0] + "\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" if(port.is_closed and not isLanIp) then port_status = "closed" end if info = info + "\n" + port.port_number + " " + port_status + " " + service_info + " " + lan_ips end for s = s + format_columns(info) + "\n" print(s) filename = "out_file" c = get_shell.host_computer c.touch(current_path, filename) f = c.File(filename) f.set_content(s)
The author of this thread has indicated that this post answers the original topic.
xjulep 7 Mar @ 2:30pm 
Although if you just want to log ips with certain ports you can change the logic to be like,

for port in ports
if port == 80 or whatever, add some record to a file
< >
Showing 1-4 of 4 comments
Per page: 1530 50