C# Class Google.SafeBrowsing.API

Google Safe Browsing API v2. Does not support MAC authentication. REKEY not supported. Only supports 32bit key sizes. http://code.google.com/intl/cs-CZ/apis/safebrowsing/developers_guide_v2.html
Show file Open project: OndrejStastny/Google-Safe-Browsing-API-2.0-C- Class Usage Examples

Public Methods

Method Description
API ( string apiKey ) : System
GenerateCombinations ( CanonicalURL url ) : IEnumerable

Generate valid url combinations that have to be checked againts the database

GetChunkData ( string chunkURL, string listName ) : IEnumerable

This is used by clients who want to get new data for known list types. Step 2/2 - called for each Chunk redirect. Download chunk content.

GetFullHashes ( CanonicalURL targetURL ) : IEnumerable

A client may request the list of full-length hashes for a hash prefix. This usually occurs when a client is about to download content from a url whose calculated hash starts with a prefix listed in a blacklist.

GetListData ( string list, IEnumerable whilelist, IEnumerable blacklist ) : ListData

This is used by clients who want to get new data for known list types. Step 1/2. Get chunk URLs redirects for ALL chunks Only supports data for one list at the time (which is not a problem for our implementation since we always only request from one list)

GetLists ( ) : IEnumerable

This is used by clients to discover the available list types.

Private Methods

Method Description
ComputeHash ( CanonicalURL url ) : byte[]
DecodeNumber ( byte buffer, int startPosition, int &endPosition ) : Int32
IsIpAddress ( string hostname ) : bool
ParseChunkData ( Stream stream, string listName ) : IEnumerable
ParseFullHashes ( Stream stream ) : IEnumerable
ParseIntervals ( string input ) : IEnumerable
ParseListData ( Stream stream ) : ListData
PrintIntervals ( IEnumerable list, string listName ) : string
ReadNumber ( byte buffer, int startPosition, int &endPosition ) : Int32
SplitHost ( string url ) : IEnumerable
SplitPath ( string url ) : IEnumerable

Method Details

API() public method

public API ( string apiKey ) : System
apiKey string
return System

GenerateCombinations() public method

Generate valid url combinations that have to be checked againts the database
public GenerateCombinations ( CanonicalURL url ) : IEnumerable
url CanonicalURL Canonical URL
return IEnumerable

GetChunkData() public method

This is used by clients who want to get new data for known list types. Step 2/2 - called for each Chunk redirect. Download chunk content.
public GetChunkData ( string chunkURL, string listName ) : IEnumerable
chunkURL string URL returned from GetListData
listName string
return IEnumerable

GetFullHashes() public method

A client may request the list of full-length hashes for a hash prefix. This usually occurs when a client is about to download content from a url whose calculated hash starts with a prefix listed in a blacklist.
public GetFullHashes ( CanonicalURL targetURL ) : IEnumerable
targetURL CanonicalURL
return IEnumerable

GetListData() public method

This is used by clients who want to get new data for known list types. Step 1/2. Get chunk URLs redirects for ALL chunks Only supports data for one list at the time (which is not a problem for our implementation since we always only request from one list)
public GetListData ( string list, IEnumerable whilelist, IEnumerable blacklist ) : ListData
list string list name
whilelist IEnumerable
blacklist IEnumerable all blacklist chunks already available localy
return ListData

GetLists() public method

This is used by clients to discover the available list types.
public GetLists ( ) : IEnumerable
return IEnumerable