isipsafe
Official Python client and command-line tool for isIPsafe, the free IP reputation and abuse reporting service.
- Check whether an IP address is malicious before you trust it
- Report attackers from your logs, one at a time or 10,000 at once
- Download the blocklist in a firewall-ready format (nftables, ipset, nginx, apache, MikroTik, STIX and more)
No dependencies outside the Python standard library. Python 3.9+.
Get an API key
Lookups work without a key (400 per day per address). Reporting, bulk uploads and the blocklist need a free key from isipsafe.com/login. A key also raises the lookup limit to 10,000 per day.
The client sends the key in an Authorization header, never in the URL, so it stays out of proxy and server logs.
Python
Report many addresses at once
Blocklist
Everything else
Errors
Every error inherits from isipsafe.IsIPsafeError.
Lookups are retried automatically on network errors and 5xx responses. Reporting the same address twice within 15 minutes is not an error: report() returns a result with duplicate=True.
Command line
Add --json to check, report, reports, check-block and categories for machine-readable output.
Use --fail-if-malicious in shell scripts. The command exits with status 1 when the address is malicious:
Exit codes: 0 success, 1 malicious (only with --fail-if-malicious), 2 error.
Categories
Use the slug or the numeric ID. Common ones: ssh, brute-force, port-scan, web-app-attack, sql-injection, vuln-scan, bad-bot, ddos, email-spam, phishing. Run isipsafe categories for the full list, or see isipsafe.com/categories.
Links
Licence
The code in this repository is MIT licensed. Data returned by the isIPsafe API is covered by the isIPsafe EULA.