mirror of
https://github.com/JadedBlueEyes/safebrowsing-rs.git
synced 2025-12-04 13:09:02 +00:00
| .. | ||
| src | ||
| tests | ||
| Cargo.toml | ||
| CHANGELOG.md | ||
| README.md | ||
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-memoryorconcurrent)--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.