Make --top-ports and -p a union instead of an intersection #504
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is related to issue #447 and is intended to fix it. There are still issues with the protocol modifiers but only for the
--top-ports
option. You can find some tests here on the result aiming to show how those two options are mixing up. Note that a scan like./nmap --top-ports 10 -p 12354,U:20 127.0.0.1
will not scan the UDP ports because you need to specify to Nmap that you want a UDP scan (-sU
). You can mix UDP, TCP and SCTP by just adding the corresponding options to enable all the types of scan you want.Example: Mixing UDP and TCP scans without SCTP would look like this (the verbose version is not available through GitHub, please ask me if needed):
sudo ./nmap -sU -sT --top-ports 3 -p 18,U:11,S:2 127.0.0.1
Resulting in these ports scanned:
Protocol>
-p
option |--top-ports
optionTCP> 18 | 80, 23, 443
UDP> 11, 18 | 631, 161, 137
SCTP> 2Waiting for feedback!
Cheers