Hey I am trying to automate a tool to do my recon I am using url to store url with https:// but there’s a tool whois and sublist3r that needs the address without https:// so I sliced the string but when I run the tool it crashes out and blanks out my terminal I can type but can’t see the output.
import (
"fmt"
"log"
"os/exec"
"sync"
)
var url string
var wg sync.WaitGroup
var ip string
var nsurl string
func nikto(outChan chan<- []byte) {
cmd := exec.Command("nikto", "-h", url)
bs, err := cmd.Output()
if err != nil {
log.Fatal(err)
}
outChan <- bs
wg.Done()
}
func whois(outChan chan<- []byte) {
cmd := exec.Command("whois",nsurl)
bs, err := cmd.Output()
if err != nil {
log.Fatal(err)
}
outChan <- bs
wg.Done()
}
func nmap (outChan chan<-[]byte) {
cmd := exec.Command("nmap","-sC","-sV","-oA","nmap",ip)
// cmd := exec.Command("nmap","-h")
bs,err := cmd.Output()
if err != nil {
log.Fatal(err)
}
outChan <- bs
wg.Done()
}
func sniper(outChan chan<-[]byte){
cmd:=exec.Command("sniper","-t",url)
bs,err := cmd.Output()
if err!=nil{
log.Fatal(err)
}
outChan <- bs
wg.Done()
}
func sublist3r(outChan chan<-[]byte) {
cmd := exec.Command("sublist3r","-d",nsurl)
bs,err := cmd.Output()
if err!=nil {
log.Fatal(err)
}
outChan <- bs
wg.Done()
}
func inspy (outChan chan<-[]byte){
cmd := exec.Command("inspy","--empspy","/opt/wordlists/wordlists/title-list-large.txt",url)
bs,err := cmd.Output()
if err!=nil {
log.Fatal(err)
}
outChan <- bs
wg.Done()
}
func wig (outChan chan<-[]byte){
//nsurl = url[8:]
cmd := exec.Command("wig",url)
bs,err := cmd.Output()
if err!=nil{
log.Fatal(err)
}
outChan <- bs
wg.Done()
}
func main() {
outChan := make(chan []byte)
fmt.Printf("Please input URL with https:// n")
fmt.Scanln(&url)
fmt.Printf("Please input IP n")
fmt.Scanln(&ip)
nsurl = url[8:]
wg.Add(1)
go nikto(outChan)
wg.Add(1)
go whois(outChan)
wg.Add(1)
go nmap(outChan)
wg.Add(1)
go sniper(outChan)
wg.Add(1)
go sublist3r(outChan)
wg.Add(1)
go inspy(outChan)
wg.Add(1)
go wig(outChan)
for i := 0; i <7 ; i++ {
bs := <-outChan
fmt.Println(string(bs))
}
close(outChan)
wg.Wait()
}
Advertisement
Answer
if “it crashes out and blanks out my terminal” then probably the output from the program has characters that your terminal reacts badly to
add “unicode/utf8” to imports and try replacing
fmt.Println(string(bs))
with
if utf8.ValidString(bs) {
fmt.Printf("%vn",bs)
} else {
fmt.Printf("warning, loosing output")
}
See this answer on how to clean output to make it readable Remove invalid UTF-8 characters from a string (Go lang)