Black-box Penetration Test 1 (Excluding my own IP error while sorting the live ones)

$ cat discovery.nmap | grep for
Nmap scan report for 172.16.64.101
Nmap scan report for 172.16.64.140
Nmap scan report for 172.16.64.182
Nmap scan report for 172.16.64.199
Nmap scan report for 172.16.64.10 → (This my IP need to exclude)

$ cat discovery.nmap | grep for | grep -v “.10”
Nmap scan report for 172.16.64.140
Nmap scan report for 172.16.64.182
Nmap scan report for 172.16.64.199

(But it excluded with 172.16.64.101, here is the problem)

$ cat discovery.nmap | grep for | grep -v “.172.16.64.10”
Nmap scan report for 172.16.64.101
Nmap scan report for 172.16.64.140
Nmap scan report for 172.16.64.182
Nmap scan report for 172.16.64.199
Nmap scan report for 172.16.64.10

(I tried this but results the same problem)

ANY SOLUTION PLEASE!?

Thank you in advance.

I think they cover this in the write-up and the nmap lesson but here’s my approach:

nmap 172.16.64.1-9,11-254

will exclude your .10 IP address.

1 Like

@muhammad.malas-b89a2 You can use the --exclude 172.16.64.10 parameter with the nmap scan to exclude the IP from scanning.
But if you want to specifically grep strings out of a file, then try grep filters with regular expressions. Eg: Try grep -v "10 " or grep -v ".10$"

1 Like

grep -v ".10$" this command worked, Thank you a lot.

1 Like