Remove itertools and removal of duplicated password entries

Password files need to be preprocessed to remove duplicated values for now.
master
trivernis 4 years ago
parent 52378b753d
commit 813ac09607

10
Cargo.lock generated

@ -194,7 +194,6 @@ dependencies = [
"base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfb-mode 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "cfb-mode 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"des 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "des 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"pbr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "pbr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -276,14 +275,6 @@ dependencies = [
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "itertools"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.4.0" version = "1.4.0"
@ -764,7 +755,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" "checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
"checksum hermit-abi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "e2c55f143919fbc0bc77e427fe2d74cf23786d7c1875666f2fde3ac3c659bb67" "checksum hermit-abi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "e2c55f143919fbc0bc77e427fe2d74cf23786d7c1875666f2fde3ac3c659bb67"
"checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" "checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
"checksum memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "75189eb85871ea5c2e2c15abbdd541185f63b408415e5051f5cac122d8c774b9" "checksum memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "75189eb85871ea5c2e2c15abbdd541185f63b408415e5051f5cac122d8c774b9"

@ -15,6 +15,5 @@ sha2 = "0.8.1"
rpassword = "4.0.5" rpassword = "4.0.5"
base64 = "0.11.0" base64 = "0.11.0"
rayon = "1.3.0" rayon = "1.3.0"
itertools = "0.8.2"
pbr = "1.0.2" pbr = "1.0.2"
spinners = "1.2.0" spinners = "1.2.0"

@ -14,7 +14,7 @@ pub fn create_key(pw: String) -> Vec<u8> {
} }
/// Maps a list of passwords to keys and returns a vector of pairs /// Maps a list of passwords to keys and returns a vector of pairs
pub fn map_to_keys(passwords: Vec<&String>) -> Vec<PassKey> { pub fn map_to_keys(passwords: Vec<String>) -> Vec<PassKey> {
passwords passwords
.par_iter() .par_iter()
.map(|pw| { .map(|pw| {

@ -4,7 +4,6 @@ use crate::lib::crypt::{
decrypt_brute_brute_force, decrypt_data, decrypt_with_dictionary, encrypt_data, decrypt_brute_brute_force, decrypt_data, decrypt_with_dictionary, encrypt_data,
}; };
use crate::lib::hash::{create_key, map_to_keys, sha_checksum, PassKey}; use crate::lib::hash::{create_key, map_to_keys, sha_checksum, PassKey};
use itertools::Itertools;
use pbr::ProgressBar; use pbr::ProgressBar;
use rayon::prelude::*; use rayon::prelude::*;
use rpassword; use rpassword;
@ -174,9 +173,8 @@ fn create_dictionary(_opts: &Opts, args: &CreateDictionary) {
let sp = spinner("Parsing passwords..."); let sp = spinner("Parsing passwords...");
let dictionary: Vec<PassKey>; let dictionary: Vec<PassKey>;
{ {
let pws = get_lines(&input); let passwords = get_lines(&input);
sp.message("Removing duplicates".into()); // TODO: Some form of removing duplicates (without itertools)
let passwords = pws.iter().unique().collect_vec();
sp.message("Mapping passwords to keys".into()); sp.message("Mapping passwords to keys".into());
dictionary = map_to_keys(passwords); dictionary = map_to_keys(passwords);
} }

Loading…
Cancel
Save