Git Product home page Git Product logo

naabu's Introduction

naabu

License Go Report Card contributions welcome

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 scans on the host/list of hosts and lists all ports that return a reply.

Inspired by the great furious project of @liamg.

Resources

Features

naabu

  • Simple and modular code base making it easy to contribute.
  • Fast And Simple SYN probe based scanning.
  • Multiple Output formats supported (Json, File, Stdout)
  • Optimized for ease of use and lightweight on resources
  • Stdin and stdout support for integrating in workflows
  • Flexible definitions for ports to scan

Usage

naabu -h

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

Flag Description Example
-host Host to find ports for naabu -host 192.168.1.1
-hL File containing list of hosts to enumerate ports naabu -hL hosts.txt
-ports Ports to enumerate for on hosts (top-100, top-1000, full, custom) naabu -ports 80,443
-ports-file File containing ports to enumerate for on hosts naabu -ports-file ports.txt
-o File to write output to (optional) naabu -o output.txt
-oD Directory to write enumeration results to (optional) naabu -oD outputs
-oJ Write output in JSON lines Format naabu -oJ output.json
-silent Show only host:ports in output naabu -silent
-retries Number of retries for the port scan probe (default 1) naabu -retries 4
-rate Rate of port scan probe requests (default 1000) naabu -rate 100
-v Show Verbose output naabu -v
-nC Don't Use colors in output naabu -nC
-t Number of concurrent goroutines for scanning (default 10) naabu -t 10
-timeout Millisecond to wait before timing out (default 700) naabu -timeout 1000
-exclude-ports Ports to exclude from enumeration naabu -exclude-ports 80,443
-verify Validate the ports again naabu -verify
-version Show version of naabu naabu -version

Installation Instructions

Direct Installation

Linux

There are various ways to install the tool on linux. You can install it via docker, directly go get it or download and run the binary.

From Source

naabu requires go1.13+ to install successfully. Run the following command to get the repo -

go get -v github.com/projectdiscovery/naabu/cmd/naabu

You also need the following libraries installed for the go get to work - libpcap, libpcap-dev.

On Ubuntu linux libpcap is installed by default. For those compiling from source, the header files can be installed by using apt-get install libpcap-dev.

From Binary

The installation is easy. You can download the pre-built binaries from the Releases page. Extract them using tar, move it to your $PATH and you're ready to go.

> tar -xzvf naabu-linux-amd64.tar
> mv naabu-linux-amd64 /usr/bin/naabu
> naabu 

From Docker

You can use the official dockerhub image at naabu. Simply run -

> docker pull projectdiscovery/naabu

The above command will pull the latest tagged release from the dockerhub repository.

If you want to build the container yourself manually, git clone the repo, then build and run the following commands

  • Clone the repo using git clone https://github.com/projectdiscovery/naabu.git
  • Build your docker container
docker build -t projectdiscovery/naabu .
  • After building the container using either way, run the following -
docker run -it projectdiscovery/naabu

The above command is the same as running -h

For example, this runs the tool against hackerone.com and output the results to your host file system:

docker run -it projectdiscovery/naabu -host hackerone.com > hackerone.com.txt

MacOS

On MacOS, the install instructions are similar to linux. You can download a binary for MacOS from the releases page. You can also go get the package to install it from source.

You need libpcap library on MacOS to build successfully from source or run the downloaded binary. If you are using homebrew as your package manager, you can run brew install libpcap to download and install it in your system.

After that, you can just run the following command to download and install naabu -

go get -v github.com/projectdiscovery/naabu/cmd/naabu

See the From Docker section for install instructions on MacOS with docker.

Windows

Windows version is currently not usable without docker.

The docker install instructions are identical to the ones for other platforms. See the From Docker section for install instructions on Windows.

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.

[INF] Starting scan on host hackerone.com (104.16.100.52)
[INF] Found 4 ports on host hackerone.com (104.16.100.52) with latency 25.46362ms
hackerone.com:443
hackerone.com:8443
hackerone.com:80
hackerone.com:8080

The ports to scan for on the host can be specified via -ports parameter. It takes nmap format ports and runs enumeration on them.

> naabu -ports 80,443,21-23 -host hackerone.com

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

  • top-100 - Checks for nmap top 100 ports.
  • top-1000 - Checks for nmap top 1000 ports.
  • full - Checks for 1-65535 ports.

You can also specify a file which contains the ports to scan for using the pL format. You can also specify specific ports which you would like to exclude from the scan.

> naabu -ports full -exclude-ports 80,443

The -o command can be used to specify an output file.

> naabu -host hackerone.com -o output.txt

To run the tool on a list of hosts, -hL option can be used. This requires a directory to write the output files. Ports for each host from the list are written in a text file in the directory specified by the -oD flag with their name being the host name.

> cat hosts.txt
hackerone.com
google.com

> naabu -hL hosts.txt -oD ~/path/to/output
> ls ~/path/to/output

hackerone.com.txt
google.com.txt

If you want to save results to a single file while using a domain list, specify the -o flag with the name of the output file.

> cat hosts.txt
hackerone.com
google.com

> naabu -hL hosts.txt -o ~/path/to/output.txt
> ls ~/path/to/

output.txt

You can also get output in json format using -oJ switch. This switch saves the output in the JSON lines format.

> naabu -host hackerone.com -oJ -o output.json
> cat output.json

{"host":"hackerone.com","port":8443}
{"host":"hackerone.com","port":443}
{"host":"hackerone.com","port":8080}
{"host":"hackerone.com","port":80}

The -silent switch can be used to show only ports found without any other info.

Hosts can also be piped to naabu and port enumeration can be ran on them. For example -

> echo "hackerone.com" | naabu
> cat targets.txt | naabu

The ports discovered can be piped to other tools too. For example, you can pipe the ports discovered by naabu to the awesome httprobe tool by @tomnomnom which will then find running http servers on the host.

> echo "hackerone.com" | naabu -silent | httprobe

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

If you want a second layer validation of the ports found, you can instruct the tool to make a TCP connection for every port and verify if the connection succeeded. This method is very slow, but is really reliable. This is similar to using nmap as a second layer validation

> naabu -host hackerone.com -verify

The most optimal setting for threads is 10. Increasing it while processing hosts may lead to increased false positive rates. So it is recommended to keep it low.

License

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.

naabu's People

Contributors

ehrishirajsharma avatar ehsandeep avatar ice3man543 avatar nicolascb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.