Nmparse it’s a shell script that will help you if you need to parse long Nmap results.
It can parse .gnmap, .xml, or .nmap port scan files and will generate a CSV list, lists of IPs per port, web URLs, and a summary table.
Install
$ git clone https://github.com/actuated/nmaparse.git
Usage
$ nmap -v -p- -A 10.129.163.104 –min-rate 5000 -oA results.txt
$ ls
results.txt.gnmap results.txt.nmap results.txt.xml
--out-dir [path] can optionally be used to specify an output directory diferent than the default nmaparse-YYYY-MM-DD-HH-MM.
$ ./nmaparse.sh results.txt.gnmap
=======================[ nmaparse.sh by Ted R (github: actuated) ]=======================
Parsing source file... Done.
nmaparse-2022-08-20-16-36.csv created with parsed results.
Parsing to [tcp/udp]-[port]-hosts.txt... Done:
1 nmaparse-2022-08-20-16-36/tcp-22-hosts.txt
1 nmaparse-2022-08-20-16-36/tcp-80-hosts.txt
2 total
nmaparse-weburls-2022-08-20-16-36.txt created.
Creating summary report... nmaparse-summary-2022-08-20-16-36.txt created.
=========================================[ fin ]=========================================
$ cd nmaparse-2022-08-20-16-36
$ ls
nmaparse-2022-08-20-16-36.csv nmaparse-summary-2022-08-20-16-36.txt nmaparse-weburls-2022-08-20-16-36.txt tcp-22-hosts.txt tcp-80-hosts.txt
$ cat nmaparse-2022-08-20-16-36.csv
10.129.163.104,tcp,22,ssh,OpenSSH 7.6p1 Ubuntu 4ubuntu0.7
10.129.163.104,tcp,80,http,Apache httpd 2.4.29
$ cat nmaparse-summary-2022-08-20-16-36.txt
+------------------+--------------+-----------------------------------------------------+
| HOST | OPEN PORT | PROTOCOL - SERVICE |
+------------------+--------------+-----------------------------------------------------+
| 10.129.163.104 | 22 / tcp | ssh - OpenSSH 7.6p1 Ubuntu 4ubuntu0.7 |
| 10.129.163.104 | 80 / tcp | http - Apache httpd 2.4.29 |
+------------------+--------------+-----------------------------------------------------+
$ cat nmaparse-weburls-2022-08-20-16-36.txt
http://10.129.163.104:80/
$ cat tcp-22-hosts.txt
10.129.163.104
$ cat tcp-80-hosts.txt
10.129.163.104