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

Increase buffer for nmap arguments when "--resume" a scan #1659

Closed
wants to merge 1 commit into from
Closed

Increase buffer for nmap arguments when "--resume" a scan #1659

wants to merge 1 commit into from

Conversation

cnotin
Copy link

@cnotin cnotin commented Jul 10, 2019

I have a complicated nmap scan with a long list of ports (used both for "-PS", SYN ping, and "-p", SYN port scan).
Here is what happens when I try to resume this scan (using the .nmap or .gnmap files):

nmap --resume myscan.nmap
Unable to parse supposed log file myscan.nmap. Perhaps the Nmap execution had not finished at least one host? In that case there is no use "resuming"
QUITTING!

I found that the issue is that the arguments string length is higher than 1024 which is currently not supported:

nmap/nmap.cc

Line 2339 in 23ee017

char nmap_arg_buffer[1024];

nmap/nmap.cc

Lines 2392 to 2393 in 23ee017

if (!q || ((unsigned int) (q - p) >= sizeof(nmap_arg_buffer) - 32))
fatal("Unable to parse supposed log file %s. Perhaps the Nmap execution had not finished at least one host? In that case there is no use \"resuming\"", fname);

I chose arbitrarily the new value of "1024*128" but it seems large enough while being a reasonable size (131ko). Also based on this, but it is not a definite answer:
https://serverfault.com/a/163390
With the patch I can confirm that my scan can properly resume.

As a side note, I think that the displayed error message has no relation with the issue here.

@nnposter
Copy link

There is a 4K limitation in arg_parse() so I assume that your specific scan had to fit into that. I have increased the resume buffer accordingly.

Thank you for contributing to nmap.

@nnposter nnposter self-assigned this Jul 14, 2019
@nmap-bot nmap-bot closed this in 4e6fef4 Jul 14, 2019
@cnotin cnotin deleted the patch-10 branch August 19, 2020 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants