Crates.io | honeypot_blacklist |
lib.rs | honeypot_blacklist |
version | 0.1.2 |
source | src |
created_at | 2016-10-15 20:08:45.769388 |
updated_at | 2017-08-02 14:52:22.704919 |
description | Provides a client for Project Honeypot http:BL API |
homepage | |
repository | https://github.com/wisespace-io/honeypot-blacklist |
max_upload_size | |
id | 6862 |
size | 9,227 |
Rust library for querying Project Honeypot Blacklist (Http:BL)
Available on crates.io
Add this to your Cargo.toml
[dependencies]
honeypot_blacklist = "0.1"
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"),
}
}