From 1ce10e19a2b07322e49f885efc4115e0ded8f459 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Wed, 14 Mar 2018 10:53:01 +0100 Subject: Report number of breaches password is found in. --- src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') 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::>().pop() { + let count = res.split(':').skip(1).collect::>().pop().unwrap(); + println!("The password {} was found in {} breaches", pw.pw, count); + } } Ok(()) }) -- cgit v1.2.3