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

Function run_port_80_command

python3_cron_scripts/zgrab_http_domain.py:104–153  ·  view source on GitHub ↗

Run Zgrab using HTTP on port 80

(target_list, tnum)

Source from the content-addressed store, hash-verified

102
103
104def run_port_80_command(target_list, tnum):
105 """
106 Run Zgrab using HTTP on port 80
107 """
108 targets = ""
109 for domain in target_list:
110 targets = targets + domain + "\\n"
111 targets = targets[:-2]
112
113 p1 = subprocess.Popen(["echo", "-e", targets], stdout=subprocess.PIPE)
114 if "zgrab2" in global_zgrab_path:
115 p2 = subprocess.Popen(
116 [
117 global_zgrab_path,
118 "http",
119 "--port=80",
120 "--max-redirects=10",
121 "--timeout=30",
122 "--output-file=./json_p80/p80-" + str(tnum) + ".json",
123 ],
124 stdin=p1.stdout,
125 stdout=subprocess.PIPE,
126 stderr=subprocess.PIPE,
127 )
128 p1.stdout.close()
129 output, _ = p2.communicate()
130 parts = _.decode("utf-8").split("\n")
131 for entry in parts:
132 if entry.startswith("{"):
133 json_output = json.loads(entry)
134 return json_output
135 return json.loads("{}")
136 else:
137 p2 = subprocess.Popen(
138 [
139 global_zgrab_path,
140 "--port=80",
141 "--http=/",
142 "--http-max-redirects=10",
143 "--lookup-domain",
144 "--timeout=30",
145 "--output-file=./json_p80/p80-" + str(tnum) + ".json",
146 ],
147 stdin=p1.stdout,
148 stdout=subprocess.PIPE,
149 )
150 p1.stdout.close()
151 output, _ = p2.communicate()
152 json_output = json.loads(output.decode("utf-8"))
153 return json_output
154
155
156def run_port_443_command(target_list, tnum):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected