-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Support decimal-IP notation for destination in Ncat #375
Comments
The specific use case for me is using 0 in place of 0.0.0.0. |
I'm not totally against this, but I'm also not sure we really need to support an obsolete syntax just because some other ancient tools do. Then again, I just tested the Chrome web browser and it allowed me to reach nmap.org at https://757150071/. If "0" is the only specific use case anyone has, maybe we could just special case that? Is there anyone who might use this in other situations than "0"? |
Further testing reveals only decimal numbers are failing to work: converting to hex works just fine:
We're actually specifically checking for a non-digit character to distinguish hostname from port number in ncat_main.c: /* Resolve hostname if we're given one */
if (strspn(argv[optind], "0123456789") != strlen(argv[optind])) {
/*<snip>*/
} else {
if (!o.listen)
bye("You must specify a host to connect to.");
} This is to avoid ambiguity: |
But that might break the command's flexibility for some right? |
Commit 04c4c70 ("Support decimal integer representation of target addresses. Fixes nmap#375") introduced a regression when the user specify only the port using AF_VSOCK in listening (e.g. `ncat --vsock -l 1234`). Before that commit we supported this invocation, but currently we interpret the parameter as CID. Alternatively, the version with -p is still working (e.g. `ncat --vsock -l -p 1234`). Having documented this usage in the manpage as well, it's better to fix it and support it again. Tested locally (without VMs involved), using CID = 1 (loopback) in this way: shell1$ ncat --vsock -l 1234 shell2$ ncat --vsock 1 1234 # Note: If CID 1 is not supported and the previous command fails, # it means that you have to manually load `vsock_loopback` kernel # module (usually it is autoamtically loaded when AF_VSOCK is used # if the `vsock` kernel module is not already loaded in the system) Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Commit 04c4c70 ("Support decimal integer representation of target addresses. Fixes nmap#375") introduced a regression when the user specify only the port using AF_VSOCK in listening (e.g. `ncat --vsock -l 1234`). Before that commit we supported this invocation, but currently we interpret the parameter as CID. Alternatively, the version with -p is still working (e.g. `ncat --vsock -l -p 1234`). Having documented this usage in the manpage as well, it's better to fix it and support it again. Tested locally (without VMs involved), using CID = 1 (loopback) in this way: shell1$ ncat --vsock -l 1234 shell2$ ncat --vsock 1 1234 # Note: If CID 1 is not supported and the previous command fails, # it means that you have to manually load `vsock_loopback` kernel # module (usually it is autoamtically loaded when AF_VSOCK is used # if the `vsock` kernel module is not already loaded in the system) Reported-by: Luigi Leonardi <luigi.leonardi@outlook.com> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Commit 04c4c70 ("Support decimal integer representation of target addresses. Fixes nmap#375") introduced a regression when the user specifies only the port using AF_VSOCK in listening (e.g. `ncat --vsock -l 1234`). Before that commit, we supported this invocation, but currently we interpret the parameter as CID. Alternatively, the version with -p is still working (e.g. `ncat --vsock -l -p 1234`). Having documented this usage in the manpage as well, it's better to fix it and support it again. Tested locally (without VMs involved), using CID = 1 (loopback) in this way: shell1$ ncat --vsock -l 1234 shell2$ ncat --vsock 1 1234 # Note: If CID 1 is not supported and the previous command fails, # it means that you have to manually load `vsock_loopback` kernel # module (usually it is autoamtically loaded when AF_VSOCK is used # if the `vsock` kernel module is not already loaded in the system) Reported-by: Luigi Leonardi <luigi.leonardi@outlook.com> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Both traditional (Hobbit) and OpenBSD netcat support using IPv4 address in decimal notation as a destination address. Example:
At least one user has complained of this on IRC. Ncat gives this error instead:
The text was updated successfully, but these errors were encountered: