Reputation: 23
I am trying to create a small python script to check the following:
An example of a blockpage from Firefox is shown below
I tried playing with the request package but with little success.
Does anyone have any ideas or suggestions for me on how to approach this problem?
Thank you
Upvotes: 0
Views: 81
Reputation: 276
These warnings are powered by the Google Safe Browsing project which has an API you can integrate with (i.e. without needing to use a browser).
For high volumes of lookups you should use the Update API which downloads a local database which is queried first before confirming a result using the online API.
For small volumes of lookups you can use the Lookup API which makes a call to the online API for every lookup.
For Python, the pysafebrowsing implements the Lookup API and can be used like this:
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'}}
Upvotes: 0