我正在尝试运行可以识别可疑网络钓鱼站点的代码(在
Python中).我正在使用Selenium的chromedriver.这是我的代码:
import os, os.path, sys
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_experimental_option( "prefs", {'safebrowsing.enabled':1})
chromedriver = "my chromedriver path"
os.environ["webdriver.chrome.driver"] = chromedriver
driver = webdriver.Chrome(chromedriver, chrome_options=chrome_options)
driver.get('site url I want to check')
我的代码在隐私设置中检查“启用网络钓鱼和恶意软件保护”中的“V”,但由于某些原因使用Chrome(不是Python打开的窗口),我检查的网站被怀疑为网络钓鱼,Chrome浏览器窗口由我打开Python代码没有显示任何与网络钓鱼有关的内容.
有任何想法吗?
最佳答案 而不是使用硒,直接使用
Google Safe Browsing API(
python wrapper):
>>> 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'}