mirror of
https://github.com/shadow1ng/fscan.git
synced 2025-07-16 14:22:36 +08:00
Merge pull request #32 from 7ten7/dev
修复 -p 参数在某些情况下以范围指定端口时(如 -p 8000-10000)解析错误问题
This commit is contained in:
commit
5b330bb12d
@ -1,7 +1,6 @@
|
|||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sort"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@ -17,9 +16,17 @@ func ParsePort(ports string) []int {
|
|||||||
if len(ranges) < 2 {
|
if len(ranges) < 2 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
sort.Strings(ranges)
|
|
||||||
port = ranges[0]
|
startPort, _ := strconv.Atoi(ranges[0])
|
||||||
upper = ranges[1]
|
endPort, _ := strconv.Atoi(ranges[1])
|
||||||
|
if startPort < endPort {
|
||||||
|
port = ranges[0]
|
||||||
|
upper = ranges[1]
|
||||||
|
} else {
|
||||||
|
port = ranges[1]
|
||||||
|
upper = ranges[0]
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
start, _ := strconv.Atoi(port)
|
start, _ := strconv.Atoi(port)
|
||||||
end, _ := strconv.Atoi(upper)
|
end, _ := strconv.Atoi(upper)
|
||||||
|
Loading…
Reference in New Issue
Block a user