Comments (4)
It shouldn't happen, will fix it! Thanks for letting me know.
from naabu.
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.
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.
It's already fixed in the dev
branch and will be included in the upcoming release. Closing this.
from naabu.
Related Issues (20)
- installing issue HOT 1
- panic: could not determine route type HOT 1
- UDP Open Ports Not Displayed in naabu Scan HOT 1
- FreeBSD scan_common.go:62:23: undefined: routing.New
- Can't silent command / output naabu HOT 1
- When using naabu as a library, an error occurs: no free handlers
- Request, timeout & no valid ipv4 or ipv6 targets were found HOT 5
- OnResult not be invoked when threshold reached
- Port spray support HOT 2
- v2.3.0 gives internal nil pointer on "phase.RLock()" but 2.2.1 does work. HOT 10
- No valid ipv4 or ipv6 targets were found when running as root in Ubuntu on certain hosts HOT 5
- error while loading shared libraries HOT 2
- version does't provide valid work with -c and rate HOT 2
- Gets ports with non-root access but dosent work with root access. HOT 2
- -rate is breaking the script without result HOT 2
- Potentially switch to github.com/gopacket/gopacket instead of github.com/google/gopacket ? HOT 1
- can't run naabu on mac with sudo HOT 3
- -source-ip is ignored HOT 2
- -exclude-ports Flag Fails to Function Correctly When Used Alongside -passive Flag HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from naabu.