An open API service indexing awesome lists of open source software.

https://github.com/marirs/phishtank-rs

Phishtank API
https://github.com/marirs/phishtank-rs

phishtank phishtank-api rust rust-crate rust-lang rust-library

Last synced: 8 months ago
JSON representation

Phishtank API

Awesome Lists containing this project

README

          

# Phishtank API
![Crates.io](https://img.shields.io/crates/v/phishtank)
![docs.rs](https://img.shields.io/docsrs/phishtank/latest)
[![Build Status](https://travis-ci.com/marirs/phishtank-rs.svg?branch=master)](https://travis-ci.com/marirs/phishtank-rs)

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

## Usage
```toml
[dependencies]
phishtank = "0.1.0"
```
and then
```rust
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 `
- To check url in phishtank database: `cargo run --example lookup `

## Developer reference

- https://www.phishtank.com/developer_info.php

---
License: MIT