projectdiscovery / naabu

A fast port scanner written in go with a focus on reliability and simplicity. Designed to be used in combination with other tools for attack surface discovery in bug bounties and pentests
https://projectdiscovery.io
MIT License
4.69k stars 548 forks source link

More flexible options for `--top-ports` flag #539

Closed mueller closed 8 months ago

mueller commented 1 year ago

Please describe your feature request:

Hello!

In it's current implementation, the --top-ports flag only allows the inputs 100, 1000 and full (see source code). It would be great if something like --top-ports 10, --top-ports 50 or essentially any number could be supported.

It could be implemented by taking the service list from nmap (https://svn.nmap.org/nmap/nmap-services), sorting them and creating a const list / array of ports. Then, if --top-ports 42 is called, the first 42 ports of the list are thrown into topPortsCLIMap.

Describe the use case of this feature:

Would be helpful if one want to scan only a few ports, like 10, or something in between the current options like 200.

I could try to implement it myself. As I see it, it should only require a few changes in https://github.com/projectdiscovery/naabu/blob/main/v2/pkg/runner/ports.go.

Mzack9999 commented 1 year ago

Depends on https://github.com/projectdiscovery/netdb/pull/27

Mzack9999 commented 8 months ago

I'm closing this for the time being as, unfortunately, it seems like nmap data can't be used without breaking ToS