Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unlikely to Support UDP Port Scan #14

Open
cogitoergosumsw opened this issue Feb 15, 2022 · 2 comments
Open

Unlikely to Support UDP Port Scan #14

cogitoergosumsw opened this issue Feb 15, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@cogitoergosumsw
Copy link

Just a cursory look at the implementation of the code, I reckon the UDP port scan would not work just because of how UDP protocol works. If the the code dials the target with UDP protocol e.g. conn, err = net.Dial("udp", raddr), there will not be any error message from the target server just because UDP is connectionless. A server will only reply when a "meaningful" packet is sent to the UDP port on the target. For more info - https://serverfault.com/a/416269

By the current way of checking for open/close UDP port i.e. presence of error dialing the target, all UDP ports would be open. Which defeats the purpose of a port scan.

Alternatively, can refer to how nmap implements its UDP probe - https://nmap.org/book/scan-methods-udp-scan.html

@cogitoergosumsw
Copy link
Author

I think to successfully do a UDP port scan, you may need a list of pre-determined list of services to probe for responses.
First construct a UDP packet request with a byte array that is expected from the service running on the UDP port. Then listen for the corresponding response byte array to check if the port is open. Something like this - https://github.com/antelman107/net-wait-go#udp-library-usage-example

I understand this is a lot of work so I'm just putting this out there for reference. I don't think I can do this on my own :D

@JustinTimperio
Copy link
Owner

JustinTimperio commented Feb 15, 2022

You are probably right with the UDP support. I honestly added it as a throwaway feature since:

  1. TCP scanning was the real priority when I wrote this
  2. The dial conn, err = net.Dial("udp", raddr) allows for calls other than TCP so I figured I would just expose it to the user to decide.

@JustinTimperio JustinTimperio added the enhancement New feature or request label Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants