I am trying to automate my recon tool using Go. So far I can run two basic tools in kali (Nikto/whois). Now I want them to execute parallelly rather than waiting for one function to finish. After reading a bit, I came to know this can be achieved by using goroutines. But my code doesn't seem to work:
package main
import (
"log"
"os/exec"
"os"
"fmt"
)
var url string
func nikto(){
cmd := exec.Command("nikto","-h",url)
cmd.Stdout = os.Stdout
err := cmd.Run()
if err != nil {
log.Fatal(err)
}
}
func whois() {
cmd := exec.Command("whois","google.co")
cmd.Stdout = os.Stdout
err := cmd.Run()
if err !=nil {
log.Fatal(err)
}
}
func main(){
fmt.Printf("Please input URL")
fmt.Scanln(&url)
nikto()
go whois()
}
I do understand that here, go whois()
would execute till main()
would, but I still can't see them both execute parallel.