Zscalerのブログ

Zscalerの最新ブログ情報を受信

Security Research

Perl Library for Google Safe Browsing V2

image
JULIEN SOBRIER
October 26, 2010 - 2 分で読了

Google offers URL denylists to identify malicious websites and phishing sites through the Google Safe Browsing API. It is used in pretty much all browsers (Firefox, Safari, etc.), except Internet Explorer. Version 2 has been available for a few months, but there are only 2 implementations thus far: Python (from Google) and PHP.

Version 1 and 2 are supposed to provide the same coverage, but I've found that Google Safe Browsing v2 lists are updated much more frequently than v1. Since I'm using the API for several of my Perl projects, I wanted to get up to date information from Google. Until now, there was a Perl implementation for v1 only.

Net::Google::SafeBrowsing2, which I've developed, is the first implementation of the Google Safe Browsing v2 API for Perl and I've made it available in CPAN.

Here is a quick example on how to use it:
 

  use Net::Google::SafeBrowsing2;
  use Net::Google::SafeBrowsing2::Sqlite;
  
  my $storage = Net::Google::SafeBrowsing2::Sqlite->new(file => 'google-v2.db');
  my $gsb = Net::Google::SafeBrowsing2->new(
    key     => "my key", 
    storage => $storage,
  );
  
  $gsb->update();
  my $match = $gsb->lookup(url => 'http://www.gumblar.cn/');
  
  if ($match eq MALWARE) {
    print "http://www.gumblar.cn/ is flagged as a dangerous site\n";
  }


Version 0.1

0.1 is the first version available on CPAN. It does not include Message Authentication Code (MAC), but otherwise it is fully functional. I've been using the library successfully for a couple of weeks now. There may be a bugs left, as more unit tests are required. I encourage you to help me further develop the code. You can report bugs by posting comments here, or send me an e-mail.

Despite the low version number, the library works well!

Multiple backends

Net::Google::SafeBrowsing (API version 1) only uses Sqlite to store the database locally. My new library works with multiple backends: Sqlite, MySQL, Memcached, etc. I have uploaded a storage module which uses Sqlite to CPAN. I hope others will develop new backends. Check the documentation of Net::Google::SafeBrowsing2::Storage to create your own module.

Documentation and examples are available on CPAN.

-- Julien

form submtited
お読みいただきありがとうございました

このブログは役に立ちましたか?

免責事項:このブログは、Zscalerが情報提供のみを目的として作成したものであり、「現状のまま」提供されています。記載された内容の正確性、完全性、信頼性については一切保証されません。Zscalerは、ブログ内の情報の誤りや欠如、またはその情報に基づいて行われるいかなる行為に関して一切の責任を負いません。また、ブログ内でリンクされているサードパーティーのWebサイトおよびリソースは、利便性のみを目的として提供されており、その内容や運用についても一切の責任を負いません。すべての内容は予告なく変更される場合があります。このブログにアクセスすることで、これらの条件に同意し、情報の確認および使用は自己責任で行うことを理解したものとみなされます。

Zscalerの最新ブログ情報を受信

このフォームを送信することで、Zscalerのプライバシー ポリシーに同意したものとみなされます。