honeypot_blacklist

Crates.iohoneypot_blacklist
lib.rshoneypot_blacklist
version0.1.2
sourcesrc
created_at2016-10-15 20:08:45.769388
updated_at2017-08-02 14:52:22.704919
descriptionProvides a client for Project Honeypot http:BL API
homepage
repositoryhttps://github.com/wisespace-io/honeypot-blacklist
max_upload_size
id6862
size9,227
Flávio Oliveira (wisespace-io)

documentation

README

License

honeypot-blacklist

Rust library for querying Project Honeypot Blacklist (Http:BL)

Usage

Available on crates.io

Add this to your Cargo.toml

[dependencies]
honeypot_blacklist = "0.1"

Example

Simulate different Types.

extern crate honeypot_blacklist;

use honeypot_blacklist::{HoneypotBlacklist, Visitor, VisitorClass};

fn main() {
    let key = "YOUR_KEY";
    let bl = HoneypotBlacklist::new(key.into());

    let search_engine_altavista = bl.lookup("127.1.1.0".into()).unwrap();
    print_result(search_engine_altavista);

    let suspicious = bl.lookup("127.1.1.1".into()).unwrap();
    print_result(suspicious);

    let harvester = bl.lookup("127.1.1.2".into()).unwrap();
    print_result(harvester);

    let comment_spammer = bl.lookup("127.1.1.3".into()).unwrap();
    print_result(comment_spammer);
}

fn print_result(visitor: Visitor) {
    match visitor.class {
        VisitorClass::SearchEngine { name } => println!("It is just a search engine: {}", name),
        VisitorClass::Suspicious => println!("It may be a malicous Robot, not confirmed yet"),
        VisitorClass::Harvester => println!("Harvester IP"),
        VisitorClass::CommentSpammer => println!("Comment Spammer IP"),
        _ => println!("Not found"),
    }
}
Commit count: 8

cargo fmt