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

Function run_port_443_command

python3_cron_scripts/zgrab_http_ip.py:269–318  ·  view source on GitHub ↗
(target_list, tnum)

Source from the content-addressed store, hash-verified

267
268
269def run_port_443_command(target_list, tnum):
270 targets = ""
271 for ip in target_list:
272 targets = targets + ip + "\\n"
273 targets = targets[:-2]
274 p1 = subprocess.Popen(["echo", "-e", targets], stdout=subprocess.PIPE)
275 if "zgrab2" in global_zgrab_path:
276 p2 = subprocess.Popen(
277 [
278 global_zgrab_path,
279 "http",
280 "--port=443",
281 "--use-https",
282 "--max-redirects=10",
283 "--user-agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36'",
284 "--timeout=30",
285 "--output-file=./json_p443/p443-" + str(tnum) + ".json",
286 ],
287 stdin=p1.stdout,
288 stdout=subprocess.PIPE,
289 stderr=subprocess.PIPE,
290 )
291 p1.stdout.close()
292 output, _ = p2.communicate()
293 parts = _.decode("utf-8").split("\n")
294 for entry in parts:
295 if entry.startswith("{"):
296 json_output = json.loads(entry)
297 return json_output
298 return json.loads("{}")
299 else:
300 p2 = subprocess.Popen(
301 [
302 global_zgrab_path,
303 "--port=443",
304 "--tls",
305 "--chrome-ciphers",
306 "--http=/",
307 "--http-max-redirects=10",
308 "--http-user-agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36'",
309 "--timeout=30",
310 "--output-file=./json_p443/p443-" + str(tnum) + ".json",
311 ],
312 stdin=p1.stdout,
313 stdout=subprocess.PIPE,
314 )
315 p1.stdout.close()
316 output, _ = p2.communicate()
317 json_output = json.loads(output.decode("utf-8"))
318 return json_output
319
320
321def process_thread(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected