添加功能,跳过某些ip扫描,-hn 192.168.1.1/24

This commit is contained in:
影舞者
2021-09-14 12:16:01 +08:00
parent 37f53e3f16
commit dc267a5335
5 changed files with 51 additions and 28 deletions
+5 -3
View File
@@ -5,8 +5,10 @@ import (
"strings"
)
func ParsePort(ports string) []int {
var scanPorts []int
func ParsePort(ports string) (scanPorts []int) {
if ports == "" {
return
}
slices := strings.Split(ports, ",")
for _, port := range slices {
port = strings.Trim(port, " ")
@@ -39,7 +41,7 @@ func ParsePort(ports string) []int {
}
func removeDuplicate(old []int) []int {
result := make([]int, 0, len(old))
result := []int{}
temp := map[int]struct{}{}
for _, item := range old {
if _, ok := temp[item]; !ok {