Created
October 2, 2012 15:58
-
-
Save jkordish/3820392 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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