嘿,我正在尝试自动化工具进行侦查,我使用url将网址存储在https://
中,但是有一个工具whois and sublist3r
需要的地址没有https://
,所以我将其切成薄片字符串,但是当我运行该工具时,它崩溃并清空了我的终端,我可以键入但看不到输出。
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()
}
答案 0 :(得分:0)
如果“它崩溃并清空我的终端” 那么程序的输出结果中可能包含您的终端反应不佳的字符
在导入中添加“ unicode / utf8”,然后尝试替换
fmt.Println(string(bs))
使用
if utf8.ValidString(bs) {
fmt.Printf("%v\n",bs)
} else {
fmt.Printf("warning, loosing output")
}
有关如何清除输出使其可读的信息,请参见此答案 Remove invalid UTF-8 characters from a string (Go lang)