Convert Figma logo to code with AI

projectdiscovery logonaabu

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

4,686
546
4,686
15

Top Related Projects

10,048

Nmap - the Network Mapper. Github mirror of official SVN repository.

23,262

TCP port scanner, spews SYN packets asynchronously, scanning entire Internet in under 5 minutes.

14,462

🤖 The Modern Port Scanner 🤖

4,131

Angry IP Scanner - fast and friendly network scanner

Directory/File, DNS and VHost busting tool written in Go

Find domains and subdomains related to a given domain

Quick Overview

Naabu is a fast port scanning tool written in Go, designed for large-scale scanning and penetration testing. It uses a customized dialer, optimized for speed and efficiency, making it capable of scanning millions of IPs and ports quickly.

Pros

  • High-speed scanning capabilities
  • Supports both TCP and UDP scanning
  • Customizable with various options for different scanning scenarios
  • Integrates well with other security tools in the projectdiscovery ecosystem

Cons

  • May trigger firewall or IDS alerts due to its aggressive scanning nature
  • Requires root/admin privileges for certain scanning modes
  • Limited compared to more comprehensive tools like Nmap for detailed port analysis
  • Can potentially overload target systems if not used carefully

Getting Started

To install and use Naabu:

# Install
GO111MODULE=on go get -v github.com/projectdiscovery/naabu/v2/cmd/naabu

# Basic usage
naabu -host example.com

# Scan multiple hosts
naabu -list hosts.txt

# Specify custom ports
naabu -p 80,443,8080-8090 -host example.com

# Use with other tools
echo example.com | naabu -silent | httpx -silent

Note: Ensure you have proper authorization before scanning any systems or networks you don't own or have explicit permission to test.

Competitor Comparisons

10,048

Nmap - the Network Mapper. Github mirror of official SVN repository.

Pros of nmap

  • Extensive feature set with advanced scanning techniques
  • Large, active community and long-standing reputation
  • Comprehensive documentation and extensive scripting capabilities

Cons of nmap

  • Slower scanning speed compared to naabu
  • More complex to use, especially for beginners
  • Larger resource footprint, which can be an issue on constrained systems

Code Comparison

nmap:

nmap -p- -sV -sC 192.168.1.0/24

naabu:

naabu -p- -host 192.168.1.0/24

nmap offers more detailed scanning options out-of-the-box, while naabu focuses on simplicity and speed. nmap's command includes version detection (-sV) and default script scanning (-sC), which naabu doesn't provide by default.

nmap is a comprehensive, feature-rich network scanning tool with a long history and extensive capabilities. It's ideal for in-depth network analysis and security auditing. naabu, on the other hand, is a newer, lightweight port scanning tool designed for speed and simplicity. It's particularly useful for quick reconnaissance and large-scale scanning tasks where speed is crucial.

While nmap provides more advanced features and flexibility, naabu excels in simplicity and raw scanning speed. The choice between the two depends on the specific requirements of the task at hand, with nmap being more suitable for detailed analysis and naabu for rapid port discovery.

23,262

TCP port scanner, spews SYN packets asynchronously, scanning entire Internet in under 5 minutes.

Pros of masscan

  • Extremely fast scanning capabilities, often faster than naabu for large-scale scans
  • More mature project with a longer development history
  • Supports a wider range of protocols and scanning techniques

Cons of masscan

  • Less user-friendly interface compared to naabu
  • Requires more system resources and may be overkill for smaller scans
  • Less frequent updates and maintenance

Code Comparison

masscan:

int masscan_main(int argc, char *argv[])
{
    struct Masscan masscan[1];
    int i;

    memset(masscan, 0, sizeof(*masscan));

naabu:

func main() {
    options := runner.ParseOptions()
    runner := runner.NewRunner(options)
    runner.RunEnumeration()
}

The code comparison shows that masscan is written in C, while naabu is written in Go. masscan's main function initializes a struct and uses lower-level memory management, while naabu's main function focuses on parsing options and running the enumeration process using higher-level abstractions.

Both tools are powerful port scanners, but they cater to different use cases. masscan excels in large-scale, high-speed scans, while naabu offers a more user-friendly experience and is better suited for smaller, targeted scans. The choice between the two depends on the specific requirements of the scanning task at hand.

14,462

🤖 The Modern Port Scanner 🤖

Pros of RustScan

  • Faster scanning speed due to Rust's performance optimizations
  • Cross-platform compatibility (Windows, macOS, Linux)
  • User-friendly interface with customizable output formats

Cons of RustScan

  • Limited built-in scripts compared to Naabu's extensive feature set
  • Less integration with other security tools in the ecosystem
  • Smaller community and fewer contributors

Code Comparison

RustScan:

use rustscan::Scanner;

let scanner = Scanner::new("192.168.1.1/24");
scanner.run().expect("Scan failed");

Naabu:

package main

import "github.com/projectdiscovery/naabu/v2/pkg/runner"

func main() {
    runner.New().Run()
}

Both tools aim to provide fast and efficient port scanning capabilities. RustScan leverages Rust's performance benefits and offers a more user-friendly experience, while Naabu focuses on integration with other security tools and provides a wider range of features. RustScan's code is more concise and straightforward, while Naabu's implementation allows for more flexibility and customization. The choice between the two depends on specific use cases and integration requirements within existing workflows.

4,131

Angry IP Scanner - fast and friendly network scanner

Pros of ipscan

  • User-friendly GUI for easy scanning and results visualization
  • Cross-platform compatibility (Windows, macOS, Linux)
  • Supports multiple output formats (XML, CSV, TXT)

Cons of ipscan

  • Limited customization options for advanced users
  • Slower scanning speed compared to naabu
  • Less suitable for integration into automated workflows

Code Comparison

ipscan (Java):

public void scan(final ScanningResultList results) {
    scanPortsFor(results);
    pingHost(results);
    fetchNames(results);
}

naabu (Go):

func (s *Scanner) ScanPorts(host string) ([]int, error) {
    ports, err := s.scanPorts(host)
    return ports, err
}

The code snippets show that ipscan uses a more high-level approach with separate methods for different scanning tasks, while naabu focuses on port scanning with a single method. This reflects ipscan's user-friendly nature and naabu's specialized port scanning functionality.

Directory/File, DNS and VHost busting tool written in Go

Pros of gobuster

  • More versatile with multiple modes (DNS, vhost, directory, s3 bucket enumeration)
  • Supports custom wordlists and pattern-based brute-forcing
  • Extensive configuration options for fine-tuning scans

Cons of gobuster

  • Primarily focused on web-based enumeration, less suited for network scanning
  • May be slower for large-scale scans compared to naabu's optimized port scanning
  • Less integration with other security tools in the projectdiscovery ecosystem

Code Comparison

gobuster:

func (d *DNSGobuster) Start(words <-chan string, results chan<- Result) {
    for word := range words {
        d.processWord(word, results)
    }
}

naabu:

func (s *Scanner) ScanRange(cidr string) error {
    return s.EnumerateHosts(cidr, func(ip string) {
        s.ScanHost(ip)
    })
}

Both tools use Go and employ channel-based concurrency for efficient scanning. gobuster focuses on DNS enumeration and web directory brute-forcing, while naabu specializes in fast port scanning across IP ranges. The code snippets highlight their different purposes: gobuster processes words for enumeration, while naabu scans IP ranges and individual hosts.

Find domains and subdomains related to a given domain

Pros of assetfinder

  • Lightweight and fast, focusing solely on subdomain enumeration
  • Easy to use with simple command-line interface
  • Can be easily integrated into other tools and scripts

Cons of assetfinder

  • Limited functionality compared to naabu's port scanning capabilities
  • May miss some subdomains that naabu's more comprehensive approach could find
  • Lacks advanced features like rate limiting and custom DNS resolvers

Code Comparison

assetfinder:

func main() {
    sources := []Source{
        &Crtsh{},
        &Hackertraget{},
        &Threatcrowd{},
        &Certspotter{},
        &Findsubdomains{},
    }
    // ... (subdomain enumeration logic)
}

naabu:

func main() {
    options := &runner.Options{}
    flagSet := goflags.NewFlagSet()
    flagSet.SetDescription(`Naabu is a port scanning tool written in Go that allows you to enumerate valid ports for hosts in a fast and reliable manner.`)
    // ... (port scanning logic)
}

The code snippets show that assetfinder focuses on subdomain enumeration using various sources, while naabu is designed for port scanning with more complex options and functionality.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

naabu

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

naabu

  • 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
  • Host Discovery scan (experimental)
  • NMAP integration for service discovery
  • Multiple input support - STDIN/HOST/IP/CIDR/ASN
  • Multiple output format support - JSON/TXT/STDOUT

Usage

naabu -h

This will display help for the tool. Here are all the switches it supports.

Usage:
  ./naabu [flags]

INPUT:
   -host string[]              hosts to scan ports for (comma-separated)
   -list, -l string            list of hosts to scan ports (file)
   -exclude-hosts, -eh string  hosts to exclude from the scan (comma-separated)
   -exclude-file, -ef string   list of hosts to exclude from scan (file)

PORT:
   -port, -p string            ports to scan (80,443, 100-200)
   -top-ports, -tp string      top ports to scan (default 100) [full,100,1000]
   -exclude-ports, -ep string  ports to exclude from scan (comma-separated)
   -ports-file, -pf string     list of ports to scan (file)
   -port-threshold, -pts int   port threshold to skip port scan for the host
   -exclude-cdn, -ec           skip full port scans for CDN/WAF (only scan for port 80,443)
   -display-cdn, -cdn          display cdn in use

RATE-LIMIT:
   -c int     general internal worker threads (default 25)
   -rate int  packets to send per second (default 1000)

UPDATE:
   -up, -update                 update naabu to latest version
   -duc, -disable-update-check  disable automatic naabu update check

OUTPUT:
   -o, -output string  file to write output to (optional)
   -j, -json           write output in JSON lines format
   -csv                write output in csv format

CONFIGURATION:
   -config string                   path to the naabu configuration file (default $HOME/.config/naabu/config.yaml)
   -scan-all-ips, -sa               scan all the IP's associated with DNS record
   -ip-version, -iv string[]        ip version to scan of hostname (4,6) - (default 4) (default ["4"])
   -scan-type, -s string            type of port scan (SYN/CONNECT) (default "s")
   -source-ip string                source ip and port (x.x.x.x:yyy)
   -interface-list, -il             list available interfaces and public ip
   -interface, -i string            network Interface to use for port scan
   -nmap                            invoke nmap scan on targets (nmap must be installed) - Deprecated
   -nmap-cli string                 nmap command to run on found results (example: -nmap-cli 'nmap -sV')
   -r string                        list of custom resolver dns resolution (comma separated or from file)
   -proxy string                    socks5 proxy (ip[:port] / fqdn[:port]
   -proxy-auth string               socks5 proxy authentication (username:password)
   -resume                          resume scan using resume.cfg
   -stream                          stream mode (disables resume, nmap, verify, retries, shuffling, etc)
   -passive                         display passive open ports using shodan internetdb api
   -irt, -input-read-timeout value  timeout on input read (default 3m0s)
   -no-stdin                        Disable Stdin processing

HOST-DISCOVERY:
   -sn, -host-discovery           Perform Only Host Discovery
   -Pn, -skip-host-discovery      Skip Host discovery
   -ps, -probe-tcp-syn string[]   TCP SYN Ping (host discovery needs to be enabled)
   -pa, -probe-tcp-ack string[]   TCP ACK Ping (host discovery needs to be enabled)
   -pe, -probe-icmp-echo          ICMP echo request Ping (host discovery needs to be enabled)
   -pp, -probe-icmp-timestamp     ICMP timestamp request Ping (host discovery needs to be enabled)
   -pm, -probe-icmp-address-mask  ICMP address mask request Ping (host discovery needs to be enabled)
   -arp, -arp-ping                ARP ping (host discovery needs to be enabled)
   -nd, -nd-ping                  IPv6 Neighbor Discovery (host discovery needs to be enabled)
   -rev-ptr                       Reverse PTR lookup for input ips

OPTIMIZATION:
   -retries int       number of retries for the port scan (default 3)
   -timeout int       millisecond to wait before timing out (default 1000)
   -warm-up-time int  time in seconds between scan phases (default 2)
   -ping              ping probes for verification of host
   -verify            validate the ports again with TCP verification

DEBUG:
   -health-check, -hc        run diagnostic check up
   -debug                    display debugging information
   -verbose, -v              display verbose output
   -no-color, -nc            disable colors in CLI output
   -silent                   display only results in output
   -version                  display version of naabu
   -stats                    display stats of the running scan (deprecated)
   -si, -stats-interval int  number of seconds to wait between showing a statistics update (deprecated) (default 5)
   -mp, -metrics-port int    port to expose naabu metrics on (default 63636)

Installation Instructions

Download the ready to run binary / docker or install with GO

Prerequisite

Note: before installing naabu, make sure to install libpcap library for packet capturing.

To install libcap on Linux: sudo apt install -y libpcap-dev, on Mac: brew install libpcap

Installing Naabu

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.

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.

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.

naabu -p 80,443,21-23,u:53 -host hackerone.com

By default, the Naabu checks for nmap's Top 100 ports. It supports the following in-built port lists -

FlagDescription
-top-ports 100Scan for nmap top 100 port
-top-ports 1000Scan 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.

naabu -p - -exclude-ports 80,443

To run the naabu on a list of hosts, -list option can be used.

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.

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.

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 which will then find running http servers on the host.

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. Both ranges can be piped together as input. If IPv6 is used, connectivity must be correctly configured, and the network interface must have an IPv6 address assigned (inet6) and a default gateway.

echo hackerone.com | dnsx -resp-only -a -aaaa -silent | 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 IPv6 addresses while resolving domain names.

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 version, ip-version 4,6 can be used along with -scan-all-ips flag.

echo hackerone.com | ./naabu -iv 4,6 -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, as outlined below. Host discovery is completed automatically before beginning a connect/syn scan if the process has enough privileges. -sn flag instructs the toll to perform host discovery only. -Pn flag skips the host discovery phase. Host discovery is completed using multiple internal methods; one can specify the desired approach to perform host discovery by setting available options.

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:-

echo hackerone.com | naabu -nmap-cli 'nmap -sV -oX nmap-output'
                  __       
  ___  ___  ___ _/ /  __ __
 / _ \/ _ \/ _ \/ _ \/ // /
/_//_/\_,_/\_,_/_.__/\_,_/ v2.0.0        

    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 TCP/ICMP/SYN scan with root privileges
[INF] Found 4 ports on host hackerone.com (104.16.99.52)

hackerone.com:443
hackerone.com:80
hackerone.com:8443
hackerone.com:8080

[INF] Running nmap command: nmap -sV -p 80,8443,8080,443 104.16.99.52

Starting Nmap 7.01 ( https://nmap.org ) at 2020-09-23 05:02 UTC
Nmap scan report for 104.16.99.52
Host is up (0.0021s latency).
PORT     STATE SERVICE       VERSION
80/tcp   open  http          cloudflare
443/tcp  open  ssl/https     cloudflare
8080/tcp open  http-proxy    cloudflare
8443/tcp open  ssl/https-alt cloudflare

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:

package main

import (
	"log"

	"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()
}

Notes

  • Naabu allows arbitrary binary execution as a feature to support nmap integration.
  • Naabu is designed to scan ports on multiple hosts / mass port scanning.
  • As default naabu is configured with a assumption that you are running it from VPS.
  • We suggest tuning the flags / rate if running naabu from local system.
  • For best results, run naabu as root user.

Naabu is made with 🖤 by the projectdiscovery team. Community contributions have made the project what it is.

See the Thanks.md file for more details.