I'm trying to clean up nmap results and get a cleaner/easier to work with file, that has just the data I need - basically, IP and open ports.
(no need to integrate it into a solution, I can get them to work together)
This line cleans up the initial output:
findstr "Nmap open"|findstr /v "no-response"
It keeps lines with the txt Nmap, and the ports that are open. It then removes the lines that include "no-response" (that also have "Nmap" in them)
Here is resultant output:
Nmap scan report for 1.1.1.1
21/tcp open
22/tcp open
80/tcp open
Nmap scan report for 1.1.1.2
Nmap scan report for 1.1.1.3
22/tcp open
Nmap scan report for 1.1.1.4
80/tcp open
443/tcp open
Nmap scan report for 1.1.1.5
80/tcp open
554/tcp open
I'd like that output to include blank lines, and omit lines with no subsequent open ports, i.e.:
Nmap scan report for 1.1.1.1
21/tcp open
22/tcp open
80/tcp open
Nmap scan report for 1.1.1.3
22/tcp open
Nmap scan report for 1.1.1.4
80/tcp open
443/tcp open
Nmap scan report for 1.1.1.5
80/tcp open
554/tcp open
Not sure if that's doable -- seems like it should be...