Don't check XML files in the notes folder
Fix issue where not all words were properly cased. Unified output messages
This commit is contained in:
parent
883712dee4
commit
94daf56bf2
@ -221,6 +221,9 @@ def validate_xml(filename, options):
|
|||||||
"""
|
"""
|
||||||
result = True
|
result = True
|
||||||
xml_type = ''
|
xml_type = ''
|
||||||
|
# crude check whether the file is outside the pentext framework
|
||||||
|
if 'notes' in filename:
|
||||||
|
return result, xml_type
|
||||||
print_output(options, 'Validating XML file: {0}'.format(filename))
|
print_output(options, 'Validating XML file: {0}'.format(filename))
|
||||||
try:
|
try:
|
||||||
with open(filename, 'rb') as xml_file:
|
with open(filename, 'rb') as xml_file:
|
||||||
@ -269,7 +272,7 @@ def capitalize(line):
|
|||||||
for word in line.strip().split():
|
for word in line.strip().split():
|
||||||
if word not in NOT_CAPITALIZED or not len(capitalized):
|
if word not in NOT_CAPITALIZED or not len(capitalized):
|
||||||
word = word[0].upper() + word[1:]
|
word = word[0].upper() + word[1:]
|
||||||
capitalized += word + ' '
|
capitalized += word + ' '
|
||||||
return capitalized.strip()
|
return capitalized.strip()
|
||||||
|
|
||||||
|
|
||||||
@ -394,7 +397,7 @@ def validate_master(filename, findings, non_findings, scans, options):
|
|||||||
result = True
|
result = True
|
||||||
include_findings = []
|
include_findings = []
|
||||||
include_nonfindings = []
|
include_nonfindings = []
|
||||||
print_output(options, '[*] Validating master file {0}'.format(filename))
|
print_output(options, 'Validating master file {0}'.format(filename))
|
||||||
try:
|
try:
|
||||||
xmltree = ElementTree.parse(filename,
|
xmltree = ElementTree.parse(filename,
|
||||||
ElementTree.XMLParser(strip_cdata=False))
|
ElementTree.XMLParser(strip_cdata=False))
|
||||||
@ -415,7 +418,7 @@ def validate_master(filename, findings, non_findings, scans, options):
|
|||||||
include_nonfindings.append(non_finding)
|
include_nonfindings.append(non_finding)
|
||||||
result = False
|
result = False
|
||||||
if result:
|
if result:
|
||||||
print_output(options, '[+] Cross checks successful')
|
print_output(options, 'Cross checks successful')
|
||||||
except (ElementTree.ParseError, IOError) as exception:
|
except (ElementTree.ParseError, IOError) as exception:
|
||||||
print('[-] validating {0} failed ({1})'.format(filename, exception))
|
print('[-] validating {0} failed ({1})'.format(filename, exception))
|
||||||
result = False
|
result = False
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user