Created
March 12, 2017 03:17
-
-
Save carlosparadis/f7e12b9f206e3da4829957da3c8f45a8 to your computer and use it in GitHub Desktop.
sanjna
This file contains 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
#remove namespace | |
#http://effbot.org/zone/element-namespaces.htm | |
def normalize(name): | |
if name[0] == "{": | |
uri, tag = name[1:].split("}") | |
return tag | |
else: | |
return name | |
#Find root node | |
CVE_tree = ET.parse("mitre_cvrf_2014.xml") | |
root= CVE_tree.getroot() | |
vulnerability_table = root[5:] | |
for vulnerability in vulnerability_table: | |
#travels through column | |
for vulnerability_column in vulnerability: | |
#checks if that column exists or not | |
if normalize(vulnerability_column.tag) == 'CVE': | |
print(vulnerability_column.text+ '\n',end='') | |
#print (normalize(vulnerability_column.tag)) | |
if normalize(vulnerability_column.tag) == 'References': | |
reference_table = vulnerability_column | |
for reference in reference_table: | |
url = reference[0].text | |
tag = reference[1].text | |
print ('\t'+url+' '+tag) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment