We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When i run this code
package main import ( "context" "fmt" "net" "time" "github.com/Ullaakut/nmap/v3" ) func tcpGather(ip string, ports []string) map[string]bool { results := make(map[string]bool) for _, port := range ports { address := net.JoinHostPort(ip, port) conn, err := net.DialTimeout("tcp", address, time.Second/2) if err != nil { results[port] = false } else { if conn != nil { results[port] = true _ = conn.Close() } else { results[port] = false } } } return results } func main() { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() // Create a new nmap scanner scanner, err := nmap.NewScanner( ctx, nmap.WithTargets("192.168.0.0/24"), // Specify the network range to scan nmap.WithFastMode(), // Enable fast mode ) if err != nil { fmt.Println("Error creating scanner:", err) return } // Run the scan result, _, err := scanner.Run() if err != nil { fmt.Println("Error running scan:", err) return } // Print the results for _, host := range result.Hosts { if len(host.Addresses) == 0 { continue } ip := host.Addresses[0].Addr name := "Unknown" if len(host.Hostnames) == 1 { name = host.Hostnames[0].Name } else if len(host.Hostnames) > 1 { name = "[" for _, current_name := range host.Hostnames { name += current_name.Name + ", " } name += "]" } mac := "" if len(host.Addresses) > 1 { mac = host.Addresses[1].Addr } fmt.Printf( "NAME: %s\nIP: %s\nMAC: %s\n", name, ip, mac, ) ports := tcpGather(ip, []string{"20", "21", "22", "80", "135", "139", "143", "443", "445", "3020", "3306", "3389", "8022", "8080"}, ) if len(ports) != 0 { fmt.Println("PORTS:") for port, status := range ports { fmt.Printf("\t%-5s: %5t\n", string(port), status) } } fmt.Print("\n\n") } }
result: Error running scan: exit status 1 tested on windows 10 and windows 11
Error running scan: exit status 1
The text was updated successfully, but these errors were encountered:
Hi @wowlikon ! Which version of nmap do you use? Is it available in your PATH?
Sorry, something went wrong.
No branches or pull requests
When i run this code
result:
Error running scan: exit status 1
tested on windows 10 and windows 11
The text was updated successfully, but these errors were encountered: