projectdiscovery / naabu

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
https://projectdiscovery.io
MIT License
4.7k stars 548 forks source link

Runner doesn't have any output #196

Closed namm2 closed 2 years ago

namm2 commented 3 years ago

Hi, I'd like to embed naabu into my toy tool, not sure if I did it incorrectly but I can't get output of the runner results

import (
    "log"
    "github.com/projectdiscovery/naabu/v2/pkg/runner"
)

func main() {
    options := runner.Options{
      JSON: true,
      Verbose: true,
      Debug: true,
      Threads: 25,
      Retries: 1,
      Rate: 2000,
      Ping: true,
      ExcludeCDN: true,
      EnableProgressBar: true,
      ScanType: "s",
      Host: "scanme.nmap.org",
      Output: "/tmp/naabu_output.txt",
    }

    r, err := runner.NewRunner(&options)
    if err != nil {
      log.Println(err)
    }
    err = r.RunEnumeration()
    if err != nil {
      log.Println(err)
    }
}

go run main.go shows scanning progress, but there's no results afterwards.

I intent to capture the results and throw it around, how can I achieve it? Thanksk.

namm2 commented 3 years ago

It looks like unprivileged: true config doesn't work, and also CONNECT scan type. After go build main.go and ran sudo ./main, the results are printed to output.

namm2 commented 3 years ago

My solution is to build docker image then run it with capabilities NET_CAP_RAW, NET_CAP_BIND_SERVICE

docker run --cap-add=NET_ADMIN --cap-add=NET_BIND_SERVICE naabu:latest

https://unix.stackexchange.com/questions/389879/how-to-set-capabilities-with-setcap-command

ehsandeep commented 3 years ago

@namm2 unprivileged: true looks like you using an older version? as this flag is not part of the latest release, also naabu supports two types of scan, CONNECT (doesn't require root and slow), SYN (requires root + fast).

Running SYN scan with root privilege is advisable to use for best performance.

Done461 commented 1 year ago

still not working with null results even with sudo command image

ehsandeep commented 1 year ago

@Done461 latet version of naabu is 2.1.5

Done461 commented 1 year ago

@Done461 latet version of naabu is 2.1.5

any idea how to update it ?

ehsandeep commented 1 year ago

@Done461 latet version of naabu is 2.1.5

any idea how to update it ?

https://github.com/projectdiscovery/pdtm