Closed oxr463 closed 5 years ago
This has flipped. It now checks for empty "Location" element but does not do the character count. Need to add this next.
def Analyze(self):
names = ["Name", "CWE", "Count", "CAPEC", "CVSS", "Description",
"Remediation", "Remediation Effort", "Exploit Description",
"Severity Description", "Note", "Input Vector", "Location",
"Exploit Difficulty"]
for flaw in self.flaws:
print("{}: {}".format(flaw, self.flaws[flaw]["Flaw Name"]))
for name in names:
if self.flaws[flaw]["Flaw "+name] == None or \
self.flaws[flaw]["Flaw "+name] == "":
print("[*]\t Flaw {} is missing.".format(name))
elif name == "Count":
print("[*]\t Counts/Instance Count: ({}/{})".format(self.flaws[flaw]["Flaw Count"],\
self.flaws[flaw]["Flaw Appendix"]["Instance Count"]))
elif name == "CVSS":
digits = re.compile("([\d\.]{3})")
cvssNum = digits.search(self.flaws[flaw]["Flaw Note"]).group()
if float(self.flaws[flaw]["Flaw "+name]) != float(cvssNum):
print("[*]\t Flaw CVSS score({}) doesnt match the Note score({})"\
.format(self.flaws[flaw]["Flaw "+name],cvssNum))
print()
This has now been fixed with the latest commit.
We currently check for the max length of 255, but we also need to make sure it isn't empty.
Source:
XMLCheck.py