1
0
mirror of https://github.com/sairson/Yasso.git synced 2026-06-18 09:47:35 +08:00

Yasso更新大改动,更新扫描方式,去除不常用功能,增加指纹和协议识别,修补bug等

This commit is contained in:
sairson
2022-05-29 09:11:07 +08:00
parent a6cd80f8e8
commit cb72f18edd
129 changed files with 16619 additions and 6278 deletions

28
pkg/netspy/icmp/icmp.go Normal file
View File

@@ -0,0 +1,28 @@
package icmp
import (
"github.com/go-ping/ping"
"runtime"
"time"
)
func Check(ip string) bool {
pinger, err := ping.NewPinger(ip)
if err != nil {
return false
}
if runtime.GOOS == "windows" {
pinger.SetPrivileged(true)
}
pinger.Count = 1
pinger.Timeout = 100 * time.Millisecond
err = pinger.Run()
if err != nil {
return false
}
stats := pinger.Statistics()
if stats.PacketsRecv > 0 {
return true
}
return false
}