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 547 forks source link

Add scan progress #938

Closed jagnjilo1234 closed 8 months ago

jagnjilo1234 commented 8 months ago

Hi, I apologize if this is something that has already been implemented, I cannot seem to figure it out. Is there a way to track what percentage of ports was already scanned? For example, masscan has this output printed to the terminal while the scan is running

image

I am once again sorry if this was already implemented, for me it would matter because I would like to make a web endpoint where I can track my scan progress, and therefore I'm trying to find ways to actually check it through the CLI. Thanks :D

Mzack9999 commented 8 months ago

Just use the -stats option:

$ echo 192.168.5.0/24 | naabu -p 1-65000 -rate 1 -stats -verbose -debug -Pn

                  __
  ___  ___  ___ _/ /  __ __
 / _ \/ _ \/ _ \/ _ \/ // /
/_//_/\_,_/\_,_/_.__/\_,_/

                projectdiscovery.io

[INF] Current naabu version 2.2.1 (latest)
[INF] Running CONNECT scan with non root privileges

The stats are available at http://127.0.0.1:63636/metrics. You can customize the port with the cli option -mp xxx (with xxx being the wanted port number):

$ curl http://127.0.0.1:63636/metrics
{"ports":65000,"retries":3,"hosts_with_port":0,"duration":"0:00:10","total":49920000,"errors":0,"hosts":256,"startedAt":"2024-01-30T14:14:07.821026+01:00","packets":2}