honor configured batch size & reject unsupported ulimit - #921
Open
DanHouseman wants to merge 1 commit into
Open
Conversation
|
Yoo, nice one Thanks for the shoutout on #905. Glad to see that fix carried over, and the Windows batch-size + |
Author
|
Absolutely! Gotta give credit where it’s due. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes native Windows batch-size handling and makes Unix-only
--ulimitbehavior explicit.For example: Currently on Windows, RustScan ignores the batch-size value
-b/--batch-sizeand instead uses the hard-codedAVERAGE_BATCH_SIZEvalue of 3000This means a command like the following wont actually scan with the batch-size of 50.
This changes the Windows code path to honor the configured batch size and ensures diagnostics report the effective batch size actually used.
It also hides
--ulimitfrom Windows help output and rejects it when supplied on Windows becauseulimitis not applicable to native Windows.Changes
Use
opts.batch_sizeas the effective batch size on native Windows.Preserve existing Unix batch-size and
ulimitinference behavior.Report the effective batch size rather than the originally requested value in scan diagnostics.
Hide
--ulimitfrom Windows CLI help.Reject
--ulimiton Windows with an explanatory error and exit code 2.Validate platform-specific options after configuration merging so
ulimitsupplied through.rustscan.tomlis also rejected.Add Windows-specific unit coverage.
Add
tests/windows_correctness.rsintegration coverage for:--ulimitrejection.ulimitrejection.Testing
Tested natively on Windows 11.
Windows integration tests:
Behavior
Before:
After:
Unix behavior is unchanged.
Related work / acknowledgement
This PR has an overlap with existing PR #905, “Refactor port scanning and improve batch size handling,” by @0xxreacher:
PR #905 correctly identified that the no-open-ports warning reports
opts.batch_sizerather than the effectivebatch_sizeactually used by the scanner. I retained that correction here because it is also necessary for the Windows behavior fixed by this PR to report its runtime configuration accurately.The primary Windows issue addressed here is separate: on native Windows, the
#[cfg(not(unix))]path currently ignores the configured-b/--batch-sizevalue entirely and instead hard-codesAVERAGE_BATCH_SIZE(3000). This PR makes Windows honor the requested batch size and adds Windows-specific handling and tests for the Unix-only--ulimitoption.With that said, credit should go to @0xxreacher for identifying the effective batch-size reporting issue in #905.