mirror of
https://github.com/shadow1ng/fscan.git
synced 2025-05-07 19:26:29 +00:00
增加-silent 静默扫描模式
This commit is contained in:
parent
ef6a196de7
commit
b6133c4a55
@ -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()
|
||||
}
|
||||
|
@ -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")
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user