Skip to content
Robert David Graham edited this page Sep 11, 2013 · 2 revisions

This parameter tells us which ports we need to scan. For example, the following says to scan ports in the range 20 through 25, plus port 80:

# masscan -p20-25,80

Both a short and long form are supported:

# masscan --ports 20-25,80

If the same parameter specified a second time, the effective is additive:

# masscan -p20-25 --ports 80

To remove a port, use the --exclude-ports parameter:

# masscan -p20-26,80 --exclude-ports 26

By defaults, this parameter assumes TCP ports. To specify UDP ports, the "U:" option should be put in front:

# masscan -p20-25,80,U:161

Conversely, the --udp-ports parameter can be used:

# masscan --udp-ports 161

Nmap Compatibility: This works essentially the same as nmap.