mirror of
https://github.com/shadow1ng/fscan.git
synced 2025-07-14 13:22:35 +08:00
增加-silent 静默扫描模式
This commit is contained in:
parent
ef6a196de7
commit
b6133c4a55
@ -3,6 +3,7 @@ package Plugins
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/shadow1ng/fscan/common"
|
||||||
"golang.org/x/net/icmp"
|
"golang.org/x/net/icmp"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
@ -77,7 +78,9 @@ func IcmpCheck(hostslist []string) {
|
|||||||
for ip := range chanHosts {
|
for ip := range chanHosts {
|
||||||
if _, ok := TmpHosts[ip]; !ok {
|
if _, ok := TmpHosts[ip]; !ok {
|
||||||
TmpHosts[ip] = struct{}{}
|
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)
|
AliveHosts = append(AliveHosts, ip)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,7 +144,9 @@ func PingCMDcheck(hostslist []string, bsenv string) {
|
|||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
if ExecCommandPing(host, bsenv) {
|
if ExecCommandPing(host, bsenv) {
|
||||||
mutex.Lock()
|
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)
|
AliveHosts = append(AliveHosts, host)
|
||||||
mutex.Unlock()
|
mutex.Unlock()
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ func Flag(Info *HostInfo) {
|
|||||||
flag.BoolVar(&Ping, "ping", false, "using ping replace icmp")
|
flag.BoolVar(&Ping, "ping", false, "using ping replace icmp")
|
||||||
flag.StringVar(&TmpOutputfile, "o", "result.txt", "Outputfile")
|
flag.StringVar(&TmpOutputfile, "o", "result.txt", "Outputfile")
|
||||||
flag.BoolVar(&TmpSave, "no", false, "not to save output log")
|
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.BoolVar(&Silent, "silent", false, "silent scan")
|
||||||
flag.StringVar(&URL, "u", "", "url")
|
flag.StringVar(&URL, "u", "", "url")
|
||||||
flag.StringVar(&UrlFile, "uf", "", "urlfile")
|
flag.StringVar(&UrlFile, "uf", "", "urlfile")
|
||||||
|
@ -30,7 +30,7 @@ func LogSuccess(result string) {
|
|||||||
|
|
||||||
func SaveLog() {
|
func SaveLog() {
|
||||||
for result := range Results {
|
for result := range Results {
|
||||||
if Silent == false {
|
if Silent == false || strings.Contains(result, "[+]") || strings.Contains(result, "[*]") {
|
||||||
fmt.Println(result)
|
fmt.Println(result)
|
||||||
}
|
}
|
||||||
if IsSave {
|
if IsSave {
|
||||||
@ -55,13 +55,11 @@ func WriteFile(result string, filename string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func LogError(errinfo interface{}) {
|
func LogError(errinfo interface{}) {
|
||||||
if Silent == false {
|
if WaitTime == 0 {
|
||||||
if WaitTime == 0 {
|
fmt.Println(fmt.Sprintf("已完成 %v/%v %v", End, Num, errinfo))
|
||||||
fmt.Println(fmt.Sprintf("已完成 %v/%v %v", End, Num, errinfo))
|
} else if (time.Now().Unix()-LogSucTime) > WaitTime && (time.Now().Unix()-LogErrTime) > WaitTime {
|
||||||
} else if (time.Now().Unix()-LogSucTime) > WaitTime && (time.Now().Unix()-LogErrTime) > WaitTime {
|
fmt.Println(fmt.Sprintf("已完成 %v/%v %v", End, Num, errinfo))
|
||||||
fmt.Println(fmt.Sprintf("已完成 %v/%v %v", End, Num, errinfo))
|
LogErrTime = time.Now().Unix()
|
||||||
LogErrTime = time.Now().Unix()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user