Update nmap_xml_parser.py

This commit is contained in:
Jake Miller 2018-07-23 20:33:37 -05:00 committed by GitHub
parent 694763aacc
commit e0899c7327
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -237,12 +237,14 @@ def main():
print("\n[-] The file {} cannot be found or you do not have permission to open the file.".format(filename))
continue
# Read the file and check for entities
with open(filename) as fh:
contents = fh.read()
if '<!entity' in contents.lower():
print("[-] Error! This program does not permit XML entities. Exiting!")
continue
if not args.skip_entity_check:
# Read the file and check for entities
with open(filename) as fh:
contents = fh.read()
if '<!entity' in contents.lower():
print("[-] Error! This program does not permit XML entities. Ignoring {}".format(filename))
print("[*] Use -s (--skip_entity_check) to ignore this check for XML entities.")
continue
data = parse_xml(filename)
if not data:
print("[*] Zero hosts identitified as 'Up'. Exiting.")
@ -272,6 +274,9 @@ if __name__ == '__main__':
parser.add_argument("-d", "--debug",
help="Display error information",
action="store_true")
parser.add_argument("-s", "--skip_entity_check",
help="Skip the check for XML entities",
action="store_true")
parser.add_argument("-p", "--print_all",
help="Display scan information to the screen",
action="store_true")