nmap icon indicating copy to clipboard operation
nmap copied to clipboard

nping does not support --source-addr in udp unprivileged mode

Open cwmos opened this issue 5 years ago • 3 comments

If I run:

nping --udp --dest-port 50000 --dest-ip 232.1.3.100 --source-ip 127.0.0.1

I get the error message:

Mode UDP requires root privileges

This error message is somewhat misleading, but it seems to be due to the "--source-ip" parameter.

However, there is no reason this should not work, nping could just bind the socket to 127.0.0.1.

Netcat was able to do this with something like "echo Hello | nc -s 127.0.0.1 -u 232.1.3.100 50000"

cwmos avatar Apr 27 '20 14:04 cwmos

There is a fundamental difference between nping and nc:

Option -s in nc let you choose any locally configured IP address while --source-ip in nping allows you to pick completely arbitrary IP address. That's why the latter needs root privileges but the former does not.

nnposter avatar Apr 27 '20 18:04 nnposter

Thank you for the quick response.

I get what you mean. Still, since nping has the ability to use the normal socket API as long as no options are given that require the use of raw sockets, I think it would be a nice addition to also support --source-ip in case the specified IP can be bound. I propose to make this ticket a feature request.

cwmos avatar Apr 28 '20 06:04 cwmos

IMHO that will make both the CLI and the code a bit messy while the use case is a bit narrow, especially since you already have option --interface to select a local address (but not necessary every local address). A possibly cleaner choice would be to support IP addresses for interfaces.

I will tag your request as an enhancement suggestion

nnposter avatar Apr 29 '20 03:04 nnposter