diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2019-05-07 22:55:08 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2019-05-07 22:55:08 +0200 |
commit | d1fdebb68c2818b224b092d4c265394f3fbdcb5d (patch) | |
tree | 783244d8eceeb7aceceb6a3c2a957e49b8e4ab19 | |
parent | 268df91e3ced5ca92e21c83021d6b431190656a6 (diff) | |
download | phisher-d1fdebb68c2818b224b092d4c265394f3fbdcb5d.tar.gz phisher-d1fdebb68c2818b224b092d4c265394f3fbdcb5d.tar.bz2 phisher-d1fdebb68c2818b224b092d4c265394f3fbdcb5d.zip |
Handle missing phishtank file.
-rw-r--r-- | src/main.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index 4e3076b..17f443b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,10 +30,15 @@ fn main() { ).get_matches(); let start_time = SystemTime::now(); - let r = BufReader::new(File::open(args.value_of("PHISHTANK").unwrap()).unwrap()); - let tank = phisher::load_phistank(r).unwrap(); + let filename = args.value_of("PHISHTANK").unwrap(); + if let Ok(file) = File::open(filename) { + let tank = phisher::load_phistank(BufReader::new(file)).unwrap(); - println!("Loaded {} phishes in {} seconds!", - tank.phishes.len(), - start_time.elapsed().unwrap().as_secs()); + println!("Loaded {} phishes in {} seconds!", + tank.phishes.len(), + start_time.elapsed().unwrap().as_secs()); + } + else { + eprintln!("Could not open file {}.\nIs the filename correct?", filename); + } } |