Skip to content

Commit

Permalink
Merge pull request #18 from praetorian-inc/udp-priority-bug
Browse files Browse the repository at this point in the history
Bug Fix: Fast Flag and Port Priority Ignored During UDP Scanning
  • Loading branch information
UNC1739 committed Apr 25, 2023
2 parents 4b720d4 + ee6f689 commit 297329f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions pkg/scan/simple_scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,31 @@ func setupPlugins() {

// UDP Scan of the target
func (c *Config) UDPScanTarget(target plugins.Target) (*plugins.Service, error) {

// first check the default port mappings for TCP / TLS
for _, plugin := range sortedUDPPlugins {
ip := target.Address.Addr().String()
port := target.Address.Port()
if plugin.PortPriority(port) {
conn, err := DialUDP(ip, port)
if err != nil {
return nil, fmt.Errorf("unable to connect, err = %w", err)
}
result, err := simplePluginRunner(conn, target, c, plugin)
if err != nil && c.Verbose {
log.Printf("error: %v scanning %v\n", err, target.Address.String())
}
if result != nil && err == nil {
return result, nil
}
}
}

// if we're fast mode, return (because fast mode only checks the default port service mapping)
if c.FastMode {
return nil, nil
}

for _, plugin := range sortedUDPPlugins {
conn, err := DialUDP(target.Address.Addr().String(), target.Address.Port())
if err != nil {
Expand Down

0 comments on commit 297329f

Please sign in to comment.