robertdavidgraham / masscan

TCP port scanner, spews SYN packets asynchronously, scanning entire Internet in under 5 minutes.
GNU Affero General Public License v3.0
23.28k stars 3.05k forks source link

input ip:port #655

Open Uefi1 opened 2 years ago

Uefi1 commented 2 years ago

Hail, if I have an ip:port leaf can I submit such a leaf to masscan ?

mzpqnxow commented 8 months ago

Hail, if I have an ip:port leaf can I submit such a leaf to masscan ?

If you mean something like having certain ports probed on only a subset of the targets within a single scan, that is currently not supported, no

If you want to do this, you will have to perform multiple scans

For example, rather than one scan for (imaginary syntax) 1.2.3.4:21,22,23 and 2.3.4.5:23.24.25, you would need to perform three scans

Generally speaking, it's better to just use the following, even though it will emit more packets than you desire:

-p 21-25 1.2.3.4 2.3.4.5

This is better particularly when you have many more targets than in this contrived example, because you will benefit more from the random distribution of the packets

If you really want to have fine-grained port selection per-target (network or host) I think your best bet is to write a short script to generate the list of masscan commands for you

You can do this in bash with a little help from the comm command-line utility (which can do set operations on sorted files, using combinations of -1, -2 and -3) or in any programming language, with use of language provided set operations, since each command is really just an intersection or difference of sets of targets and ports