Skip to content

Commit

Permalink
fix -exclude-ports for -passive
Browse files Browse the repository at this point in the history
  • Loading branch information
dogancanbakir committed Mar 18, 2024
1 parent 6f94fc7 commit e7b3822
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions v2/pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import (
"net/url"
"os"
"path/filepath"
"slices"
"strconv"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -419,7 +421,12 @@ func (r *Runner) RunEnumeration(pctx context.Context) error {
return
}

excludePorts := strings.Split(r.options.ExcludePorts, ",")
for _, p := range data.Ports {
if slices.Contains(excludePorts, strconv.Itoa(p)) {
continue
}

pp := &port.Port{Port: p, Protocol: protocol.TCP}
if r.scanner.OnReceive != nil {
r.scanner.OnReceive(&result.HostResult{IP: ip, Ports: []*port.Port{pp}})
Expand Down

0 comments on commit e7b3822

Please sign in to comment.