Update ICMP.go

This commit is contained in:
影舞者 2024-12-19 22:17:09 +08:00 committed by GitHub
parent 6ee7bab188
commit 5c05965967
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -259,8 +259,15 @@ func RunPing(hostslist []string, chanHosts chan string) {
// ExecCommandPing 执行系统Ping命令检测主机存活 // ExecCommandPing 执行系统Ping命令检测主机存活
func ExecCommandPing(ip string) bool { func ExecCommandPing(ip string) bool {
// 过滤黑名单字符
forbiddenChars := []string{";", "&", "|", "`", "$", "\\", "'", "%", "\"", "\n"}
for _, char := range forbiddenChars {
if strings.Contains(ip, char) {
return false
}
}
var command *exec.Cmd var command *exec.Cmd
// 根据操作系统选择不同的ping命令 // 根据操作系统选择不同的ping命令
switch runtime.GOOS { switch runtime.GOOS {
case "windows": case "windows":