Skip to content

Commit

Permalink
Release v1.2 (#9)
Browse files Browse the repository at this point in the history
Release v1.2
  • Loading branch information
phra committed May 25, 2019
2 parents b73a75e + c973da5 commit 084b58a
Show file tree
Hide file tree
Showing 14 changed files with 251 additions and 118 deletions.
13 changes: 12 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rustbuster"
version = "1.1.0"
version = "1.2.0"
authors = ["phra <greensoncio@gmail.com>", "ps1dr3x <michele@federici.tech>"]
edition = "2018"

Expand All @@ -13,10 +13,11 @@ hyper-tls = "^0.3.2"
native-tls = "^0.2.3"
serde = { version = "^1.0.91", features = ["derive"] }
serde_json = "^1.0.39"
indicatif = "0.11.0"
chrono = "0.4.6"
indicatif = "^0.11.0"
chrono = "^0.4.6"
terminal_size = "^0.1.8"

[dependencies.clap]
version = "2.33"
version = "^2.33"
default-features = false
features = [ "suggestions", "color" ]
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ DirBuster for Rust

## Usage

There are three modules currently implemented:

1. Dirbuster (default)
`rustbuster -m dir -u http://localhost:3000/ -w examples/wordlist -e php`

1. Dnsbuster
`rustbuster -m dns -u google.com -w examples/wordlist`

1. Vhostbuster
`rustbuster -m vhost -u http://localhost:3000/ -w examples/wordlist -d test.local -x "Hello"`

```shell

_ _ _ _ _ _ _ _ _ _
Expand All @@ -20,7 +31,7 @@ DirBuster for Rust
/ / / \ \ \/ / /____\/ /\ \/___/ / /_/ / / / /__________/ / /____\/ /\ \/___/ / /_/ / / / /_______/ / / \ \ \
\/_/ \_\/\/_________/ \_____\/ \_\/ \/_____________\/_________/ \_____\/ \_\/ \/__________\/_/ \_\/

~ rustbuster v. 1.0.0 ~ by phra & ps1dr3x ~
~ rustbuster v. 1.2.0 ~ by phra & ps1dr3x ~

USAGE:
rustbuster [FLAGS] [OPTIONS] --url <url> --wordlist <wordlist>
Expand All @@ -36,18 +47,19 @@ FLAGS:
-v, --verbose Sets the level of verbosity

OPTIONS:
-d, --domain <domain> Uses the specified domain
-e, --extensions <extensions> Sets the extensions [default: ]
-b, --http-body <http-body> Uses the specified HTTP method [default: ]
-H, --http-header <http-header>... Appends the specified HTTP header
-X, --http-method <http-method> Uses the specified HTTP method [default: GET]
-S, --ignore-status-codes <ignore-status-codes> Sets the list of status codes to ignore [default: 404]
-x, --ignore-string <ignore-string>... Ignores results with specified string in vhost mode
-s, --include-status-codes <include-status-codes> Sets the list of status codes to include [default: ]
-m, --mode <mode> Sets the mode of operation (dir, dns, vhost) [default: dir]
-m, --mode <mode> Sets the mode of operation (dir, dns, fuzz) [default: dir]
-o, --output <output> Saves the results in the specified file [default: ]
-t, --threads <threads> Sets the amount of concurrent requests [default: 10]
-u, --url <url> Sets the target URL
-a, --user-agent <user-agent> Uses the specified User-Agent [default: rustbuster]
-w, --wordlist <wordlist> Sets the wordlist


```
2 changes: 2 additions & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
package-lock.json
18 changes: 18 additions & 0 deletions examples/vhosts-server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var express = require("express");
var app = express();

var DEFAULT = "Hello World!";
var vhosts = ["1.test.local", "10.test.local", "15.test.local"];

app.all("/*", function (req, res) {
if (vhosts.some(x => x === req.hostname)) {
return res.send(req.hostname);
}

res.send("Hello World!");
});

app.listen(3000, function () {
console.log("Example app listening on port 3000!");
});

3 changes: 3 additions & 0 deletions examples/wordlist
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@
19
20
www
src
target
LICENSE
11 changes: 9 additions & 2 deletions src/banner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@ pub fn generate() -> String {
/ / / \\ \\ \\/ / /____\\/ /\\ \\/___/ / /_/ / / / /__________/ / /____\\/ /\\ \\/___/ / /_/ / / / /_______/ / / \\ \\ \\
\\/_/ \\_\\/\\/_________/ \\_____\\/ \\_\\/ \\/_____________\\/_________/ \\_____\\/ \\_\\/ \\/__________\\/_/ \\_\\/
~ rustbuster v. {} ~ by phra & ps1dr3x ~
", VERSION)
")
}

pub fn copyright() -> String {
format!(
"~ rustbuster v{} ~ by phra & ps1dr3x ~
",
VERSION
)
}

pub fn configuration(mode: &str, url: &str, threads: &str, wordlist: &str) -> String {
Expand Down
12 changes: 10 additions & 2 deletions src/dirbuster/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ fn make_request_future(
request_builder.header(header_tuple.0.as_str(), header_tuple.1.as_str());
}

let request = request_builder.header("User-Agent", &config.user_agent[..])
let request = request_builder
.header("User-Agent", &config.user_agent[..])
.method(&config.http_method[..])
.uri(&url)
.header("Host", url.host().unwrap())
Expand All @@ -57,7 +58,14 @@ fn make_request_future(
let status = res.status();
target.status = status.to_string();
if status.is_redirection() {
target.extra = Some(res.headers().get("Location").unwrap().to_str().unwrap().to_owned());
target.extra = Some(
res.headers()
.get("Location")
.unwrap()
.to_str()
.unwrap()
.to_owned(),
);
}

tx.send(target).unwrap();
Expand Down
10 changes: 4 additions & 6 deletions src/dirbuster/utils.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use std::{
fs, fs::File, path::Path, str,
io::Write
};
use std::{fs, fs::File, io::Write, path::Path, str};

use super::result_processor::SingleDirScanResult;

Expand All @@ -13,7 +10,8 @@ pub fn build_urls(
) -> Vec<hyper::Uri> {
debug!("building urls");
let mut urls: Vec<hyper::Uri> = Vec::new();
let wordlist = fs::read_to_string(wordlist_path).expect("Something went wrong reading the wordlist file");
let wordlist =
fs::read_to_string(wordlist_path).expect("Something went wrong reading the wordlist file");
let urls_iter = wordlist
.lines()
.filter(|word| !word.starts_with('#') && !word.starts_with(' '))
Expand Down Expand Up @@ -94,6 +92,6 @@ pub fn save_dir_results(path: &str, results: &Vec<SingleDirScanResult>) {
pub fn split_http_headers(header: &str) -> (String, String) {
let index = header.find(':').unwrap_or(0);
let header_name = header[..index].to_owned();
let header_value = header[index+2..].to_owned();
let header_value = header[index + 2..].to_owned();
(header_name, header_value)
}
6 changes: 3 additions & 3 deletions src/dnsbuster/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use futures::{future, Future, Stream};
use hyper::rt;

use std::{sync::mpsc::Sender, net::ToSocketAddrs};
use std::{net::ToSocketAddrs, sync::mpsc::Sender};

pub mod result_processor;
pub mod utils;
Expand All @@ -10,12 +10,12 @@ use result_processor::SingleDnsScanResult;

#[derive(Debug, Clone)]
pub struct DnsConfig {
pub n_threads: usize
pub n_threads: usize,
}

fn make_request_future(
tx: Sender<SingleDnsScanResult>,
domain: String
domain: String,
) -> impl Future<Item = (), Error = ()> {
future::lazy(move || {
match domain.to_socket_addrs() {
Expand Down
5 changes: 3 additions & 2 deletions src/dnsbuster/utils.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use std::{fs, path, io::Write};
use std::{fs, io::Write, path};

use super::result_processor::SingleDnsScanResult;

pub fn build_domains(wordlist_path: &str, url: &str) -> Vec<String> {
debug!("building urls");
fs::read_to_string(wordlist_path).expect("Something went wrong reading the wordlist file")
fs::read_to_string(wordlist_path)
.expect("Something went wrong reading the wordlist file")
.lines()
.filter(|word| !word.starts_with('#') && !word.starts_with(' '))
.map(|word| format!("{}.{}:80", word, url))
Expand Down

0 comments on commit 084b58a

Please sign in to comment.