Nmap Port Scanning

Scan for alive hosts

$ nmap -sn $ip/24

$ nmap -vvv -sn $ip/24

If you want little faster

$ nmap -sn -n $ip/24 > ip-range.txt

Scan specific IP range

$ nmap -sP 10.0.0.0-100

Auto Recon

autorecon 10.10.10.3

Initial Scan TCP

nmap -sC -sV -O -oA initial 10.10.10.3Full Scan TCP 

Full Scan TCP

Comprehensive nmap scans in the background to make sure we cover all bases.

Full Scan UDP

Normal Scan

Scan specific machine

Scan common port

The command:

  • Scan 1024 most common ports

  • Run OS detection

  • Run default nmap scripts

  • Save the result into .nmap, .gnmap and .xml

  • Faster

Fast scanning

Scan 100 most common ports

Quick TCP Scan

Quick UDP Scan

Full TCP Scan

Port knock

Scan deeply

Scanning more deeply:

This command:

  • Scan all 65535 ports with full connect scan

  • Take very long time

  • Print out straigt away instead of having to wait until end of the scan

Tips:

Scanning this takes a long time, suggest to leave the scan running overnight, when you're sleep or move on to different box in the meantime.

Maximum scan delay

The –max-scan-delay is used to specify the maximum amount of time Nmap should wait between probes.

Maximum Retries

–max-retries specifies the number of times a packet is to be resent on a port to check if it is open or closed. If –max-retries is set to 0, the packets will be sent only once on a port and no retries will be done.

Scan for specific port

Use -T: specifies TCP ports. Use -U: for UDP ports.

Scan for unused IP addresses and store in text file

Other option

UDP scan

Scanning this might slow and unreliadble

Top ports

To save time and network resources, we can also scan multiple IPs, probing for a short list of a an common ports. For example, let’s conduct a TCP connect scan for the top twenty TCP ports with kw Ma the --top-ports option and enable OS version detection, script scanning, and traceroute with -A:

Scan targets from a text file

Create a text file contains of our targets machine (like in method Scan for unused IP addresses and store in text file):

Run this nmap command with -iL

Onetwopunch.sh

Grab the latest bash script

Create a text file contains of our targets machine (like in method Scan for unused IP addresses and store in text file):

Then, run the script and tell it to read our txt file and perform TCP scan against each target.

So, the idea behind the script to generate a scan of 65,535 ports on the targets. The script use unicornscan to scan all ports, and make a list of those ports that are open. The script then take the open ports and pass them to nmap for service detection.

AutoRecon

GitHub - Tib3rius/AutoRecon: AutoRecon is a multi-threaded network reconnaissance tool which performs automated enumeration of services.

Last updated