增加silent 静默扫描模式

This commit is contained in:
shadow1ng 2021-05-14 10:43:26 +08:00
parent cd53258f0d
commit ef6a196de7
2 changed files with 12 additions and 6 deletions

View File

@ -39,6 +39,7 @@ func Flag(Info *HostInfo) {
flag.StringVar(&TmpOutputfile, "o", "result.txt", "Outputfile")
flag.BoolVar(&TmpSave, "no", false, "not to save output log")
flag.Int64Var(&WaitTime, "debug", 120, "every time to LogErr")
flag.BoolVar(&Silent, "silent", false, "silent scan")
flag.StringVar(&URL, "u", "", "url")
flag.StringVar(&UrlFile, "uf", "", "urlfile")
flag.StringVar(&Pocinfo.PocName, "pocname", "", "use the pocs these contain pocname, -pocname weblogic")

View File

@ -15,6 +15,7 @@ var Start = true
var LogSucTime int64
var LogErrTime int64
var WaitTime int64
var Silent bool
var LogWG sync.WaitGroup
func LogSuccess(result string) {
@ -29,7 +30,9 @@ func LogSuccess(result string) {
func SaveLog() {
for result := range Results {
if Silent == false {
fmt.Println(result)
}
if IsSave {
WriteFile(result, Outputfile)
}
@ -52,12 +55,14 @@ func WriteFile(result string, filename string) {
}
func LogError(errinfo interface{}) {
if Silent == false {
if WaitTime == 0 {
fmt.Println(fmt.Sprintf("已完成 %v/%v %v", End, Num, errinfo))
} else if (time.Now().Unix()-LogSucTime) > WaitTime && (time.Now().Unix()-LogErrTime) > WaitTime {
fmt.Println(fmt.Sprintf("已完成 %v/%v %v", End, Num, errinfo))
LogErrTime = time.Now().Unix()
}
}
}
func CheckErrs(err error) bool {