本文介绍了抓取 Microsoft CVE 网页时出现 Python 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以,我阅读了下面的问题.答案提供了一些用于进一步测试的代码.
So, I read the question below. The answer provides some codes for further testing.
如何我可以抓取动态分配其内容的 Microsoft CVE 网页吗(最好使用 Python)?
看起来像
https://portal.msrc.microsoft.com/api/security-guidance/en-US/CVE/CVE-2018-8176
不工作.它返回的是默认的 HTML 页面,而不是实际的内容.它一直工作到上个月.并且正在返回 JSON 数据有人可以帮我找到可以返回正确 json 数据的新 URL.
is not working. Its returning default HTML page and not the actual content. It was working till last month. And was returning JSON datacan someone please help me finding new URL which can returns proper json data.
谢谢
推荐答案
你可以用这个例子下载带有 CVE 数据的 Json:
You can download the Json with CVE data with this example:
import json
import requests
from bs4 import BeautifulSoup
url = (
"https://api.msrc.microsoft.com/sug/v2.0/en-US/vulnerability/CVE-2018-8176"
)
data = requests.get(url).json()
# uncomment to print all data:
# print(json.dumps(data, indent=4))
print(data["cveTitle"])
print(BeautifulSoup(data["description"], "html.parser").get_text(strip=True))
打印:
Microsoft PowerPoint Remote Code Execution Vulnerability
A remote code execution vulnerability exists in Microsoft PowerPoint software when the software fails to properly validate XML content. An attacker who successfully exploited the vulnerability could run arbitrary code in the context of the current user. If the current user is logged on with administrative user rights, an attacker could take control of the affected system. An attacker could then install programs; view, change, or delete data; or create new accounts with full user rights. Users whose accounts are configured to have fewer user rights on the system could be less impacted than users who operate with administrative user rights.Exploitation of the vulnerability requires that a user open a specially crafted file with an affected version of Microsoft Office PowerPoint software. In an email attack scenario, an attacker could exploit the vulnerability by sending the specially crafted file to the user and convincing the user to open the file. In a web-based attack scenario, an attacker could host a website (or leverage a compromised website that accepts or hosts user-provided content) that contains a specially crafted file designed to exploit the vulnerability. An attacker would have no way to force users to visit the website. Instead, an attacker would have to convince users to click a link, typically by way of an enticement in an email or instant message, and then convince them to open the specially crafted file. After the file is open, the user would need to move their mouse over a specific location on the page within the PowerPoint file to trigger the vulnerability.Note that the Preview Pane is not an attack vector for this vulnerability. The security update addresses the vulnerability by correcting how Microsoft PowerPoint handles objects in memory.
这篇关于抓取 Microsoft CVE 网页时出现 Python 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!