aboutsummaryrefslogblamecommitdiffstats
path: root/src/main.rs
blob: 17f443bce851c5ef012875449a26137415b964ca (plain) (tree)































                                                                                                   


                                                                         
 






                                                                                 
 
// A program to scan emails for phishing links.
// Copyright (C) 2019  Harald Eilertsen
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.

use phisher;
use clap::{clap_app, crate_name, crate_authors, crate_version, crate_description};
use std::fs::File;
use std::io::BufReader;
use std::time::SystemTime;

fn main() {
    let args = clap_app!(app =>
        (name: crate_name!())
        (version: crate_version!())
        (author: crate_authors!())
        (about: crate_description!())
        (@arg PHISHTANK: --phishtank +required +takes_value "The phishtank json data file to use.")
    ).get_matches();

    let start_time = SystemTime::now();
    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());
    }
    else {
        eprintln!("Could not open file {}.\nIs the filename correct?", filename);
    }
}