MCPcopy Index your code
hub / github.com/NullArray/AutoSploit / write_data

Function write_data

lib/scanner/nmap.py:86–101  ·  view source on GitHub ↗

dump XML data to a file

(host, output, is_xml=True)

Source from the content-addressed store, hash-verified

84
85
86def write_data(host, output, is_xml=True):
87 """
88 dump XML data to a file
89 """
90 if not os.path.exists(lib.settings.NMAP_XML_OUTPUT_BACKUP if is_xml else lib.settings.NMAP_JSON_OUTPUT_BACKUP):
91 os.makedirs(lib.settings.NMAP_XML_OUTPUT_BACKUP if is_xml else lib.settings.NMAP_JSON_OUTPUT_BACKUP)
92 file_path = "{}/{}_{}.{}".format(
93 lib.settings.NMAP_XML_OUTPUT_BACKUP if is_xml else lib.settings.NMAP_JSON_OUTPUT_BACKUP,
94 str(host), lib.jsonize.random_file_name(length=10), "xml" if is_xml else "json"
95 )
96 with open(file_path, 'a+') as results:
97 if is_xml:
98 results.write(output)
99 else:
100 json.dump(output, results, indent=4)
101 return file_path
102
103
104def find_nmap(search_paths):

Callers 1

do_scanFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected