当尝试访问某些包含恶意内容的网站时,Firefox、Google Chrome 或 Internet Explorer 等浏览器会显示一条类似以下消息,表示浏览相关网站是不安全的,如下图所示:
我正在使用 Python 和 Seleinum 在 Firefox、Google Chrome 和 Internet Explorer 中启动网站(在 Windows XP 上):如果这些浏览器之一声明该网站不安全:是否有任何方法可以使用以下方式从浏览器检索此信息: Python ?任何想法都非常受欢迎。
最佳答案
如果你想测试一个网站是否被“标记”为危险使用,你根本不需要 Selenium 。通过查找向 Google Safebrowsing 发出请求 API :
Safe Browsing is a Google service that enables applications to check URLs against Google's constantly updated lists of suspected phishing and malware pages.
当然,还有一个python wrapper (可以生成API key here):
>>> key = 'your own key'
>>> from safebrowsinglookup import SafebrowsinglookupClient
>>> client = SafebrowsinglookupClient(key)
>>> client.lookup('http://addonrock.ru/Debugger.js')
{'http://addonrock.ru/Debugger.js': 'malware'}
>>> client.lookup('http://google.com')
{'http://google.com': 'ok'}
关于python - 不安全的浏览,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25033741/