{"id":17332937,"url":"https://github.com/client9/gsb4u","last_synced_at":"2026-01-11T05:36:04.357Z","repository":{"id":63699834,"uuid":"2672218","full_name":"client9/gsb4u","owner":"client9","description":"Google Safe Browsing batch server, client","archived":true,"fork":false,"pushed_at":"2011-12-04T23:25:07.000Z","size":118,"stargazers_count":15,"open_issues_count":1,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-12T17:19:46.662Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/client9.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-10-29T19:47:36.000Z","updated_at":"2024-05-18T04:44:57.000Z","dependencies_parsed_at":"2022-11-24T06:02:44.055Z","dependency_job_id":null,"html_url":"https://github.com/client9/gsb4u","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/client9%2Fgsb4u","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/client9%2Fgsb4u/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/client9%2Fgsb4u/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/client9%2Fgsb4u/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/client9","download_url":"https://codeload.github.com/client9/gsb4u/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240741539,"owners_count":19850168,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T14:59:16.079Z","updated_at":"2026-01-11T05:36:04.325Z","avatar_url":"https://github.com/client9.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nThis implements a toolkit for implementing the\n[Google Safe Browsing API v2](http://code.google.com/apis/safebrowsing/)\n\nThe lib directory contains the pieces you'll need to assemble to match\nyour enivroment:\n\n\u003ctable\u003e\n\u003ctr\u003e\u003ctd\u003e lib/GSB_Client.php \u003c/td\u003e\u003ctd\u003e The client to test if a URL is blacklisted \u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e lib/GSB_Exception.php \u003c/td\u003e\u003ctd\u003e An empty class to namespace our exceptions \u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e lib/GSB_Logger.php    \u003c/td\u003e\u003ctd\u003e A really simple logger.  Ideally you'd subclass to modify for your environment  \u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e lib/GSB_Request.php   \u003c/td\u003e\u003ctd\u003e All network (http) calls are here  \u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e lib/GSB_Storage.php   \u003c/td\u003e\u003ctd\u003e Every database query is here, wrapper up in a function  \u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e lib/GSB_Updater.php   \u003c/td\u003e\u003ctd\u003e Updates the local GSB database  \u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e lib/GSB_URL.php       \u003c/td\u003e\u003ctd\u003e URL cannonicalization  \u003c/td\u003e\u003c/tr\u003e\n\u003c/table\u003e\n\nbin-sample shows how this might be done.  You'll want to rewrite these for match your environment:\n\n\u003ctable\u003e\n\u003ctr\u003e\u003ctd\u003e bin-sample/intro.php  \u003c/td\u003e\u003ctd\u003e common code for both lookup and updater \u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e bin-sample/lookup.php \u003c/td\u003e\u003ctd\u003e CLI to test a URL \u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e bin-sample/update.php \u003c/td\u003e\u003ctd\u003e code to update the local GSB database \u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e bin-sample/cron.sh    \u003c/td\u003e\u003ctd\u003e shows how update might be run periodicially \u003c/td\u003e\u003c/tr\u003e\n\u003c/table\u003e\n\nThe URL lookup and the local database update shares common code:\n\n    $api = 'YOUR-API-KEY-HERE';\n    $gsblists = array('goog-malware-shavar', 'googpub-phish-shavar');\n\n    // make a PDO object, 2nd line is just good practice\n    $dbh = new PDO('mysql:host=127.0.0.1;dbname=gsb', 'root');\n    $dbh-\u003esetAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n\n    // create the pieces.  Subclass, over-ride for your environment\n    $storage = new GSB_StoreDB($dbh);\n    $network = new GSB_Request($api);\n    $logger  = new GSB_Logger(5);\n\n\nTo make URL checker:\n\n    // make the client with the pieces, and test\n    $client  = new GSB_Client($storage, $network, $logger);\n    $client-\u003elookup('A URL');\n\nTo make a database updater:\n\n    $x = new GSB_Updater($storage, $network, $logger);\n    $x-\u003edownloadData($gsblists, FALSE);\n    $storage-\u003efullhash_delete_old();\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclient9%2Fgsb4u","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclient9%2Fgsb4u","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclient9%2Fgsb4u/lists"}