phishtank

Crates.iophishtank
lib.rsphishtank
version0.1.0
sourcesrc
created_at2021-06-20 16:20:49.962701
updated_at2021-06-20 16:27:58.50056
descriptionPhishtank API
homepage
repositoryhttps://github.com/marirs/phishtank-rs
max_upload_size
id412502
size38,594
SG (marirs)

documentation

README

Phishtank API

Crates.io docs.rs Build Status

Phishtank API gives access to phishtank to download the phishtank database or lookup for a url in phishtank database.

Usage

[dependencies]
phishtank = "0.1.0"

and then

use phishtank::PhishtankClient;

// Download the Phishtank Database
fn main() {
    let api_key = match std::env::args().nth(1).ok_or("Please provide the api key!") {
        Ok(api_key) => api_key,
        Err(e) => {
            println!("{:?}", e);
            std::process::exit(1)
        }
    };

    let limit = 5;
    let res = PhishtankClient::new(&api_key)
        .user_agent("phishtank/[username]")
        .download_db();
    
    match res {
        Ok(data) => {
            for d in data.iter().take(limit) {
                println!("{:#?}", d)
            }
            println!("Showing {} out of {}", limit, data.len())
        }
        Err(e) => println!("Error: {:?}", e.to_string()),
    }
}

Examples

  • To download the database: cargo run --example get_database <your api key>

Developer reference


License: MIT

Commit count: 10

cargo fmt