0

I'm trying to generate nmap tcp portscan output to file with grep like ipadress:portnumber. I run:

nmap -sS -T4 -iL iplist.txt -p 1-65535 -> output.txt

iplist.txt is a file with local ips i want to scan for range of ports. It generates output file like:

Starting Nmap 7.31 ( https://nmap.org ) at 2016-11-09 20:42 EST
Nmap scan report for host (192.168.100.1)
Host is up (0.0000050s latency).
Other addresses for host (not scanned): ::1
Not shown: 64997 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
3306/tcp open  mysql

And other PCs on netwok...

The only sollution i found here: grep IP adress with open port nmap to cut lines and symbols with grep

nmap 192.168.0.0/24 -sU -p 44555 | grep -B3 open | egrep -o "([0-9]{1,3}\.){3}[0-9]{1,3}"  > output.txt

But in fact, it returns only ip adresses where the port is opened. Is it possible to generate output into file IPADDRESS:OPENEDPORT like:

192.168.100.1:22
192.168.100.1:80
192.168.100.22:80
192.168.100.87:35

e.t.c and other PCs of network which are in file iplist.txt

Thank you for your answer.

Community
  • 1
  • 1

1 Answers1

0

Nmap has grepable output already. Each IP and all of its open ports are on one line. It should be simple to get what you want from this, but you may be able to use it directly instead of your IP:port format.

bonsaiviking
  • 5,825
  • 1
  • 20
  • 35