* refactor: make RustScan additionally a library
- add `lib.rs` (permitted as per
[_Packages and Crates_](https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html)).
- refactor `main.rs` to reference the library.
- update module references as required.
* doc: correct documentation issues
- fix some failing doc-tests.
- amend formatting causing misinterpretation as code-samples.
- mark some examples as
[`compile_fail`](https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html#attributes)
as there's no immediate way to instantiate the required `struct`.
* docs: add basic module documentation
- add lib-level docs. including a minimal example.
- add minimal, headline information for each module.
* Update Dockerfile
Upgrade alpine to 3.13, add ca-certificates and bind-tools.
* Add github/docker to dependabot. Update some of the actions
* Skip Registry login for Pull Requests
* build: remove explicit strip steps
- update `Cargo.toml` to
[`strip`](https://doc.rust-lang.org/cargo/reference/profiles.html#strip)
as part of the release profile.
- remove explicit `strip` steps from the release workflow.
- update step name to better reflect `git config` changes.
* build: remove prefix from expected tags
- remove the `v` prefix from the triggering tag (all previous tags lack this).
- update tag-deriving steps to better reflect the expected tag pattern.
- update tag-deriving steps to be consistent in how `GITHUB_REF` is parsed.
* build: make build/OS checks generic
- update GitHub Actions conditions to use
[`contains`](https://docs.github.com/en/actions/learn-github-actions/expressions#contains)
to match _all_ related builds.
- update shell conditions to accommodate the same.
Changed this :
For things like --script '(safe and vuln)' enclose it in quotations marks \"'(safe and vuln)'\"")
to:
For things like --script '(safe and vuln)' enclose it in quotations marks \"'(safe and vuln)'\"
* First attempt enabling exclude port list capability
* disabling a not desired println! used for debugging purpose
* fixing small typo: dbg! by debug!
* adding emtpy commit to make CI/CD pass
* running cargo fmt and removing a TODO comment
* Actually running cargo fmt without check LoL
* fixed some clippy error
* fixing one more cargo clippy complain
---------
Co-authored-by: Wuelfhis Asuaje <[email protected]>
* fix port range to include end
* empty
Signed-off-by: Maximiliano Molina <[email protected]>
---------
Signed-off-by: Maximiliano Molina <[email protected]>
* Fix markdown-link-checker workflow
Added a configuration file that tells MLC to ignore the URLs in .github\workflows\mlc_config.json as MLC is falsely reporting these as dead
* Update markdown.yml
* Update README.md
Fixed the issue with the links
closes#516
* Update README.md
1. Fixed the arch Linux link. Closes#519
2. Fixed Arch badge so it's linked to the correct version
3. Cleaned up missing links throughout the document
4. Moved all links other than the contributor's section to the end of the document for easier maintenance
5. Fixed language so it was grammatically correct
Alpine Linux v3.12 is end of life about months, the builder base image
is alreayd Alpine v3.17, and Alpine v3.17 is the latest stable release
with about 2 more years support, should be good to ugprade to it.
Signed-off-by: Peter Dave Hello <[email protected]>
Signed-off-by: Peter Dave Hello <[email protected]>
* feat(docker): build and publish docker image in ci
Signed-off-by: leofvo <[email protected]>
* refactor(docker): updated dockerfile to build release version of rustscan
Signed-off-by: leofvo <[email protected]>
In the readme there are 2 links to docker & kali, 'Usage' and 'Read the install guide'. These links weren't working.
Co-authored-by: Bee <[email protected]>
Improve documentation for addresses CLI arg to make it
clear that file parsing of addresses is already supported
(#452)
Co-authored-by: Bee <[email protected]>
* Changed dns resolving library to to_socket_addrs and removed the usage of trust-dns
* Reverted automatic IDE spacing
* Ran cargo fmt on the code
* Made trust-dns a fallback dns resolver and reverted cargo toml and lock
* Reverted cargo.lock
* Ran cargo fmt
* Changed style of err checking
* Fixed errors
* Fixed merging errors
* Changed for CR
Co-authored-by: Bee <[email protected]>
A new Dockerfile "contributing.Dockerfile" was added.
This Dockerfile permits creating a "ready to develop" container image to ease
contributing to RustScan.
The instructions to use it are detailed in contributing.md.
By default the number of try is 1, it can be set on the command line by using
--tries option.
This should closeRustScan/RustScan#38.
Co-authored-by: Bee <[email protected]>
This has the benefit of making the input flexible and fixing an existing
bug that happens when a single port is specified, see #211.
Other benefits:
- We are now parsing only failures as a file, reducing the amount of
attempts to open a file.
- We check if a file exists before trying to open it.
Fixes#211
Co-authored-by: Bee <[email protected]>
Changing only a few lines does not give you maintainer. Also people might contact the person if they need to reach out about something which is probably not intended.
Co-authored-by: Bee <[email protected]>
* Add integration tests with timeout
* cargo fmt
* Fix travis command line
* Add extra margins for the timeout values
* Increase the time to scan
Output the time taken after each test
DockerHub now contains every major release from `v1.0.1` to `1.10.0`
Waiting for this README PR to approve before I remove the `v1.9.0` DockerHub tag as it no longer conforms with standards.
Co-authored-by: Bee <[email protected]>
At the moment the Dockerfile brings the entire current directory in as a context for the building container. We can encourage some caching here by only bringing forward the essentials:
`cargo.tml`, `cargo.lock` and the `src`
+ Added a maintainer label
v1.8.0 is the most recent published version of RustScan, the alpine tag quickly became depreciated - meaning people had to rely on `latest` to get any features made within the last month.
Version tags will build as per major realease i.e. `v1.9.0`
The goal of this iterator is to generate sockets based on combinations
of IPs and ports in a memory-bounded way, we only consume the next item
of this iterator when a socket has been processed by our scanner.
Before this change we were generating every combination of IP and port
and storing it in a VecDeque, and while this is fine for a small subset
of IPs and ports it can quickly get out of hand with multiple IPs and
a big port range.
When reading the config file '$CONFIG_DIR/.config/rustscan/config.toml'
should also be checked. If both '~/.rustscan.toml' and
'$CONFIG_DIR/.config/rustscan/config.toml' exist, then later will be
used.
This configuration file will be read from the home directory of the
user. Options set within this file will have priority over arguments
from the command line unless the `--no-config` option is passed to the
program.
By default, Cargo instructs compilation units to be compiled and optimized
in isolation. LTO instructs the linker to optimize at the link stage.
This can, for example, remove dead code and often times reduces binary size.
By default, when Rust code encounters a situation when it must call panic!(),
it unwinds the stack and produces a helpful backtrace. The unwinding code,
however, does require extra binary size. rustc can be instructed to abort
immediately rather than unwind, which removes the need for this extra unwinding code.
For more information see: https://github.com/johnthagen/min-sized-rust
Before this change we would always scan manually specified ports in
sequential way, this is not the case anymore. This is an important
change since we are planning to introduce a config file with the top 1K
ports and we would like to scan those in a randomized way.
These options are mutually exclusive, this means that when a user
selects manual ports we will ignore ranges and vice-versa.
Manually specifying ports won't allow scan randomization for now.
+ Added another step to clarify process for Docker as the build will fail if the user is not in the downloaded repo
+ DockerHub has CI with master branch and two images tags `latest` and `alpine` where `alpine` is tagged on feature releases (currently 1.7.1)
For now if we can establish a socket on port 80 we can infer the IP of the
host. This might change in the future if we start considering other
ports like 443.
![Arch Linux package][badge-1] ![Built with Rust][badge-2] ![GitHub All Releases][badge-3] ![Crates.io][badge-4] ![Discord][badge-5] ![Actions][badge-6]
@@ -63,83 +57,85 @@ Not to mention RustScan uses Adaptive Learning to improve itself over time, maki
## 🧋 Speed

![fast][speed-1]
Speed is guaranteed via RustScan. However, if you want to run a slow scan due to stealth that is possible too.
Speed is guaranteed via RustScan. However, if you want to run a slow scan due to stealth, that is possible too.
Firstly, let's talk code.
We have tests that check to see if RustScan is significantly slower than the previous version. If it is, the continuous integration fails and we can't commit code to master unless we make it faster.
We have tests that check to see if RustScan is significantly slower than the previous version. If it is, the continuous integration fails, and we can't commit code to master unless we make it faster.
[HyperFine](https://github.com/sharkdp/hyperfine) is used to monitor RustScan's performance over time to answer the question "Are we getting faster? Are we getting slower?".
[HyperFine][speed-2] is used to monitor RustScan's performance over time to answer the question, "Are we getting faster? Are we getting slower?".
Every pull request is reviewed by 1 person, but more often than not 2 people review it. We test it manually and make sure the code doesn't affect performance negatively.
Every pull request is reviewed by **one** person, but more often than not, **two** people review it. We test it manually and ensure the code doesn't negatively affect performance.
[Read more here](https://github.com/RustScan/RustScan/wiki/Increasing-Speed-&-Accuracy).
[Read more here][speed-3].
## ⚙️ Extensible
## ⚙️ Extensible

![scripts][extensible-1]
_RustScan piping results into the custom Python script_
### _RustScan piping results into the custom Python script_
RustScan has a new scripting engine which allows anyone to write scripts in most languages. Python, Lua, Shell are all supported.
RustScan has a new scripting engine that allows anyone to write scripts in most languages. Python, Lua, and Shell are all supported.
Want to take your found ports and pipe them into Nmap for further analysis? That's possible. Want to run `smb-enum` if SMB is found open? Possible.
The possibilities are endless -- and you can write scripts in whatever language you feel comfortable with.
[Read more here](https://github.com/RustScan/RustScan/wiki/RustScan-Scripting-Engine).
[Read more here][extensible-2].
## 🌊 Adaptive

![adaptive][adaptive-1]
_RustScan automatically fine-tuning itself to match the host OS_.
### _RustScan automatically fine-tunes itself to match the host OS_
RustScan has a cool set of features called "Adaptive Learning". These features "learn" about the environment you are scanning and how _you_ use RustScan to **improve itself over time**.
This is an umbrella term we use for any feature that fits this criteria. The list is constantly changing, so [check out our wiki for more information](https://github.com/RustScan/RustScan/wiki/Adaptive-Learning).
We use this umbrella term for any feature that fits this criterion. The list constantly changes, so [check out our wiki for more information][adaptive-learning].
## 👩🦯 Accessible

![fast][accessible-1]
RustScan is one of the first penetration testing tools that aims to be entirely accessible.
RustScan is one of the first penetration testing tools that aims to be entirely accessible.
[Most penetration testing tools are not accessible](https://bees.substack.com/p/making-hacking-accessible), which negatively affects the whole industry.
[Most penetration testing tools are not accessible][accessible-2], which negatively affects the whole industry.
RustScan has continuous integration testing that aims to make sure it is accessible, and we are constantly working on ways to improve our accessibility and make sure _everyone_ can use RustScan.
RustScan has continuous integration testing that aims to ensure it is accessible, and we are constantly working on ways to improve our accessibility and ensure _everyone_ can use RustScan.
# 📖 Full Installation Guide
You can find our guide [here](https://github.com/RustScan/RustScan/wiki/Installation-Guide).
You can find our guide [here][install-1].
## 🦊 Community Distributions
Here are all of RustScan's community distributions.
If you maintain a community distribution and want it listed here, leave an issue / pull request / Discord message or however you want to let us know.
If you maintain a community distribution and want it listed here, leave an issue / pull request / Discord message or however, you want to let us know.
We have 2 usage guides. [Basic Usage](https://github.com/RustScan/RustScan/wiki/Usage) and [Things you may want to do](https://github.com/RustScan/RustScan/wiki/Things-you-may-want-to-do-with-RustScan-but-don't-understand-how).
We have 2 usage guides. [Basic Usage][usage-1] and [Things you may want to do][usage-2].
We also have documentation about our config file [here](https://github.com/RustScan/RustScan/wiki/Config-File).
We also have documentation about our config file [here][config-file-here].
# 🎪 Community
[Read this to learn how to contribute](https://github.com/RustScan/RustScan/wiki/Contributing).
[Contributing][community-1] Read this to learn how.
## Contributors ✨
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[usage-2]: https://github.com/RustScan/RustScan/wiki/Things-you-may-want-to-do-with-RustScan-but-don't-understand-how "Things you may want to do with rustscan but don't know how"
[community-1]: https://github.com/RustScan/RustScan/wiki/Contributing "Learn how to contribute"
iferror_string.to_lowercase().contains("too many open files"){
panic!("Too many open files. Please reduce batch size. The default is 5000. Try -b 2500.");
}
assert!(!error_string.to_lowercase().contains("too many open files"),"Too many open files. Please reduce batch size. The default is 5000. Try -b 2500.");
ifnr_try==tries{
error_string.push(' ');
@@ -155,13 +172,16 @@ impl Scanner {
/// Performs the connection to the socket with timeout
/// # Example
///
/// let port: u16 = 80
/// // ip is an IpAddr type
/// let ip = IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1));
/// let socket = SocketAddr::new(ip, port);
/// self.connect(socket)
/// // returns Result which is either Ok(stream) for port is open, or Er for port is closed.
/// // Timeout occurs after self.timeout seconds
/// ```compile_fail
/// # use std::net::{IpAddr, Ipv6Addr, SocketAddr};
/// let port: u16 = 80;
/// // ip is an IpAddr type
/// let ip = IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1));
/// let socket = SocketAddr::new(ip, port);
/// scanner.connect(socket);
/// // returns Result which is either Ok(stream) for port is open, or Er for port is closed.
//! Scripting engine to run scripts based on tags.
//! Scripting Engine to run scripts based on tags.
//!
//! This module serves to filter and run the scripts selected by the user.
//!
//! A new commandline and configuration file option was added.
//!
//! --scripts
//! ## `--scripts`
//!
//! default
//! This is the default behavior, like as it was from the beginning of RustScan.
//! The user do not have to chose anything for this. This is the only script embedded in RustScan running as default.
//! ### `default`
//!
//! none
//! The user have to use the --scripts none commandline argument or scripts = "none" in the config file.
//! None of the scripts will run, this replaces the removed --no-nmap option.
//! This is the default behavior, like as it was from the beginning of RustScan.
//!
//! custom
//! The user have to use the --scripts custom commandline argument or scripts = "custom" in the config file.
//! Rustscan will look for the script configuration file in the user's home dir: home_dir/.rustscan_scripts.toml
//! The config file have 3 optional fields, tag, developer and port. Just the tag field will be used forther in the process.
//! RustScan will also look for available scripts in the user's home dir: home_dir/.rustscan_scripts
//! and will try to read all the files, and parse them into a vector of ScriptFiles.
//! Filtering on tags means the tags found in the rustscan_scripts.toml file will also have to be present in the Scriptfile,
//! otherwise the script will not be selected.
//! All of the rustscan_script.toml tags have to be present at minimum in a Scriptfile to get selected, but can be also more.
//! The user do not have to chose anything for this. This is the only script
//! embedded in RustScan running as default.
//!
//! ### `none`
//!
//! The user have to use the `--scripts none` commandline argument or `scripts =
//! "none"` in the config file.
//!
//! None of the scripts will run, this replaces the removed `--no-nmap` option.
//!
//! ### `custom`
//!
//! The user have to use the `--scripts custom` commandline argument or
//! `scripts = "custom"` in the config file.
//!
//! RustScan will look for the script configuration file in the user's home
//! dir: `home_dir/.rustscan_scripts.toml`
//!
//! The config file have 3 optional fields: `tag`, `developer` and `port`. Just
//! the `tag` field will be used forther in the process.
//!
//! RustScan will also look for available scripts in the user's home dir:
//! `home_dir/.rustscan_scripts` and will try to read all the files, and parse
//! them into a vector of [`ScriptFile`].
//!
//! Filtering on tags means the tags found in the `rustscan_scripts.toml` file
//! will also have to be present in the [`ScriptFile`], otherwise the script
//! will not be selected.
//!
//! All of the `rustscan_script.toml` tags have to be present at minimum in a
//! [`ScriptFile`] to get selected, but can be also more.
//!
//! Config file example:
//! fixtures/test_rustscan_scripts.toml
//!
//! - `fixtures/test_rustscan_scripts.toml`
//!
//! Script file examples:
//! fixtures/test_script.py
//! fixtures/test_script.pl
//! fixtures/test_script.sh
//! fixtures/test_script.txt
//!
//! call_format in script files can be of 2 variants.
//! One is where all of the possible tags {{script}} {{ip}} {{port}} are there.
//! The {{script}} part will be replaced with the scriptfile full path gathered while parsing available scripts.
//! The {{ip}} part will be replaced with the ip we got from the scan.
//! The {{port}} part will be reaplced with the ports separated with the ports_separator found in the script file
//! - `fixtures/test_script.py`
//! - `fixtures/test_script.pl`
//! - `fixtures/test_script.sh`
//! - `fixtures/test_script.txt`
//!
//! And when there is only {{ip}} and {{port}} is in the format, ony those will be replaced with the arguments from the scan.
//! This makes it easy to run a system installed command like nmap, and give any kind of arguments to it.
//! `call_format` in script files can be of 2 variants:
//!
//! If the format is different, the script will be silently discarded and will not run. With the Debug option it's possible to see where it goes wrong.
//! One is where all of the possible tags `{{script}}`, `{{ip}}` and `{{port}}`
//! are there.
//!
//! - The `{{script}}` part will be replaced with the scriptfile full path
//! gathered while parsing available scripts.
//! - The `{{ip}}` part will be replaced with the ip we got from the scan.
//! - The `{{port}}` part will be reaplced with the ports separated with the
//! `ports_separator` found in the script file
//!
//! And when there is only `{{ip}}` and `{{port}}` is in the format, only those
//! will be replaced with the arguments from the scan.
//!
//! This makes it easy to run a system installed command like `nmap`, and give
//! any kind of arguments to it.
//!
//! If the format is different, the script will be silently discarded and will
//! not run. With the `Debug` option it's possible to see where it goes wrong.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.