Skip to content

Instantly share code, notes, and snippets.

@jkordish
Created October 2, 2012 15:58
Show Gist options
  • Save jkordish/3820392 to your computer and use it in GitHub Desktop.
Save jkordish/3820392 to your computer and use it in GitHub Desktop.
import csv
import urllib2
from bs4 import BeautifulSoup
ifile = open('data/CVE.txt', "r").readlines()
ofile = writer = csv.writer(open('data/export.csv', 'wb'))
data = []
for row in ifile:
url = 'http://www.cvedetails.com/cve/'+row
soup = BeautifulSoup(urllib2.urlopen(url).read())
CVE = soup.find(attrs={"name":"description"})['content'].split(':', 1)
print(CVE[0].strip(), CVE[1].lstrip())
data.append((CVE[0].strip(), CVE[1].lstrip()))
writer.writerow(['CVE','Detail'])
for row in data:
ofile.writerow(row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment