Compare commits

..
Author SHA1 Message Date
Brandon 751c4daff6 1.7.1 2020-08-07 17:48:37 +01:00
Brandon f6214cfb27 Merge branch 'master' of github.com:brandonskerritt/RustScan 2020-08-07 17:48:10 +01:00
Brandon a92eb80365 updated lock files 2020-08-07 17:30:39 +01:00
Brandon aeab4fb68c Merge pull request #131 from RustScan/bee-colours
Added TUI A11Y colours + Quiet Mode Macros
2020-08-07 17:25:57 +01:00
Brandon 9ab15c9d8b cargo fmt 2020-08-07 17:11:14 +01:00
Brandon 7146c23ed9 cleanup 2020-08-07 17:06:43 +01:00
Brandon f37f2d8f9d switching to master 2020-08-07 16:50:42 +01:00
Brandon 5a3a4d1c0c cargo fmt 2020-08-07 16:36:14 +01:00
Brandon 33e7cd44b6 added quiet mode to macros 2020-08-07 16:33:25 +01:00
Brandon 8288856949 added quotes 2020-08-07 13:21:19 +01:00
Brandon c3b96e262d Merge pull request #130 from RustScan/bee-add-TUI-module
Bee add tui module
2020-08-07 12:53:46 +01:00
5 changed files with 74 additions and 52 deletions

No files matched your search

Generated
+7 -7
View File
@@ -165,9 +165,9 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "clap"
version = "2.33.1"
version = "2.33.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdfa80d47f954d53a35a64987ca1422f495b8d6483c0fe9f7117b36c2a792129"
checksum = "10040cdf04294b565d9e0319955430099ec3813a64c952b86a41200ad714ae48"
dependencies = [
"ansi_term 0.11.0",
"atty",
@@ -197,9 +197,9 @@ checksum = "0bca1619ff57dd7a56b58a8e25ef4199f123e78e503fe1653410350a1b98ae65"
[[package]]
name = "concurrent-queue"
version = "1.2.1"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39ff9c66992ebea984b9446b2a45b300947216c17544ec9d7f045afe24333cd0"
checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3"
dependencies = [
"cache-padded",
]
@@ -256,9 +256,9 @@ dependencies = [
[[package]]
name = "event-listener"
version = "2.3.0"
version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "298f00c3b04c1d9b4cb86aefaaa35348af0957d98b30a5306fc635f8e718923d"
checksum = "68082183f458867ce7cddea16d4df4443c1537112c0c09c450dedc09daf5c719"
[[package]]
name = "fastrand"
@@ -685,7 +685,7 @@ dependencies = [
[[package]]
name = "rustscan"
version = "1.6.0"
version = "1.7.1"
dependencies = [
"ansi_term 0.12.1",
"async-std",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "rustscan"
version = "1.6.0"
version = "1.7.1"
authors = ["Bee <[email protected]>"]
edition = "2018"
description = "Faster Nmap Scanning with Rust"
+2 -2
View File
@@ -29,7 +29,7 @@
<hr>
# 🤔 What is this?
1. Find ports quickly using Rustscan (**8 seconds at its fastest**).
1. Find ports quickly using Rustscan (**3 seconds at its fastest**).
2. Automatically runs `nmap` on those ports.
3. ???
4. Profit!
@@ -52,7 +52,7 @@
</tr>
</table>
<sub><b>Note</b> This is an older gif. RustScan's current top speed is 8 seconds for all 65k ports. This gif is 26 seconds.</sub><br>
<sub><b>Note</b> This is an older gif. RustScan's current top speed is 3 seconds for all 65k ports. This gif is 26 seconds.</sub><br>
RustScans **only** job is to reduce the friction between finding open ports and inputting them into nmap.
+26 -33
View File
@@ -111,36 +111,29 @@ fn main() {
// If we got here it means the IP was not found within the HashMap, this
// means the scan couldn't find any open ports for it.
if opts.quiet {
let x = format!("{} {:?}", "No ports found for", ip);
detail!(x);
} else {
let x = format!("{} Looks like I didn't find any open ports for {:?}. This is usually caused by a high batch size.
\n*I used {} batch size, consider lowering to {} with {} or a comfortable number for your system.
\n Alternatively, increase the timeout if your ping is high. Rustscan -T 2000 for 2000 second timeout.\n",
"ERROR",
ip,
opts.batch_size,
(opts.batch_size / 2).to_string(),
"'rustscan -b <batch_size> <ip address>'");
warning!(x);
}
let x = format!("{} Looks like I didn't find any open ports for {:?}. This is usually caused by a high batch size.
\n*I used {} batch size, consider lowering to {} with {} or a comfortable number for your system.
\n Alternatively, increase the timeout if your ping is high. Rustscan -T 2000 for 2000 second timeout.\n",
"ERROR",
ip,
opts.batch_size,
(opts.batch_size / 2).to_string(),
"'rustscan -b <batch_size> <ip address>'");
warning!(x, opts.quiet);
}
for (ip, ports) in ports_per_ip.iter_mut() {
let nmap_str_ports: Vec<String> = ports.into_iter().map(|port| port.to_string()).collect();
if !opts.quiet {
println!("\n");
detail!("Starting Nmap");
}
detail!("Starting Nmap", opts.quiet);
// nmap port style is 80,443. Comma separated with no spaces.
let ports_str = nmap_str_ports.join(",");
// if quiet mode is on nmap should not be spawned
if opts.quiet {
detail!(format!("Ports: {:?}", ports_str));
println!("{}", ports_str);
continue;
}
@@ -177,7 +170,8 @@ Faster Nmap scanning with Rust."#;
: https://discord.gg/GFrQsGy :
: https://github.com/RustScan/RustScan :
--------------------------------------"#;
println!("{}\n", info.gradient(Color::Red).bold());
println!("{}", info.gradient(Color::Yellow).bold());
funny_opening!();
let config_path = match dirs::config_dir() {
Some(mut path) => {
@@ -221,12 +215,10 @@ fn adjust_ulimit_size(opts: &Opts) -> rlimit::rlim {
match setrlimit(Resource::NOFILE, limit, limit) {
Ok(_) => {
if !opts.quiet {
detail!(format!(
"Automatically increasing ulimit value to {}.",
limit
));
}
detail!(
format!("Automatically increasing ulimit value to {}.", limit),
opts.quiet
);
}
Err(_) => println!("{}", "ERROR. Failed to set ulimit value."),
}
@@ -242,9 +234,12 @@ fn infer_batch_size(opts: &Opts, ulimit: rlimit::rlim) -> u16 {
// Adjust the batch size when the ulimit value is lower than the desired batch size
if ulimit < batch_size {
if !opts.quiet {
warning!("File limit is lower than default batch size. Consider upping with --ulimt. May cause harm to sensitive servers");
}
warning!(
"File limit is lower than default batch size.
Consider upping with --ulimt.
May cause harm to sensitive servers",
opts.quiet
);
// When the OS supports high file limits like 8000, but the user
// selected a batch size higher than this we should reduce it to
@@ -266,12 +261,10 @@ fn infer_batch_size(opts: &Opts, ulimit: rlimit::rlim) -> u16 {
// When the ulimit is higher than the batch size let the user know that the
// batch size can be increased unless they specified the ulimit themselves.
else if ulimit + 2 > batch_size && (opts.ulimit.is_none()) {
if !opts.quiet {
detail!(format!(
detail!(format!(
"File limit higher than batch size. Can increase speed by increasing batch size '-b {}'.",
ulimit - 100
));
}
), opts.quiet);
}
batch_size as u16
+38 -9
View File
@@ -1,35 +1,64 @@
/// Terminal User Interface Module for RustScan
/// Defines macros to use
// TODO make them work with formatted strings
#[macro_export]
macro_rules! warning {
($name:expr) => {
use ansi_term::Colour::Red;
if $name.len() > 200 {
panic!("Your warning is too long.")
}
println!("{} {}", Red.bold().paint("[!]"), $name);
};
// quiet mode
($name:expr, $quiet:expr) => {
use ansi_term::Colour::Red;
if !$quiet {
println!("{} {}", Red.bold().paint("[!]"), $name);
}
};
}
#[macro_export]
macro_rules! detail {
($name:expr) => {
use ansi_term::Colour::Blue;
if $name.len() > 200 {
panic!("Your detail is too long.")
}
println!("{} {}", Blue.bold().paint("[~]"), $name);
};
($name:expr, $quiet:expr) => {
use ansi_term::Colour::Blue;
if !$quiet {
println!("{} {}", Blue.bold().paint("[~]"), $name);
}
};
}
#[macro_export]
macro_rules! output {
($name:expr, $quiet:expr) => {
use ansi_term::Colour::RGB;
if !$quiet {
println!("{} {}", RGB(0, 255, 9).bold().paint("[>]"), $name);
}
};
($name:expr) => {
use ansi_term::Colour::RGB;
println!("{} {}", RGB(0, 255, 9).bold().paint("[>]"), $name);
};
}
#[macro_export]
macro_rules! funny_opening {
// prints a funny quote / opening
() => {
use rand::seq::SliceRandom;
let quotes = vec![
"Nmap? More like slowmap.🐢",
"🌍HACK THE PLANET🌍",
"Real hackers hack time ⌛",
"Please contribute more quotes to our GitHub https://github.com/rustscan/rustscan",
"😵 https://admin.tryhackme.com",
];
let random_quote = quotes.choose(&mut rand::thread_rng()).unwrap();
println!("{}\n", random_quote);
// println!("{} {}", RGB(0, 255, 9).bold().paint("[>]"), $name);
};
}