NAME
Net::Google::SafeBrowsing2::DBI - Base class for all DBI-based back-end storage for the Google Safe Browsing v2 database
SYNOPSIS
Net::Google::SafeBrowsing2::DBI cannot be used directly. Instead, use a class inheriting Net::Google::SafeBrowsing2::DBI, like Net::Google::SafeBrowsing2::MySQL.
use Net::Google::SafeBrowsing2::MySQL;
my $storage = Net::Google::SafeBrowsing2::MySQL->new(host => '127.0.0.1', database => 'GoogleSafeBrowsingv2');
...
$storage->close();
DESCRIPTION
This is a base implementation of Net::Google::SafeBrowsing2::Storage using DBI.
CONSTRUCTOR
new()
This method should be overwritten.
Arguments
- keep_all
-
Optional. Set to 1 to keep old information (such as expiring full hashes) in the database. 0 (delete) by default.
PUBLIC FUNCTIONS
See Net::Google::SafeBrowsing2::Storage for a complete list of public functions.
close()
Cleanup old full hashes, and close the connection to the database.
$storage->close();
export()
Export add chunks and sub chunks to a file. The file content looks like what Google sends in redirections. The file can be used with the import_chunks
function from Net::Google::SafeBrowsing2
. This is useful when moving from one back-end storage to another
$storage->export(list => MALWARE);
Arguments
- list
-
Required. The Google Safe Browsing list to export.
- file
-
Optional. Filename to export to. Uses "$list.dat" by default.
CHANGELOG
- 0.7.1
-
Fix for empty sub chunks.
- 0.7
-
New
export()
function.Keep empty sub chunks.
Fix index for sub chunks.
- 0.6
-
Add option keep_all to keep expired full hashes. Useful for debugging.
- 0.5
-
Return the hostkey in get_add_chunks.
- 0.4
-
Fix duplicate insert of add chunks and sub chunks.
- 0.3
-
Add reset function to reset all tables for a given list
- 0.2
-
Replace "INSERT OR REPLACE" statements by DELETE + INSERT to work with all databases
SEE ALSO
See Net::Google::SafeBrowsing2 for handling Google Safe Browsing v2.
See Net::Google::SafeBrowsing2::Storage for the list of public functions.
See Net::Google::SafeBrowsing2::Sqlite for a back-end using Sqlite.
Google Safe Browsing v2 API: http://code.google.com/apis/safebrowsing/developers_guide_v2.html
AUTHOR
Julien Sobrier, <jsobrier@zscaler.com> or <julien@sobrier.net>
COPYRIGHT AND LICENSE
Copyright (C) 2015 by Julien Sobrier
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.