百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
N

naabu

> DevOps
开源

一个使用 Go 编写的快速端口扫描器,其重点是可靠性和简单性。设计用于与其他工具结合使用,以发现攻击面。

6.2K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个使用 Go 编写的快速端口扫描器,其重点是可靠性和简单性。设计用于与其他工具结合使用,以发现攻击面。


Features • Installation • Usage • Running naabu • Config • NMAP integration • CDN/WAF Exclusion • Discord

Naabu is a port scanning tool written in Go that allows you to enumerate valid ports for hosts in a fast and reliable manner. It is a really simple tool that does fast SYN/CONNECT/UDP scans on the host/list of hosts and lists all ports that return a reply. # Features


- Fast And Simple **SYN/CONNECT/UDP** probe based scanning - Optimized for ease of use and **lightweight** on resources - **DNS** Port scan - **Automatic IP Deduplication** for DNS port scan - **IPv4/IPv6** Port scan (**experimental**) - **Passive** Port enumeration using Shodan [Internetdb](https://internetdb.shodan.io) - **Host Discovery** scan (**experimental**) - **NMAP** integration for service discovery - **Custom UDP payloads** for CONNECT scans - **Native UDP service probes** powered by nmap-service-probes - Multiple input support - **STDIN/HOST/IP/CIDR/ASN** - Multiple output format support - **JSON/TXT/STDOUT** # Usage ```sh naabu -h ``` This will display help for the tool. Here are all the switches it supports. ``` … ``` # Installation Instructions Download the ready to run [binary](https://github.com/projectdiscovery/naabu/releases/) / [docker](https://hub.docker.com/r/projectdiscovery/naabu) or install with GO ## Prerequisite > **Note**: before installing naabu, make sure to install `libpcap` library for packet capturing. To install libpcap on **Linux**: `sudo apt install -y libpcap-dev`, on **Mac**: `brew install libpcap`, on **Windows**: install [Npcap](https://npcap.com/) ## Installing Naabu ```sh go install -v github.com/projectdiscovery/naabu/v2/cmd/naabu@latest ``` # Running Naabu To run the tool on a target, just use the following command. ```sh naabu -host hackerone.com ``` This will run the tool against hackerone.com. There are a number of configuration options that you can pass along with this command. The verbose switch `-v` can be used to display verbose information. ```console naabu -host hackerone.com __ ___ ___ ___ _/ / __ __ / _ \/ _ \/ _ \/ _ \/ // / /_//_/\_,_/\_,_/_.__/\_,_/ v2.0.3 projectdiscovery.io [WRN] Use with caution. You are responsible for your actions [WRN] Developers assume no liability and are not responsible for any misuse or damage. [INF] Running SYN scan with root privileges [INF] Found 4 ports on host hackerone.com (104.16.100.52) hackerone.com:80 hackerone.com:443 hackerone.com:8443 hackerone.com:8080 ``` The ports to scan for on the host can be specified via `-p` parameter (udp ports must be expressed as `u:port`). It takes nmap format ports and runs enumeration on them. ```sh naabu -p 80,443,21-23,u:53 -host hackerone.com ``` For UDP scans, you can specify a custom payload to send using the `-cp` or `--connect-payload` flag. This is particularly useful for UDP services that require specific data to respond: ```sh naabu -p u:53 -host example.com -cp "DNS query payload" ``` By default, the Naabu checks for nmap's `Top 100` ports. It supports the following in-built port lists - | Flag | Description | |-------------------|--------------------------------------| | `-top-ports 100` | Scan for nmap top **100** port | | `-top-ports 1000` | Scan for nmap top **1000** port | | `-p - ` | Scan for full ports from **1-65535** | You can also specify specific ports which you would like to exclude from the scan. ```sh naabu -p - -exclude-ports 80,443 ``` To run the naabu on a list of hosts, `-list` option can be used. ```sh naabu -list hosts.txt ``` To run the naabu on a ASN, AS input can be used. It takes the IP address available for given ASN and runs the enumeration on them. ```console echo AS14421 | naabu -p 80,443 216.101.17.249:80 216.101.17.249:443 216.101.17.248:443 216.101.17.252:443 216.101.17.251:80 216.101.17.251:443 216.101.17.250:443 216.101.17.250:80 ``` You can also get output in json format using `-json` switch. This switch saves the output in the JSON lines format. ```console naabu -host 104.16.99.52 -json {"ip":"104.16.99.52","port":443} {"ip":"104.16.99.52","port":80} ``` The ports discovered can be piped to other tools too. For example, you can pipe the ports discovered by naabu to [httpx](https://github.com/projectdiscovery/httpx) which will then find running http servers on the host. ```console echo hackerone.com | naabu -silent | httpx -silent http://hackerone.com:8443 http://hackerone.com:443 http://hackerone.com:8080 http://hackerone.com:80 ``` The speed can be controlled by changing the value of `rate` flag that represent the number of packets per second. Increasing it while processing hosts may lead to increased false-positive rates. So it is recommended to keep it to a reasonable amount. # IPv4 and IPv6 Naabu supports both IPv4 and IPv6, and both are enabled by default. If IPv6 is used, connectivity must be correctly configured, and the network interface must have an IPv6 address assigned (`inet6`) and a default gateway. ```console echo hackerone.com | naabu -p 80 -silent 104.16.99.52:80 104.16.100.52:80 2606:4700::6810:6434:80 2606:4700::6810:6334:80 ``` The option `-ip-version 6` makes the tool use only IPv6 addresses while resolving domain names. ```console echo hackerone.com | ./naabu -p 80 -ip-version 6 __ ___ ___ ___ _/ / __ __ / _ \/ _ \/ _ \/ _ \/ // / /_//_/\_,_/\_,_/_.__/\_,_/ v2.0.8 projectdiscovery.io Use with caution. You are responsible for your actions Developers assume no liability and are not responsible for any misuse or damage. [INF] Running CONNECT scan with non root privileges [INF] Found 1 ports on host hackerone.com (2606:4700::6810:6334) hackerone.com:80 ``` To scan all the IPs of both versions, `-scan-all-ips` flag can be used. ```console echo hackerone.com | ./naabu -sa -p 80 -silent [INF] Found 1 ports on host hackerone.com (104.16.100.52) hackerone.com:80 [INF] Found 1 ports on host hackerone.com (104.16.99.52) hackerone.com:80 [INF] Found 1 ports on host hackerone.com (2606:4700::6810:6334) hackerone.com:80 [INF] Found 1 ports on host hackerone.com (2606:4700::6810:6434) hackerone.com:80 ``` # Host Discovery Naabu optionally supports multiple options to perform host discovery. Host discovery is optional and can be enabled with the `-wn` flag. `-sn` flag instructs the tool to perform host discovery only. Available options to perform host discovery: - **ARP** ping (`-arp`) - TCP **SYN** ping (`-ps 80`) - TCP **ACK** ping (`-pa 443`) - ICMP **echo** ping (`-pe`) - ICMP **timestamp** ping (`-pp`) - ICMP **address mask** ping (`-pm`) - IPv6 **neighbor discovery** (`-nd`) # Configuration file Naabu supports config file as default located at `$HOME/.config/naabu/config.yaml`, It allows you to define any flag in the config file and set default values to include for all scans. # Nmap integration We have integrated nmap support for service discovery or any additional scans supported by nmap on the found results by Naabu, make sure you have `nmap` installed to use this feature. To use,`nmap-cli` flag can be used followed by nmap command, for example:- ``` … ``` # Service Version Detection Naabu has built-in service version detection using nmap's service probes database. This runs in parallel with port scanning for maximum performance. ```sh naabu -host scanme.sh -sV ``` ```console scanme.sh:22 [ssh OpenSSH/6.6.1p1] scanme.sh:80 [http Apache httpd/2.4.7] scanme.sh:9929 [nping-echo Nping echo] [INF] Found 3 ports on host scanme.sh (45.33.32.156) with 3 services identified ``` Available flags: | Flag | Description | |------|-------------| | `-sV` | Enable service version detection | | `-sV-fast` | Only probe port-hinted services (faster, skips fallback probes) | | `-sV-timeout duration` | Timeout for service version probes (default 5s) | | `-sV-workers int` | Number of concurrent service version workers (default 25) | | `-sV-probes string` | Custom nmap-service-probes file path (auto-detected from local nmap install if empty) | | `-sD` | Service discovery (match port number to service name, no active probing) | The `-sV` flag requires the `nmap-service-probes` database file. naabu does not ship this database itself (it is licensed under the copyleft Nmap Public Source License, which is incompatible with naabu's MIT license), so it reads the file from a local nmap installation, automatically looking in standard nmap installation paths. To use a custom file, specify the path with `-sV-probes`. # UDP Service Probes UDP services typically stay silent when they receive an empty datagram, so a blind UDP port scan misses most of them. With `-uP` (`-udp-probes`) naabu picks a protocol-specific payload from the `nmap-service-probes` database for each UDP port being scanned (DNS query for 53, NTP request for 123, SNMPv1 GetRequest for 161, and so on), so real services have something to reply to and naabu can report them as open. ```sh naabu -host scanme.sh -p u:53,u:123,u:161 -uP ``` Notes: - `-uP` is opt-in and additive. When disabled (the default) UDP scans keep their historical zero-length-datagram behavior. - The selected probe is the highest-priority (lowest-rarity) match for the destination port; if no probe is registered for a port the scan falls back to the empty datagram. - A user-supplied payload via `-cp` always wins over the automatic probe for that port. - `-uP` reuses the same probe database as `-sV`, so you can combine the two without paying the parse cost twice. The probe file is auto-located from a local nmap install; use `-sV-probes` to point at a custom file. If no database can be found `-uP` logs a warning and is silently disabled. # CDN/WAF Exclusion Naabu also supports excluding CDN/WAF IPs being port scanned. If used, only `80` and `443` ports get scanned for those IPs. This feature can be enabled by using `exclude-cdn` flag. Currently `cloudflare`, `akamai`, `incapsula` and `sucuri` IPs are supported for exclusions. # Scan Status Naabu exposes json scan info on a local port bound to localhost at `http://localhost:63636/metrics` (the port can be changed via the `-metrics-port` flag) # Using naabu as library The following sample program scan the port `80` of `scanme.sh`. The results are returned via the `OnResult` callback: ```go package main import ( "log" "context" "github.com/projectdiscovery/goflags" "github.com/projectdiscovery/naabu/v2/pkg/result" "github.com/projectdiscovery/naabu/v2/pkg/runner" ) func main() { options := runner.Options{ Host: goflags.StringSlice{"scanme.sh"}, ScanType: "s", OnResult: func(hr *result.HostResult) { log.Println(hr.Host, hr.Ports) }, Ports: "80", } naabuRunner, err := runner.NewRunner(&options) if err != nil { log.Fatal(err) } defer naabuRunner.Close() naabuRunner.RunEnumeration(context.Background()) } ``` > **`OnResult`** is called once after the scan completes with aggregated results. To process results **in real-time** as ports are discovered, use **`OnReceive`** instead. The `Stream` option only controls async target loading — it does not affect when callbacks fire. # Notes - Na

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Gocdn-exclusionhacktoberfestnmapport-enumeration

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类DevOps
定价开源

> 相关工具

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理