Skip to content

How do I get the first open port in a range? #822

@ndren

Description

@ndren

Hi, I'm trying to understand how I can implement the below idiom:
rustscan --ulimit 5000 --no-banner -a $TARGET --range 10000-65535 --scripts none | head -1

Specifically, I know my target has 1 port open in the range and I'd like to quit scanning when that is found.

Currently it leads to an abort:

[~] Automatically increasing ulimit value to 5000.

thread 'main' panicked at library/std/src/io/stdio.rs:1123:9:
failed printing to stdout: Broken pipe (os error 32)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Is that expected? Is there a nicer way to implement this?

I've tried greppable mode but that only gets me the list of ports at the very end, so in my case on average 2x slower than it would be if it would display the ports live. (E.g. rather than printing when it finds open port 34567 it will only print after it reaches 65535.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions