Skip to content

Commit

Permalink
fix: new ipPortNumMap after auto release
Browse files Browse the repository at this point in the history
  • Loading branch information
XinRoom committed Feb 6, 2023
1 parent d1977c4 commit 98ab122
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/go-portScan.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ func run(c *cli.Context) error {
}
if maxOpenPort > 0 {
ipPortNumRW.Lock()
ipPortNumMap[ret.Ip.String()] += 1
if _, ok := ipPortNumMap[ret.Ip.String()]; ok {
ipPortNumMap[ret.Ip.String()] += 1
}
ipPortNumRW.Unlock()
}
if sV || httpx {
Expand Down Expand Up @@ -266,6 +268,11 @@ func run(c *cli.Context) error {
portScan := func(ip net.IP) {
var ipPortNum int
var ipPortNumOk bool
if maxOpenPort > 0 {
ipPortNumRW.Lock()
ipPortNumMap[ip.String()] = 0
ipPortNumRW.Unlock()
}
for _, _port := range ports { // port
s.WaitLimiter() // limit rate

Expand Down

0 comments on commit 98ab122

Please sign in to comment.