aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2018-04-04 17:10:00 +0200
committerHarald Eilertsen <haraldei@anduin.net>2018-04-05 11:32:01 +0200
commit05c226955e58433b2e27ebedd8b12bef9e4101ad (patch)
tree6f7245a4b9adf34faf3d6ca7196618dc16a24f97 /src
parent12e4c2ffd92329c965f12064bbfa3de0fc82d750 (diff)
downloadcheckpw-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.rs6
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);
}