-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
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
Run nmap without runtime interaction #113
Comments
Hi @wallrj, Indeed, you have found a command line argument we do not have implemented yet. I will shortly open a PR out of this Issue to add the option to provide this with an option. :) |
Yes it breaks everytime. Probably because my program prints to stdout and from a separate go routine. Perhaps instead you can provide a closed stdin before executing nmap. |
I want to be assigned on the issue |
@Ahmedelqashlan
Sure. You can open a PR when you have a solution for it. |
@elivlo |
I reproduced the issue with the following code, sampled and modified from the example basic_scan_async and running the latest version of Fedora and with Nmap version 7.93. I am still unconfident implementing this argument in the But, since we do not provide a way to interact with Nmap with stdin, we could also disable it by default. The example to reproduce the issue: // Equivalent to `/usr/local/bin/nmap -p 80,443,843 google.com facebook.com youtube.com`,
// with a 5-minute timeout.
s, err := nmap.NewScanner(
context.Background(),
nmap.WithTargets("google.com", "facebook.com", "youtube.com"),
nmap.WithPorts("1-65535"),
//nmap.WithCustomArguments("--noninteractive"),
)
if err != nil {
log.Fatalf("unable to create nmap scanner: %v", err)
}
// Executes asynchronously, allowing results to be streamed in real time.
done := make(chan error)
result, warnings, err := s.Async(done).Run()
if err != nil {
log.Fatal(err)
}
fmt.Println(s.Args())
for {
var in string
_, err := fmt.Scanln(&in)
if err != nil {
fmt.Println(err)
break
}
fmt.Println(in)
if in == "exit" {
break
}
}
// Blocks main until the scan has completed.
if err := <-done; err != nil {
if len(*warnings) > 0 {
log.Printf("run finished with warnings: %s\n", *warnings) // Warnings are non-critical errors from nmap.
}
log.Fatal(err)
} |
Thanks for this great module.
When I use it, it corrupts the terminal.
I think you need to provide an option to run nmap without runtime interaction.
(There's a not well documented
--noninteractive
CLI flag in my version of nmap)My temporary work around:
See also:
--interactive
option with--noninteractive
postmodern/ruby-nmap#69The text was updated successfully, but these errors were encountered: