mirror of
https://github.com/shadow1ng/fscan.git
synced 2025-07-14 05:12:36 +08:00
update icmp
This commit is contained in:
parent
ad1c53e3f4
commit
80fe8548c1
@ -42,19 +42,27 @@ func ICMPRun(hostslist []string, Ping bool) []string {
|
||||
if Ping == true {
|
||||
//使用ping探测
|
||||
RunPing(hostslist, chanHosts)
|
||||
} else if conn, err := icmp.ListenPacket("ip4:icmp", "0.0.0.0"); err == nil {
|
||||
} else {
|
||||
//优先尝试监听本地icmp,批量探测
|
||||
conn, err := icmp.ListenPacket("ip4:icmp", "0.0.0.0")
|
||||
if err == nil {
|
||||
RunIcmp1(hostslist, conn, chanHosts)
|
||||
} else if conn, err := net.DialTimeout("ip4:icmp", "127.0.0.1", 3*time.Second); err == nil {
|
||||
conn.Close()
|
||||
} else {
|
||||
common.LogError(err)
|
||||
//尝试无监听icmp探测
|
||||
conn, err := net.DialTimeout("ip4:icmp", "127.0.0.1", 3*time.Second)
|
||||
if err == nil {
|
||||
go conn.Close()
|
||||
RunIcmp2(hostslist, chanHosts)
|
||||
} else {
|
||||
common.LogError(err)
|
||||
//使用ping探测
|
||||
fmt.Println("The current user permissions unable to send icmp packets")
|
||||
fmt.Println("start ping")
|
||||
RunPing(hostslist, chanHosts)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
livewg.Wait()
|
||||
close(chanHosts)
|
||||
|
Loading…
Reference in New Issue
Block a user