LoginSignup
2
0

More than 5 years have passed since last update.

CVEからCVSSを取得する

Posted at

Python2ですんません。

この脆弱性はどれぐらい危険かを示すCVSSという指標があるのですが、これをCVEから引けたら楽かも、ということで書いてみました。NIST(米国)の値を引っ張ってきて、CSSセレクタで抜いてます。

こんな感じのをAzure NotebookなどJupyter環境でまとめておくと便利ですね。

cve_list = [
    "CVE-2017-0001",
    "CVE-2016-0001",
    "CVE-2015-0001",
    "CVE-2014-0001",
    "CVE-2013-0001"
]

import urllib2
from bs4 import BeautifulSoup

for cve in cve_list:
  instance = urllib2.urlopen("https://nvd.nist.gov/vuln/detail/"+cve)
  soup = BeautifulSoup(instance, "html.parser")
  desc = soup.select_one("[data-testid=vuln-cvssv2-base-score-link]")
  if hasattr(desc,"text"):
    print cve, desc.text.strip()
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0