2 releases
Uses old Rust 2015
0.1.2 | Apr 26, 2017 |
---|---|
0.1.0 | Oct 15, 2016 |
#3 in #honeypot
8KB
138 lines
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"),
}
}
Dependencies
~9.5MB
~162K SLoC