masscan icon indicating copy to clipboard operation
masscan copied to clipboard

input ip:port

Open Uefi1 opened this issue 3 years ago • 1 comments

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

Uefi1 avatar Mar 08 '22 16:03 Uefi1

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

  • One for the overlap/common addresses/ports via "1.2.3.4 2.3.4.5 -p 23"
  • One for each unique set of ports/hosts
    • "1.2.3.4 -p 21,22"
    • "2.3.4.5 -p 24,25"

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

mzpqnxow avatar Dec 25 '23 17:12 mzpqnxow