Limited python3 library for Google Safe Browsing API v4. For now, only the online lookup is developed. Check here to get an API key.
To install, you can just install it from pypi with pip install pysafebrowsing, or download the code with git clone https://github.com/Te-k/pysafebrowsing.git and then pip install .
from pysafebrowsing import SafeBrowsing
s = SafeBrowsing(KEY)
r = s.lookup_urls(['http://malware.testing.google.test/testing/malware/'])
print(r)
> {'http://malware.testing.google.test/testing/malware/': {'platforms': ['ANY_PLATFORM'], 'threats': ['MALWARE', 'SOCIAL_ENGINEERING'], 'malicious': True, 'cache': '300s'}}$ safebrowsing config --key dfdsfdsfds
In /home/user/.config/safebrowsing:
[SafeBrowsing]
key = dfdsfdsfds
$ safebrowsing url http://malware.testing.google.test/testing/malware/
Malicious: Yes
Platforms: ANY_PLATFORM
Threats: SOCIAL_ENGINEERING, MALWARE
$ safebrowsing url https://github.com/
Malicious: No
$ safebrowsing file testlist.txt
http://malware.testing.google.test/testing/malware/ Malicious
http://twitter.com/ Ok
https://github.com/ Ok
http://www.google.com/ Ok
http://www.yahoo.com/ Ok
http://ianfette.org Malicious
This code is published under MIT license: do whatever you want with it, but don't blame me if it fails ;)