MCPcopy Create free account
hub / github.com/adobe/Marinus / process_thread

Function process_thread

python3_cron_scripts/zgrab_http_domain.py:211–236  ·  view source on GitHub ↗

Runs zgrab and stores the result if necessary

(logger, domains, port, run_command, zone, zgrab_collection, tnum)

Source from the content-addressed store, hash-verified

209
210
211def process_thread(logger, domains, port, run_command, zone, zgrab_collection, tnum):
212 """
213 Runs zgrab and stores the result if necessary
214 """
215 json_output = run_command(domains, tnum)
216 if ("success_count" in json_output and json_output["success_count"] > 0) or (
217 "statuses" in json_output and json_output["statuses"]["http"]["successes"] > 0
218 ):
219 result_file = open(
220 "./json_p" + port + "/p" + port + "-" + str(tnum) + ".json", "r"
221 )
222 results = []
223 for result in result_file:
224 results.append(json.loads(result))
225 result_file.close()
226 for result in results:
227 if (
228 "zgrab2" in global_zgrab_path and "error" in result["data"]["http"]
229 ) or "error" in result:
230 logger.warning("Failed " + port + ": " + str(result["domain"]))
231 else:
232 result["zones"] = [zone]
233 insert_result(result, zgrab_collection)
234 logger.debug("Inserted " + port + ": " + result["domain"])
235 else:
236 logger.warning("Failed " + port + ": " + str(domains))
237
238
239def process_data(logger, tnum, q, port, command, zone, zgrab_collection):

Callers 1

process_dataFunction · 0.70

Calls 1

insert_resultFunction · 0.70

Tested by

no test coverage detected