Skip to content

Commit

Permalink
Merge pull request #218 from projectdiscovery/dev
Browse files Browse the repository at this point in the history
v2.0.5 Release preparation
  • Loading branch information
ehsandeep authored Oct 12, 2021
2 parents b5437c0 + b18d954 commit b6bca90
Show file tree
Hide file tree
Showing 16 changed files with 275 additions and 563 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/dockerhub-push.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: 🌥 Docker Push

on:
release:
types: [published]
workflow_run:
workflows: ["🎉 Release Binary"]
types:
- completed
workflow_dispatch:

jobs:
Expand All @@ -12,6 +14,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Get Github tag
id: meta
run: |
echo "::set-output name=tag::$(curl --silent "https://api.github.com/repos/projectdiscovery/naabu/releases/latest" | jq -r .tag_name)"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

Expand All @@ -30,4 +37,4 @@ jobs:
context: .
platforms: linux/amd64,linux/arm64,linux/arm
push: true
tags: projectdiscovery/naabu:latest
tags: projectdiscovery/naabu:latest,projectdiscovery/naabu:${{ steps.meta.outputs.tag }}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:1.17.0-alpine AS builder
FROM golang:1.17.2-alpine AS builder
RUN apk add build-base libpcap-dev
RUN GO111MODULE=on go get -v github.com/projectdiscovery/naabu/v2/cmd/naabu
RUN go install -v github.com/projectdiscovery/naabu/v2/cmd/naabu@latest

FROM alpine:3.14
RUN apk add nmap libpcap-dev bind-tools ca-certificates
Expand Down
211 changes: 71 additions & 140 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,86 +49,70 @@ naabu -h

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

<details>
<summary> 👉 naabu help menu 👈</summary>

```
Usage of ./naabu:
-c int
General internal worker threads (default 25)
-config string
Config file
-debug
Enable debugging information
-exclude-cdn
Skip full port scans for CDNs (only checks for 80,443)
-exclude-file string
Specifies a newline-delimited file with targets to be excluded from the scan (ip, cidr)
-exclude-hosts string
Specifies a comma-separated list of targets to be excluded from the scan (ip, cidr)
-exclude-ports string
Ports to exclude from enumeration
-host string
Host to find ports for
-iL string
File containing list of hosts to enumerate ports
-interface string
Network Interface to use for port scan
-interface-list
List available interfaces and public ip
-json
Write output in JSON lines Format
-nmap
Invoke nmap scan on targets (nmap must be installed)
-nmap-cli string
Nmap command line (invoked as COMMAND + TARGETS)
-no-color
Don't Use colors in output
-o string
File to write output to (optional)
-p string
Ports to scan (80, 80,443, 100-200, (-p - for full port scan)
-ping
Use ping probes for verification of host
-ports-file string
File containing ports to enumerate for on hosts
-rate int
Rate of port scan probe requests (default 1000)
-retries int
Number of retries for the port scan probe (default 3)
-s string
Scan Type (s - SYN, c - CONNECT) (default "s")
-scan-all-ips
Scan all the ips
-silent
Show found ports only in output
-source-ip string
Source Ip
-stats
Display stats of the running scan
-timeout int
Millisecond to wait before timing out (default 1000)
-top-ports string
Top Ports to scan (default top 100)
-v Show Verbose output
-verify
Validate the ports again with TCP verification
-version
Show version of naabu
-warm-up-time int
Time in seconds between scan phases (default 2)
```console
Usage:
./naabu [flags]

INPUT:
-host string Host to scan ports for
-list, -l string File containing list of hosts to scan ports
-exclude-hosts, -eh string Specifies a comma-separated list of targets to be excluded from the scan (ip, cidr)
-exclude-file, -ef string Specifies a newline-delimited file with targets to be excluded from the scan (ip, cidr)

PORT:
-port, -p string Ports to scan (80, 80,443, 100-200
-top-ports, -tp string Top Ports to scan (default top 100)
-exclude-ports, -ep string Ports to exclude from scan
-ports-file, -pf string File containing ports to scan for
-exclude-cdn, -ec Skip full port scans for CDNs (only checks for 80,443)

RATE-LIMIT:
-c int General internal worker threads (default 25)
-rate int Rate of port scan probe request (default 1000)

OUTPUT:
-o, -output string File to write output to (optional)
-json Write output in JSON lines Format

CONFIGURATION:
-scan-all-ips Scan all the ips
-scan-type, -s string Port scan type (SYN/CONNECT) (default s)
-source-ip string Source Ip
-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)
-nmap-cli string nmap command to run on found results (example: -nmap-cli 'nmap -sV')

OPTIMIZATION:
-retries int Number of retries for the port scan probe (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 Use ping probes for verification of host
-verify Validate the ports again with TCP verification

DEBUG:
-debug Enable debugging information
-v Show Verbose output
-no-color, -nc Don't Use colors in output
-silent Show found ports only in output
-version Show version of naabu
-stats Display stats of the running scan
```

</details>

# 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

Before installing naabu, make sure to install `libpcap` library with `apt install -y libpcap-dev` on Linux
Before installing naabu, make sure to install `libpcap` library:

```sh
GO111MODULE=on go get -v github.com/projectdiscovery/naabu/v2/cmd/naabu
sudo apt install -y libpcap-dev
```

Installing Naabu:

```sh
go install -v github.com/projectdiscovery/naabu/v2/cmd/naabu@latest
```

# Running Naabu
Expand All @@ -140,7 +124,7 @@ 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.

```sh
```console
naabu -host hackerone.com

__
Expand Down Expand Up @@ -168,9 +152,11 @@ naabu -p 80,443,21-23 -host hackerone.com

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

- `-top-ports 100` => Scans for nmap top 100 port
- `-top-ports 1000` => Scans for nmap top 1000 port
- `-p -` => Scans for all ports from `1-65535`.
| CMD | 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.

Expand All @@ -184,15 +170,15 @@ The `o` flag can be used to specify an output file.
naabu -host hackerone.com -o output.txt
```

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

```sh
naabu -iL hosts.txt
naabu -list hosts.txt
```

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

```sh
```console
naabu -host hackerone.com -json

{"host":"hackerone.com","ip":"104.16.99.52","port":8443}
Expand All @@ -203,7 +189,7 @@ naabu -host hackerone.com -json

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.

```sh
```console
echo hackerone.com | naabu -silent | httpx -silent

http://hackerone.com:8443
Expand All @@ -212,76 +198,21 @@ 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

```sh
naabu -host hackerone.com -verify
```

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.

# Configuration file

We have added support for config file, it allows each and every flag to define in config file, so you don't have to write them everytime, it's optional and not used on default run, default location of config file is `$HOME/.config/naabu/naabu.conf`, custom config file can be provided using `config` flag.


<details>
<summary> 👉 Example Config File 👈</summary>

```yaml
# Number of retries
# retries: 1
# Packets rate
# rate: 100
# Timeout is the seconds to wait for ports to respond
# timeout: 5
# Hosts are the host to find ports for
# host:
# - 10.10.10.10
# Ports is the ports to use for enumeration
# ports:
# - 80
# - 100
# ExcludePorts is the list of ports to exclude from enumeration
# exclude-ports:
# - 20
# - 30
# Verify is used to check if the ports found were valid using CONNECT method
# verify: false
# Ips or cidr to be excluded from the scan
# exclude-ips:
# - 1.1.1.1
# - 2.2.2.2
# Top ports list
# top-ports: 100
# Attempts to run as root
# privileged: true
# Drop root privileges
# unprivileged: true
# Excludes ip of knows CDN ranges
# exclude-cdn: true
# SourceIP to use in TCP packets
# source-ip: 10.10.10.10
# Interface to use for TCP packets
# interface: eth0
# WarmUpTime between scan phases
# warm-up-time: 2
# nmap command to invoke after scanninginvoke after scanning
# nmap: nmap -sV
```
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.

</details>

# Nmap integration

We have integrated nmap support with `nmap` flag, in config file you can define any `nmap` command you wish to run on the result of naabu, make sure you have `nmap` installed to use this feature.
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 make use of `nmap` flag, make sure to remove the comments from the config file at `$HOME/.config/naabu/naabu.conf`
To use,`nmap-cli` flag can be used followed by nmap command, for example:-

We also added `nmap-cli` flag that let you run **nmap** commands directly on the results of naabu without making use of config file.

```sh
echo hackerone.com | naabu -nmap-cli 'nmap -sV -oX naabu-output'
```console
echo hackerone.com | naabu -nmap-cli 'nmap -sV -oX nmap-output'
__
___ ___ ___ _/ / __ __
/ _ \/ _ \/ _ \/ _ \/ // /
Expand Down
35 changes: 20 additions & 15 deletions v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,45 @@ module github.com/projectdiscovery/naabu/v2
go 1.17

require (
github.com/golang/snappy v0.0.4 // indirect
github.com/google/gopacket v1.1.19
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
github.com/projectdiscovery/blackrock v0.0.0-20210415162320-b38689ae3a2e
github.com/projectdiscovery/cdncheck v0.0.2
github.com/projectdiscovery/clistats v0.0.8
github.com/projectdiscovery/dnsx v1.0.2-0.20210417234210-3a4fe34e685d
github.com/projectdiscovery/dnsx v1.0.7-0.20210927160546-05f957862698
github.com/projectdiscovery/fdmax v0.0.3
github.com/projectdiscovery/fileutil v0.0.0-20210507113701-c967952aea59
github.com/projectdiscovery/fileutil v0.0.0-20210926202739-6050d0acf73c
github.com/projectdiscovery/goflags v0.0.7
github.com/projectdiscovery/gologger v1.1.4
github.com/projectdiscovery/ipranger v0.0.3-0.20210619173509-f9b366d18ac6
github.com/projectdiscovery/iputil v0.0.0-20210414194613-4b4d2517acf0
github.com/projectdiscovery/mapcidr v0.0.6
github.com/projectdiscovery/networkpolicy v0.0.0-20210617100800-060573865df4
github.com/projectdiscovery/stringsutil v0.0.0-20210617141317-00728870f68d // indirect
github.com/projectdiscovery/ipranger v0.0.3-0.20210831161617-ac80efae0961
github.com/projectdiscovery/iputil v0.0.0-20210804143329-3a30fcde43f3
github.com/projectdiscovery/mapcidr v0.0.8
github.com/projectdiscovery/networkpolicy v0.0.1
github.com/remeh/sizedwaitgroup v1.0.0
go.uber.org/ratelimit v0.2.0
golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1
golang.org/x/sys v0.0.0-20210412220455-f1c623a9e750 // indirect
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8
golang.org/x/sys v0.0.0-20210915083310-ed5796bab164 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
)

require (
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/json-iterator/go v1.1.10 // indirect
github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/karrick/godirwalk v1.16.1 // indirect
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
github.com/miekg/dns v1.1.41 // indirect
github.com/miekg/dns v1.1.43 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/projectdiscovery/executil v0.0.0-20210414225944-2ad029b6a1fd // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/projectdiscovery/hmap v0.0.1 // indirect
github.com/projectdiscovery/retryabledns v1.0.10 // indirect
github.com/projectdiscovery/retryabledns v1.0.13-0.20210927160332-db15799e2e4d // indirect
github.com/projectdiscovery/retryablehttp-go v1.0.2 // indirect
github.com/projectdiscovery/stringsutil v0.0.0-20210830151154-f567170afdd9 // indirect
github.com/syndtr/goleveldb v1.0.0 // indirect
github.com/yl2chen/cidranger v1.0.2 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
Loading

0 comments on commit b6bca90

Please sign in to comment.