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

Function run_port_443_command

python3_cron_scripts/zgrab_http_domain.py:156–208  ·  view source on GitHub ↗

Run Zgrab using HTTPS on port 443

(target_list, tnum)

Source from the content-addressed store, hash-verified

154
155
156def run_port_443_command(target_list, tnum):
157 """
158 Run Zgrab using HTTPS on port 443
159 """
160 targets = ""
161 for domain in target_list:
162 targets = targets + domain + "\\n"
163 targets = targets[:-2]
164
165 p1 = subprocess.Popen(["echo", "-e", targets], stdout=subprocess.PIPE)
166 if "zgrab2" in global_zgrab_path:
167 p2 = subprocess.Popen(
168 [
169 global_zgrab_path,
170 "http",
171 "--port=443",
172 "--use-https",
173 "--max-redirects=10",
174 "--timeout=30",
175 "--output-file=./json_p443/p443-" + str(tnum) + ".json",
176 ],
177 stdin=p1.stdout,
178 stdout=subprocess.PIPE,
179 stderr=subprocess.PIPE,
180 )
181 p1.stdout.close()
182 output, _ = p2.communicate()
183 parts = _.decode("utf-8").split("\n")
184 for entry in parts:
185 if entry.startswith("{"):
186 json_output = json.loads(entry)
187 return json_output
188 return json.loads("{}")
189 else:
190 p2 = subprocess.Popen(
191 [
192 global_zgrab_path,
193 "--port=443",
194 "--tls",
195 "--chrome-ciphers",
196 "--http=/",
197 "--http-max-redirects=10",
198 "--lookup-domain",
199 "--timeout=30",
200 "--output-file=./json_p443/p443-" + str(tnum) + ".json",
201 ],
202 stdin=p1.stdout,
203 stdout=subprocess.PIPE,
204 )
205 p1.stdout.close()
206 output, _ = p2.communicate()
207 json_output = json.loads(output.decode("utf-8"))
208 return json_output
209
210
211def process_thread(logger, domains, port, run_command, zone, zgrab_collection, tnum):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected