diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2019-05-08 18:23:29 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2019-05-08 18:30:46 +0200 |
commit | bb7eb2da2918dcfdb9b5d672b4165449230c5532 (patch) | |
tree | dcc2de852e03796c90a01899a111dd2cd206d109 /src/lib.rs | |
parent | 5c258209dc3f0c175d6338a3c658d7a8e01aedc0 (diff) | |
download | phisher-bb7eb2da2918dcfdb9b5d672b4165449230c5532.tar.gz phisher-bb7eb2da2918dcfdb9b5d672b4165449230c5532.tar.bz2 phisher-bb7eb2da2918dcfdb9b5d672b4165449230c5532.zip |
Create a unix socket server to check URLs.
Set up a simple unix domain socket server to handle requests to check
if URLs are phishes or not.
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -22,7 +22,6 @@ use std::net::IpAddr; use std::result::Result; use std::str::FromStr; -#[derive(Deserialize)] pub struct PhishTank { pub phishes: Vec<Phish>, } @@ -60,6 +59,13 @@ pub fn load_phistank<R: BufRead>(input: R) -> Result<PhishTank, io::Error> { Ok(PhishTank { phishes }) } + +impl PhishTank { + pub fn is_phish(&self, url: &str) -> bool { + self.phishes.iter().find(|phish| phish.url == url).is_some() + } +} + // Helper function to deserialize a number represented as a string. // // The PhishTank dataset represents numbers this way, so the default |