python - 如何使用 python 2.7 检测红旗、网络钓鱼或恶意站点?
问题描述
我想使用 python 检测恶意网站。
现在,我尝试使用requests
模块来获取网站的内容,然后在其中进行搜索malicious words
。但是,我没有让它工作。
这是我的所有代码:链接代码
req_check = requests.get(url)
if 'malicious words' in req_check.content:
print ('[Your Site Detect Red Page] ===> '+url)
else:
print ('[Your Site Not Detect Red Page] ===> '+url)
解决方案
它不起作用,因为您使用requests
错误的库。
在您的代码中,您基本上只能获得病毒站点的 HTML(代码行:req_check = requests.get(url, verify=False)
和if 'example for detect ' in req_check.content:
{source: https://pastebin.com/6x24SN6v })
在 Chrome 中,浏览器会运行已知病毒链接的数据库(比这更复杂)并查看链接是否安全。但是,requests
图书馆不这样做。相反,您最好使用他们的 API。requests
如果您想了解 API 如何与
旁注,redage()
从未调用过?
推荐阅读
- google-bigquery - BIGQUERY 表中的整数列分区功能何时可用?
- php - Laravel,使用分页方法 Illuminate\Database\Eloquent\Collection::render 不存在
- dom - 在 DOM 突变事件上启动 FocusManager.parse_for_input
- vb.net - 如何在 WebApi 中路由两个具有相同参数的 get 方法?
- python - 从现有字典创建频率字典
- javascript - 用获取的数据反应上下文
- excel - 调用 VBA 函数时在 Excel 中返回 #VALUE
- java - JTree - Java Swing中仅处理树会扩展但不会扩展树选择
- google-ads-api - Google Adwords/Ads AdGroupAdService
- python - Qcombobox中的错误宽度计算