diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2018-04-04 17:10:00 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2018-04-05 11:32:01 +0200 |
commit | 05c226955e58433b2e27ebedd8b12bef9e4101ad (patch) | |
tree | 6f7245a4b9adf34faf3d6ca7196618dc16a24f97 /src | |
parent | 12e4c2ffd92329c965f12064bbfa3de0fc82d750 (diff) | |
download | checkpw-05c226955e58433b2e27ebedd8b12bef9e4101ad.tar.gz checkpw-05c226955e58433b2e27ebedd8b12bef9e4101ad.tar.bz2 checkpw-05c226955e58433b2e27ebedd8b12bef9e4101ad.zip |
Return number of pwned passwords as exit code.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index 48b8e4c..7fe7e93 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,7 +16,7 @@ extern crate reqwest; extern crate ring; -use std::{env, thread, time}; +use std::{env, thread, time, process}; use std::error::Error; use ring::digest; @@ -132,6 +132,7 @@ fn main() { } let mut first_round = true; + let mut pwn_count = 0; for pw in passwords { if first_round { @@ -146,6 +147,7 @@ fn main() { Ok(num) => { if num > 0 { println!("Password is PWNED! It was found in {} breaches.", num); + pwn_count += 1; } else { println!("Password was not found in any breaches"); @@ -153,4 +155,6 @@ fn main() { } } } + + process::exit(pwn_count); } |