How to convert CIDR to IP Range using nmap command

nmap -sL 10.0.0.12/28 | grep "Nmap scan report"

Nmap scan report for 10.0.0.0
Nmap scan report for 10.0.0.1
Nmap scan report for 10.0.0.2
Nmap scan report for 10.0.0.3
Nmap scan report for 10.0.0.4
Nmap scan report for 10.0.0.5
Nmap scan report for 10.0.0.6
Nmap scan report for 10.0.0.7
Nmap scan report for 10.0.0.8
Nmap scan report for 10.0.0.9
Nmap scan report for 10.0.0.10
Nmap scan report for 10.0.0.11
Nmap scan report for 10.0.0.12
Nmap scan report for 10.0.0.13
Nmap scan report for 10.0.0.14
Nmap scan report for 10.0.0.15

nmap -sL 10.0.0.12/28 | grep "Nmap scan report" |grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'

10.0.0.0
10.0.0.1
10.0.0.2
10.0.0.3
10.0.0.4
10.0.0.5
10.0.0.6
10.0.0.7
10.0.0.8
10.0.0.9
10.0.0.10
10.0.0.11
10.0.0.12
10.0.0.13
10.0.0.14
10.0.0.15

read -p "CIDR: " cidr; nmap -sL $cidr | grep "Nmap scan report" |grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'

Similar Posts:

Leave a Reply

Your email address will not be published.