aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2018-03-14 10:53:01 +0100
committerHarald Eilertsen <haraldei@anduin.net>2018-03-14 10:53:01 +0100
commit1ce10e19a2b07322e49f885efc4115e0ded8f459 (patch)
tree57fb5b77daec8ef5c8f4a5c01ab4de7f04781a87
parenta354ed36145e85bb53c14ec033c10d5d90bf04ae (diff)
downloadcheckpw-1ce10e19a2b07322e49f885efc4115e0ded8f459.tar.gz
checkpw-1ce10e19a2b07322e49f885efc4115e0ded8f459.tar.bz2
checkpw-1ce10e19a2b07322e49f885efc4115e0ded8f459.zip
Report number of breaches password is found in.
-rw-r--r--src/main.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 99443a2..ffe811e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -96,6 +96,10 @@ fn check(pw: Password) -> Result<(), Box<::std::error::Error>> {
let hashes = std::str::from_utf8(&body)?;
if let Some(pos) = hashes.find(&pw.rest) {
println!("Password is PWNED!");
+ if let Some(res) = hashes[pos..].lines().take(1).collect::<Vec<_>>().pop() {
+ let count = res.split(':').skip(1).collect::<Vec<_>>().pop().unwrap();
+ println!("The password {} was found in {} breaches", pw.pw, count);
+ }
}
Ok(())
})