mirror of
https://github.com/shadow1ng/fscan.git
synced 2025-07-13 12:52:44 +08:00
修改icmp发包模式,更适合大规模探测。
修改报错提示,--debug时,如果10秒内没有LogSuccess的消息,每隔10秒就会打印一下当前进度
This commit is contained in:
parent
1155ba7fab
commit
8e148c0e6e
@ -53,12 +53,13 @@ func GetSys() SystemInfo {
|
||||
}
|
||||
|
||||
func IcmpCheck(hostslist []string) {
|
||||
TmpHosts := make(map[string]struct{})
|
||||
var chanHosts = make(chan string)
|
||||
conn, err := icmp.ListenPacket("ip4:icmp", "0.0.0.0")
|
||||
endflag := false
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
var chanHosts = make(chan string)
|
||||
go func() {
|
||||
for {
|
||||
if endflag == true {
|
||||
@ -74,7 +75,8 @@ func IcmpCheck(hostslist []string) {
|
||||
|
||||
go func() {
|
||||
for ip := range chanHosts {
|
||||
if !IsContain(AliveHosts, ip) {
|
||||
if _, ok := TmpHosts[ip]; !ok {
|
||||
TmpHosts[ip] = struct{}{}
|
||||
fmt.Printf("(icmp) Target '%s' is alive\n", ip)
|
||||
AliveHosts = append(AliveHosts, ip)
|
||||
}
|
||||
@ -84,7 +86,8 @@ func IcmpCheck(hostslist []string) {
|
||||
for _, host := range hostslist {
|
||||
write(host, conn)
|
||||
}
|
||||
if len(hostslist) > 10 {
|
||||
|
||||
if len(hostslist) > 100 {
|
||||
time.Sleep(6 * time.Second)
|
||||
} else {
|
||||
time.Sleep(3 * time.Second)
|
||||
|
Loading…
Reference in New Issue
Block a user