Skip to content

Commit

Permalink
增加silent 静默扫描模式
Browse files Browse the repository at this point in the history
  • Loading branch information
shadow1ng committed May 14, 2021
1 parent cd53258 commit ef6a196
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions common/flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
17 changes: 11 additions & 6 deletions common/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
}
Expand All @@ -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()
}
}
}

Expand Down

0 comments on commit ef6a196

Please sign in to comment.