I am trying to run nikto -h {url}
on kali. My nikto -h
command works fine, but when I add an URL, nothing is output.
I am not sure if it is the process or something else.
How can I see the output directly rather than buffering and displaying it?
package main
import (
"bytes"
"fmt"
"log"
"os/exec"
// "strings"
)
func main() {
cmd := exec.Command("nikto","-h","google.com")
// cmd.Stdin = strings.NewReader("some input")
var out bytes.Buffer
cmd.Stdout = &out
err := cmd.Run()
if err != nil {
log.Fatal(err)
}
}
As @Adrian suggested in the comments, using os.Stdout works
package main
import (
"log"
"os"
"os/exec"
)
func main() {
cmd := exec.Command("ls", "-l")
cmd.Stdout = os.Stdout
err := cmd.Run()
if err != nil {
log.Fatal(err)
}
}