-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a08955f
commit 1f0b479
Showing
6 changed files
with
74 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "abrute" | ||
version = "0.1.7" | ||
version = "0.1.8" | ||
authors = ["Daniel P. Clark <[email protected]>"] | ||
description = "AESCrypt Brute force attempter." | ||
documentation = "http:https://danielpclark.github.io/abrute/index.html" | ||
|
@@ -21,3 +21,4 @@ num_cpus = "~1.7" | |
serde = "1.0.24" | ||
serde_json = "1.0.8" | ||
tiny_http = "~0.5" | ||
lazy_static = "1.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
use ::{Digits,ITERATIONS}; | ||
use std::collections::HashMap; | ||
use std::sync::Mutex; | ||
use std::sync::atomic::Ordering; | ||
use std::time::Instant; | ||
use std::io; | ||
use std::io::Write; | ||
|
||
lazy_static! { | ||
// len => Iterations, Iteration Start, Start Instant (for Duration) | ||
static ref HASHMAP: Mutex<HashMap<u8, (u64, u64, Instant)>> = { | ||
let m = HashMap::new(); | ||
Mutex::new(m) | ||
}; | ||
} | ||
|
||
pub fn report(data: &Digits) { | ||
let len = data.length() as i32; | ||
let mut hm = HASHMAP.lock().unwrap(); | ||
if hm.is_empty() { | ||
println!("Benchmark Results\nAttempt :: Category of Range:Iterations, Rating in IPS"); | ||
hm.insert(len as u8, (0, 0, Instant::now())); | ||
} | ||
|
||
let reader = hm.clone(); | ||
|
||
if hm.contains_key(&(len as u8)) { | ||
let entry = hm.get_mut(&(len as u8)).unwrap(); | ||
let &mut (_, start, duration) = entry; | ||
|
||
let iterated = ITERATIONS.load(Ordering::SeqCst) - start.clone() as usize; | ||
|
||
let min = reader.keys().min().unwrap(); | ||
let max = reader.keys().max().unwrap(); | ||
let start_instant = reader.get(min).unwrap().2; | ||
let seconds = Instant::now().duration_since(start_instant).as_secs(); | ||
let ips = if seconds == 0 { 0 } else { iterated/seconds as usize }; | ||
print!("\x1b[1000D{} :: Category: {}->{}:{}, Rating: {} IPS", data.to_s(), min, max, iterated, ips); | ||
|
||
*entry = (iterated as u64, start.clone(), duration.clone()); | ||
} else { | ||
// New Entry | ||
let previous = len - 1; | ||
let has_previous = hm.contains_key(&(previous as u8)); | ||
let start_iteration = if has_previous { hm.get(&(previous as u8)).unwrap().0 } else { 0 }; | ||
|
||
let iters = ITERATIONS.load(Ordering::SeqCst); | ||
let instant = Instant::now(); | ||
|
||
hm.insert(len as u8, (start_iteration, iters as u64, instant)); | ||
|
||
if has_previous { | ||
let start_iters = if hm.contains_key(&((previous - 1) as u8)) { hm.get(&((previous - 1) as u8)).unwrap().0 } else { 0 }; | ||
let iterations = iters - (start_iters as usize); | ||
let start = hm.get(&(previous as u8)).unwrap().2; | ||
let seconds = Instant::now().duration_since(start).as_secs(); | ||
let ips = if seconds == 0 { 0 } else { iterations/(seconds as usize) }; | ||
println!("\nRange: {}, Iterations: {}, Rating: {} IPS", previous, iterations, ips); | ||
} | ||
} | ||
io::stdout().flush().unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod ticker_tape; | ||
pub mod spinner; | ||
pub mod benchmark; |