GoogleSB-0.1: Interface to Google Safe Browsing API



This module provides support for Google Safe Browsing API ( To use this module you need to obtain access key from project's page.

Typical use of this module will look like:

  Right mhsh <- updateHash your_key makeEmptyMalwareHash
  checkURL mhsh ""
  checkURL mhsh ...

It's better to save hashes between runs to avoid of full updates every time. So at the end of program it's better to store hash on disk with following code:

  saveHash "malware.dat" mhsh

And during startup, load it from file, if it exists on disk:

  Right mhsh <- load Hash "malware.dat"



data Hash Source

Data structure to store data about Hash. It contains information about version, name of hash, and actual Hash data




:: String

Access key for Google SB. See module description

-> Hash

Hash to update. Use makeEmptyBlackHash or makeEmptyMalwareHash for first update

-> IO (Either String Hash)

Result of update: 'Left String' if error happens (String contains error message), or 'Right Hash' on success

Performs update of Hash from server. For first update, you need to provide hash created by makeEmptyBlackHash or makeEmptyMalwareHash. And for later updates, you will use existing hashes to get only updates to hashes, not the full database.



:: FilePath

File from which Hash will loaded

-> IO (Either String Hash)

Result of loading: 'Left String' if error happens (String contains error message), or 'Right Hash' on success

Loads Hash from given file



:: FilePath

File in which Hash will stored

-> Hash

Hash to store

-> IO () 

Saves Hash into given file



:: Hash

Hash to check against

-> String

URL to check

-> Bool

True, if URL exists in database, False - otherwise

Performs checking of presence of given URL (second argument of function) in the Hash (first argument).

makeEmptyBlackHash :: HashSource

Creates empty black Hash object

makeEmptyMalwareHash :: HashSource

Creates empty malware Hash object