Delete sha1_cracker directory
This commit is contained in:
parent
9cf7f7d3e5
commit
0ad143081f
@ -1,10 +0,0 @@
|
||||
[package]
|
||||
name = "sha1_cracker"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
sha-1 = "0.10"
|
||||
hex = "0.4"
|
@ -1,40 +0,0 @@
|
||||
use sha1::Digest;
|
||||
use std::{
|
||||
env,
|
||||
error::Error,
|
||||
fs::File,
|
||||
io::{BufRead, BufReader},
|
||||
};
|
||||
|
||||
const SHA1_HEX_STRING_LENGTH: usize = 40;
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
|
||||
if args.len() != 3{
|
||||
println!("Usage:");
|
||||
println!("sha1_cracker: <wordlist.txt> <sha1_hash>");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let hash_to_crack = args[2].trim();
|
||||
if hash_to_crack.len() != SHA1_HEX_STRING_LENGTH {
|
||||
return Err("sha1 hash is not valid".into());
|
||||
}
|
||||
|
||||
let wordlist_file = File::open(&args[1])?;
|
||||
let reader = BufReader::new(&wordlist_file);
|
||||
|
||||
for line in reader.lines() {
|
||||
let line = line?;
|
||||
let common_password = line.trim();
|
||||
if hash_to_crack == &hex::encode(sha1::Sha1::digest(common_password.as_bytes())) {
|
||||
println!("Password found: {}", &common_password);
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
println!("password not found in wordlist :(");
|
||||
|
||||
Ok(())
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user