Accept combined ports and ranges in --ports - #1
Merged
Merged
Conversation
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.
Why
port-scannerbuilds RustScan frommikhail5555/RustScan, branchcombine-ports-and-range-input— a personal repo, an unprotected branch, cloned at build time with--depth 1 -b <branch>and no commit pin. Whatever that branch points at when the image builds goes into production scanning. That branch is also 125 commits behind upstream.This brings the feature into our own fork, on top of current upstream, so we can pin it and land fixes on it. It is the prerequisite for #2 reaching production.
What we depend on
port-scanner/pkg/utils/ports.goToPortRangesStringcollapses a port list into a compact string mixing individual ports and ranges:Upstream cannot parse that.
--portsisOption<Vec<u16>>withvalue_delimiter = ',', and--rangeis a separate, mutually exclusive singlestart-end. These six commits replace both with one--portsthat accepts either form, keepingrangeas an alias.Contents
Mikhail Epifanov's six commits from
combine-ports-and-range-input(Jun 2025), cherry-picked ontomasterat2e78c22with original authorship preserved:Conflict resolved — please check this one
src/input.rsonly. Upstream addedrange: Option<PortRange>to the config-fileConfigstruct after these commits were written. The incoming commits delete the separate--rangeoption, soPortRangeno longer exists and upstream's line cannot compile. I took the incoming side and dropped the field.Behaviour change: a RustScan config file setting
range = ...is no longer accepted. The--rangeflag still works as an alias.port-scannerpasses everything as flags and ships no config file, so this does not affect us — but it is a real difference from upstream and worth a second pair of eyes.Verification
Built and tested against
rust:1.93:cargo build --release— cleancargo test— 80 passed, 0 failed, 8 ignored./rustscan --ports 22,80,443,1000-2000 --addresses 127.0.0.1 --batch-size 10 --greppable --scan-order random --timeout 200— parses; this is the exact shapeport-scanneremitsFollow-ups, not in this PR
modules/port-scanner/Dockerfileat this fork and pin a commit SHA rather than a branch🤖 Generated with Claude Code