diff --git a/Plugins/icmp.go b/Plugins/icmp.go index a05722c3..2e4af446 100644 --- a/Plugins/icmp.go +++ b/Plugins/icmp.go @@ -3,6 +3,7 @@ package Plugins import ( "bytes" "fmt" + "github.com/shadow1ng/fscan/common" "golang.org/x/net/icmp" "log" "net" @@ -77,7 +78,9 @@ func IcmpCheck(hostslist []string) { for ip := range chanHosts { if _, ok := TmpHosts[ip]; !ok { TmpHosts[ip] = struct{}{} - fmt.Printf("(icmp) Target '%s' is alive\n", ip) + if common.Silent == false { + fmt.Printf("(icmp) Target '%s' is alive\n", ip) + } AliveHosts = append(AliveHosts, ip) } } @@ -141,7 +144,9 @@ func PingCMDcheck(hostslist []string, bsenv string) { defer wg.Done() if ExecCommandPing(host, bsenv) { mutex.Lock() - fmt.Printf("(Ping) Target '%s' is alive\n", host) + if common.Silent == false { + fmt.Printf("(Ping) Target '%s' is alive\n", host) + } AliveHosts = append(AliveHosts, host) mutex.Unlock() } diff --git a/common/flag.go b/common/flag.go index 5f3232b2..b7153598 100644 --- a/common/flag.go +++ b/common/flag.go @@ -38,7 +38,7 @@ func Flag(Info *HostInfo) { flag.BoolVar(&Ping, "ping", false, "using ping replace icmp") 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.Int64Var(&WaitTime, "debug", 60, "every time to LogErr") flag.BoolVar(&Silent, "silent", false, "silent scan") flag.StringVar(&URL, "u", "", "url") flag.StringVar(&UrlFile, "uf", "", "urlfile") diff --git a/common/log.go b/common/log.go index 5a228394..bcb17712 100644 --- a/common/log.go +++ b/common/log.go @@ -30,7 +30,7 @@ func LogSuccess(result string) { func SaveLog() { for result := range Results { - if Silent == false { + if Silent == false || strings.Contains(result, "[+]") || strings.Contains(result, "[*]") { fmt.Println(result) } if IsSave { @@ -55,13 +55,11 @@ 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() - } + 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() } }