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

CLI option to also show closed ports #736

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fabianbees
Copy link
Contributor

This PR introduces the new CLI option --closed, which enables the option to also show ports which are closed.

From a security perspective, it is very useful information to see whether we got any response at all for a given port, even when the response is a RST (conn-refused).
It can indicate that our request was denied (or specifically blocked by a firewall).

Currently this behavior is behind the --closed CLI flag and not enabled by default.
Nmap, for example, shows closed ports by default.

Regarding the output of the --closed option, it mimics the output for open ports, but instead of Open it shows Closed right before the IP Address.

If the -g (grepable) option is set, first all open ports are printed for each IPs, then the text closed ports: is printed and the same output is repeated for all closed ports.

Here is an example:
.----. .-. .-. .----..---.  .----. .---.   .--.  .-. .-.
| {}  }| { } |{ {__ {_   _}{ {__  /  ___} / {} \ |  `| |
| .-. \| {_} |.-._} } | |  .-._} }\     }/  /\  \| |\  |
`-' `-'`-----'`----'  `-'  `----'  `---' `-'  `-'`-' `-'
The Modern Day Port Scanner.
________________________________________
: http://discord.skerritt.blog         :
: https://github.com/RustScan/RustScan :
 --------------------------------------
TreadStone was here 🚀

[~] The config file is expected to be at "/********/.rustscan.toml"
[~] Automatically increasing ulimit value to 50000.
Closed [10.100.0.1]:22
Open [10.100.0.1]:2222
10.100.0.1 -> [2222]
closed ports:
10.100.0.1 -> [22]
And with the -g option:
10.100.0.1 -> [2222]
closed ports:
10.100.0.1 -> [22]

@fabianbees fabianbees force-pushed the feat/show_closed_ports branch from db1f410 to 64e6ad4 Compare January 23, 2025 12:47
@fabianbees fabianbees force-pushed the feat/show_closed_ports branch 2 times, most recently from 9b56a19 to 462771a Compare February 10, 2025 09:04
@fabianbees
Copy link
Contributor Author

I have rebased the feature onto master.

@fabianbees fabianbees force-pushed the feat/show_closed_ports branch 2 times, most recently from 01a0d89 to 29b77d6 Compare February 24, 2025 06:29
@fabianbees
Copy link
Contributor Author

@bee-san Can you please also have a look at this PR?

@fabianbees fabianbees force-pushed the feat/show_closed_ports branch from 29b77d6 to f76d254 Compare March 3, 2025 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant