Giter Club home page Giter Club logo

Comments (4)

dogancanbakir avatar dogancanbakir commented on June 21, 2024 1

It shouldn't happen, will fix it! Thanks for letting me know.

from naabu.

dogancanbakir avatar dogancanbakir commented on June 21, 2024

Can you show how you are handling OnResult's output? Additionally, would the following approach work?

package main

import (
	"context"
	"fmt"
	"log"
	"strconv"
	"strings"

	"github.com/projectdiscovery/goflags"
	"github.com/projectdiscovery/naabu/v2/pkg/result"
	"github.com/projectdiscovery/naabu/v2/pkg/runner"
	sliceutil "github.com/projectdiscovery/utils/slice"
)

func main() {
	portsToScan := "80,443,68,123"
	portsToScanSlice := strings.Split(portsToScan, ",")
	foundPorts := make([]string, 0, len(portsToScanSlice))

	options := runner.Options{
		Host:     goflags.StringSlice{"scanme.nmap.org"},
		ScanType: "s",
		OnResult: func(hr *result.HostResult) {
			for _, port := range hr.Ports {
				foundPort := strconv.Itoa(port.Port)
				foundPorts = append(foundPorts, foundPort)

				// Remove the found port from the list of ports to scan to find the remaining ports
				portsToScanSlice = sliceutil.PruneEqual(portsToScanSlice, foundPort)
			}
		},
		Ports:  portsToScan,
		Silent: true,
	}

	naabuRunner, err := runner.NewRunner(&options)
	if err != nil {
		log.Fatal(err)
	}
	defer naabuRunner.Close()

	naabuRunner.RunEnumeration(context.TODO())

	fmt.Println("Found ports:", foundPorts)
	fmt.Println("Not found ports:", portsToScanSlice)
}

from naabu.

dogasantos avatar dogasantos commented on June 21, 2024

Hi @dogancanbakir
Thanks for your response!

yes, I've solved with similar approach
i send all hosts to a set and remove every host that got positive result (at least 1 open port)
the remaining hosts in the set are the ones with no open ports.

Although, one thing caught my attention on your response.
Other than Ports, these are the parameters I'm using on config:

                Host:                      goflags.StringSlice{ipaddr},
		Threads:                   runtime.NumCPU() * 2,
		Rate:                      800,
		IPVersion:                 goflags.StringSlice{ipversion},
		ScanType:                  "s",
		InputReadTimeout:          time.Duration(2 * time.Minute),
		Retries:                   1,
		Timeout:                   120,
		WarmUpTime:                2,
		IcmpEchoRequestProbe:      false,
		IcmpTimestampRequestProbe: false,
		Nmap:               false,
		Verbose:            false,
		Silent:             true,
		ExcludeCDN:         true,
		DisableStdin:       true,
		DisableUpdateCheck: true,
		OutputCDN:          true,
		Debug:              false,
		SkipHostDiscovery:  true,

Notice I set everything to be very "silent" there. However, still seeing output:

[INF] Running SYN scan with CAP_NET_RAW privileges
[INF] Found 1 ports on host (ipv4address)

Is there any bogus option I've set?
Ty

from naabu.

dogancanbakir avatar dogancanbakir commented on June 21, 2024

It's already fixed in the dev branch and will be included in the upcoming release. Closing this.

from naabu.

Related Issues (20)

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.