safebrowsing-rs/sblookup
2025-08-11 01:40:19 +01:00
..
src chore: Initial commit 2025-08-07 18:03:21 +01:00
tests chore: Update snapshot test output 2025-08-11 01:40:19 +01:00
Cargo.toml feat: Allow specifying database type in sbserver 2025-08-07 18:46:47 +01:00
CHANGELOG.md chore: Release 2025-08-07 18:05:01 +01:00
README.md chore: Initial commit 2025-08-07 18:03:21 +01:00

sblookup

A command-line Safe Browsing URL lookup tool that allows checking URLs for threats using the Google Safe Browsing API.

Installation

From the workspace root:

cargo build --bin sblookup

Usage

Basic Usage

Check URLs from command line arguments:

sblookup --api-key YOUR_API_KEY http://example.com https://malware.example.com

Check URLs from stdin:

echo "http://example.com" | sblookup --api-key YOUR_API_KEY

Options

  • --api-key <API_KEY>: Google Safe Browsing API key (required)
  • -s, --stats: Output statistics
  • --database-type <TYPE>: Database type to use (in-memory or concurrent)
  • --update-period <SECONDS>: Update period in seconds (default: 10)
  • --client-id <ID>: Client ID for API requests
  • --client-version <VERSION>: Client version for API requests

Environment Variables

You can also set the API key via environment variable:

export SAFEBROWSING_API_KEY=your_api_key_here
sblookup http://example.com

Examples

Check a single URL:

sblookup --api-key YOUR_API_KEY https://example.com

Check multiple URLs with verbose output:

sblookup --api-key YOUR_API_KEY --verbose \
  https://example.com \
  https://malware.example.com \
  https://phishing.example.com

Check URLs from a file:

cat urls.txt | sblookup --api-key YOUR_API_KEY

API Key

You need a Google Safe Browsing API key to use this tool. You can get one from the Google Cloud Console by enabling the Safe Browsing API.