Skip to content

Scanning of two ports does not display the scan results. #1574

@mythldy

Description

@mythldy

May I ask, when I only scan 2 ports, the console doesn't display the scan results, but when scanning ports from 0 to 65535, it can display normally. Why is that?
package main

import (
"context"
"fmt"
"github.com/projectdiscovery/naabu/v2/pkg/result"
"github.com/projectdiscovery/naabu/v2/pkg/runner"
"log"
"os"
"strconv"
"time"
)

func main() {
var (
hostfile string = os.Args[1]
//ports string = os.Args[2]
//timeout string = os.Args[3]
//excludeip string = os.Args[3]
thread string = os.Args[4]
rate string = os.Args[5]
//timeout string = strconv.Atoi(timeout)
)
t, _ := strconv.Atoi(thread)
r, _ := strconv.Atoi(rate)
options := runner.Options{
HostsFile: hostfile,
ScanType: "s",
OnResult: func(hr *result.HostResult) {
log.Printf("host:%s:%s", hr.Host, hr.Ports)
},
//Debug: false,
//Verbose: false,
//StatsInterval: 0,
//SourcePort: "58915",
//Stream: true,
//Threads: t,
//ExcludeIps: excludeip,
//Rate: r,
//DisableUpdateCheck: true,
//JSON: true,
//Retries: 1,
//Silent: true,
Ports: "22,3306",
//Timeout: 200 * time.Millisecond,
}
naabuRunner, err := runner.NewRunner(&options)
if err != nil {
log.Fatal(err)
}
defer naabuRunner.Close()
ctx := context.Background()
s := time.Now()
err2 := naabuRunner.RunEnumeration(ctx)
if err2 != nil {
log.Fatalf("扫描执行失败: %v", err)
}
fmt.Println(time.Since(s))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: EnhancementMost issues will probably ask for additions or changes.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions