• Stars
    star
    3,657
  • Rank 12,091 (Top 0.3 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 5 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

naabu

Features • Installation • Usage • Running naabu • Config • NMAP integration • CDN 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,u:53)
   -top-ports, -tp string      top ports to scan (default 100)
   -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's (only checks for 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)

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

CONFIGURATION:
   -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)
   -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 duration  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 (default 5) (deprecated)
   -mp, -metrics-port int    port to expose nuclei 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: sudo 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 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.

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 (-ps 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 Exclusion

Naabu also supports excluding CDN 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 (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.

More Repositories

1

nuclei

Fast and customizable vulnerability scanner based on simple YAML based DSL.
Go
14,482
star
2

katana

A next-generation crawling and spidering framework.
Go
10,861
star
3

subfinder

Fast passive subdomain enumeration tool.
Go
9,888
star
4

nuclei-templates

Community curated list of templates for the nuclei engine to find security vulnerabilities.
6,913
star
5

httpx

httpx is a fast and multi-purpose HTTP toolkit that allows running multiple probes using the retryablehttp library.
Go
5,706
star
6

interactsh

An OOB interaction gathering server and client library
Go
2,818
star
7

proxify

A versatile and portable proxy for capturing, manipulating, and replaying HTTP/HTTPS traffic on the go.
Go
2,362
star
8

uncover

Quickly discover exposed hosts on the internet using multiple search engines.
Go
2,026
star
9

dnsx

dnsx is a fast and multi-purpose DNS toolkit allow to run multiple DNS queries of your choice with a list of user-supplied resolvers.
Go
1,708
star
10

nuclei-burp-plugin

Nuclei plugin for BurpSuite
Java
1,133
star
11

shuffledns

MassDNS wrapper written in go that allows you to enumerate valid subdomains using active bruteforce as well as resolve subdomains with wildcard handling and easy input-output support.
Go
1,119
star
12

notify

Notify is a Go-based assistance package that enables you to stream the output of several tools (or read from a file) and publish it to a variety of supported platforms.
Go
951
star
13

public-bugbounty-programs

Community curated list of public bug bounty and responsible disclosure programs.
Go
876
star
14

mapcidr

Small utility program to perform multiple operations for a given subnet/CIDR ranges.
Go
811
star
15

cloudlist

Cloudlist is a tool for listing Assets from multiple Cloud Providers.
Go
691
star
16

tlsx

Fast and configurable TLS grabber focused on TLS based data collection.
Go
654
star
17

pdtm

ProjectDiscovery's Open Source Tool Manager
Go
521
star
18

asnmap

Go CLI and Library for quickly mapping organization network ranges using ASN information.
Go
516
star
19

wappalyzergo

A high performance go implementation of Wappalyzer Technology Detection Library
Go
498
star
20

chaos-client

Go client to communicate with Chaos DB API.
Go
498
star
21

alterx

Fast and customizable subdomain wordlist generator using DSL
Go
480
star
22

cdncheck

A utility to detect various technology for a given IP address.
Go
463
star
23

nuclei-ai-extension

Nuclei AI - Browser Extension for Rapid Nuclei Template Generation
JavaScript
422
star
24

simplehttpserver

Go alternative of python SimpleHTTPServer
Go
418
star
25

dnsprobe

DNSProb is a tool built on top of retryabledns that allows you to perform multiple dns queries of your choice with a list of user supplied resolvers.
Go
269
star
26

aix

AIx is a cli tool to interact with Large Language Models (LLM) APIs.
Go
200
star
27

nuclei-action

Vulnerability Scan with Nuclei
JavaScript
199
star
28

interactsh-web

Web dashboard for Interactsh client
TypeScript
162
star
29

openrisk

openrisk is a tool that generates a risk score based on the results of a Nuclei scan.
Go
160
star
30

rawhttp

Raw HTTP client in Go for complete request control and customization.
Go
120
star
31

retryabledns

Retryable DNS client in Go
Go
103
star
32

retryablehttp-go

Package retryablehttp provides a familiar HTTP client interface with automatic retries and exponential backoff
Go
92
star
33

nuclei-docs

Nuclei documentation
HTML
84
star
34

gologger

A simple layer for leveled logging in go
Go
66
star
35

utils

Helper Libraries
Go
65
star
36

network-fingerprint

A fingerprint generation helper for nuclei network templates
Go
61
star
37

goflags

A go flag wrapper with convenience helpers
Go
59
star
38

awesome-search-queries

Community curated list of search queries for various products across multiple search engines.
46
star
39

fastdialer

Dialer with DNS Cache + Dial History
Go
45
star
40

ipranger

IP/FQDN data structure helper with randomization of hosts and ports based on masscan internal logic
Go
43
star
41

dsl

DSL engine
Go
38
star
42

fuzzing-templates

Community curated list of nuclei templates for finding "unknown" security vulnerabilities.
36
star
43

hmap

Hybrid memory/disk map
Go
35
star
44

useragent

Curated list of categorized User Agents
Go
30
star
45

wallpapers

Collection of ProjectDiscovery wallpapers
26
star
46

collaborator

BurpSuite Standard/Private Collaborator Library
Go
22
star
47

tinydns

Tiny embeddable dns server
Go
22
star
48

blackrock

blackrock cipher based on masscan
Go
21
star
49

fdmax

Small Helper Library to increase automatically the file descriptors limits for the current process
Go
21
star
50

ratelimit

A Golang blocking rate limit implementation
Go
20
star
51

php-app-race-condition

Vulnerable demo application for the race condition
PHP
17
star
52

yamldoc-go

A documentation generator for YAML as code
Go
16
star
53

freeport

Free listening port from the OS
Go
16
star
54

clistats

A command based package for simple display of statistics
Go
15
star
55

fileutil

File helpers - Moved at https://github.com/projectdiscovery/utils
Go
12
star
56

notify-action

Notify is a helper utility written in Go that allows you to post output to multiple platforms.
12
star
57

naabu-action

A fast port scanner written in go with a focus on reliability and simplicity.
12
star
58

sqlc-go-builder

sqlc-go-builder
Go
12
star
59

subfinder-action

Fast and passive subdomain enumeration.
12
star
60

roundrobin

roundrobin with configurable rotating strategies
Go
11
star
61

executil

Exec helpers - Moved at https://github.com/projectdiscovery/utils
Go
11
star
62

networkpolicy

Network Policy Helper
Go
10
star
63

resolvercache-go

A DNS response caching library in go
Go
10
star
64

gozero

gozero: the wannabe zero dependency [language-here] runtime for Go developers - Experimental
Go
9
star
65

iputil

ip helpers - Moved at https://github.com/projectdiscovery/utils
Go
8
star
66

dnsx-action

Fast and multi-purpose DNS toolkit allow to run multiple DNS queries.
8
star
67

expirablelru

A TTL expiring LRU cache in go
Go
7
star
68

sslcert

Reworked version of https://golang.org/src/crypto/tls/generate_cert.go
Go
7
star
69

tailwindcss

Design system config file
JavaScript
7
star
70

goconfig

Helper library to save/restore internal values across multiple runs
Go
7
star
71

httpx-action

HTTP Web Server probing
7
star
72

cryptoutil

Library containing various crypto helpers
Go
7
star
73

stringsutil

Strings helper - Moved at https://github.com/projectdiscovery/utils
Go
6
star
74

nuclei-updatecheck-api

Nuclei UpdateChecking API caching github releases for update check
Go
5
star
75

filekv

File based kv store
Go
5
star
76

sarif

Sarif exporter
Go
5
star
77

sliceutil

sliceutils helpers - Moved at https://github.com/projectdiscovery/utils
Go
5
star
78

cloudlist-action

Cloudlist is a tool for listing Assets from multiple Cloud Providers.
5
star
79

mapsutil

Go maps helper functions - Moved at https://github.com/projectdiscovery/utils
Go
4
star
80

gostruct

Python like library to Interpret bytes as packed binary data
Go
4
star
81

folderutil

Package containing various folder helpers
Go
3
star
82

httputil

Http helper library
Go
3
star
83

templates-stats

A utility for extracting various meta data from nuclei-templates.
Go
3
star
84

docs

Centralized docs of ProjectDiscovery
MDX
3
star
85

reflectutil

Library containing reflection helpers
Go
2
star
86

urlutil

Helper library handling edge cases URLs - Moved at https://github.com/projectdiscovery/utils
Go
2
star
87

.github

Community health files for the @projectdiscovery organization
2
star
88

eslint-config

ESLint Configurations
JavaScript
1
star