From ef6a196de79722a55e946a270989acdb273ae845 Mon Sep 17 00:00:00 2001 From: shadow1ng Date: Fri, 14 May 2021 10:43:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0silent=20=E9=9D=99=E9=BB=98?= =?UTF-8?q?=E6=89=AB=E6=8F=8F=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/flag.go | 1 + common/log.go | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/common/flag.go b/common/flag.go index 730fb301..5f3232b2 100644 --- a/common/flag.go +++ b/common/flag.go @@ -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") diff --git a/common/log.go b/common/log.go index bea81981..5a228394 100644 --- a/common/log.go +++ b/common/log.go @@ -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 { - fmt.Println(result) + if Silent == false { + fmt.Println(result) + } if IsSave { WriteFile(result, Outputfile) } @@ -52,11 +55,13 @@ func WriteFile(result string, filename string) { } func LogError(errinfo interface{}) { - 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() + 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() + } } }