Python client for the SniffCat IP reputation and abuse reporting API. https://pypi.org/project/sniffcat/
- Fetch blacklist of suspicious IPs
- Check reputation and abuse score for any IP
- View reports about IP activity
- Report suspicious IPs (e.g., for port scanning, spam, malware, etc.)
pip install sniffcatfrom sniffcat import SniffCatClient
# Initialize the client with your API token
client = SniffCatClient("your_api_token")
# Example 1: Get blacklist with default confidence
blacklist = client.get_blacklist()
print("Blacklist:", blacklist)
# Example 2: Get blacklist with custom confidence
blacklist_80 = client.get_blacklist(confidence_min=80)
print("Blacklist (confidence >= 80):", blacklist_80)
# Example 3: Check reputation and abuse score for an IP
ip_info = client.check_ip("1.1.1.1")
print("IP info:", ip_info)
# Example 4: Get reports for an IP
reports = client.get_ip_reports("1.1.1.1")
print("IP reports:", reports)
# Example 5: Report an IP for port scanning with default comment
result = client.report_ip_port_scan("1.1.1.1")
print("Report result:", result)
# Example 6: Report an IP for port scanning with custom comment
result_custom = client.report_ip_port_scan("1.1.1.1", comment="Suspicious port scan detected from this IP")
print("Custom report result:", result_custom)
# Example 7: Report IP as spam (category 2) and malware (category 3)
result_multi = client.report_ip("1.2.3.4", [2, 3], comment="Spam and malware activity detected")
print("Multi-category report result:", result_multi)See all available categories at https://sniffcat.com/documentation/categories
See full API docs at https://sniffcat.com/documentation/api
MIT
- The payload key for reporting IPs was changed from
categorytocategoriesinreport_ip()to match SniffCat API requirements.
- Custom
User-Agentheader:
Now all requests use
Mozilla/5.0 (compatible; SniffCat.py/{version}; +https://github.com/SniffCatDB/sniffcat.py)
to help bypass Cloudflare Bot Fight Mode.
- Improved error handling for non-JSON responses from the API.
- Documentation and usage examples updated to use
SniffCatClientand the newcategoriesparameter.