(target_list, tnum)
| 218 | |
| 219 | |
| 220 | def run_port_80_command(target_list, tnum): |
| 221 | targets = "" |
| 222 | for ip in target_list: |
| 223 | targets = targets + ip + "\\n" |
| 224 | targets = targets[:-2] |
| 225 | p1 = subprocess.Popen(["echo", "-e", targets], stdout=subprocess.PIPE) |
| 226 | if "zgrab2" in global_zgrab_path: |
| 227 | p2 = subprocess.Popen( |
| 228 | [ |
| 229 | global_zgrab_path, |
| 230 | "http", |
| 231 | "--port=80", |
| 232 | "--max-redirects=10", |
| 233 | "--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'", |
| 234 | "--timeout=30", |
| 235 | "--output-file=./json_p80/p80-" + str(tnum) + ".json", |
| 236 | ], |
| 237 | stdin=p1.stdout, |
| 238 | stdout=subprocess.PIPE, |
| 239 | stderr=subprocess.PIPE, |
| 240 | ) |
| 241 | p1.stdout.close() |
| 242 | output, _ = p2.communicate() |
| 243 | parts = _.decode("utf-8").split("\n") |
| 244 | for entry in parts: |
| 245 | if entry.startswith("{"): |
| 246 | json_output = json.loads(entry) |
| 247 | return json_output |
| 248 | return json.loads("{}") |
| 249 | else: |
| 250 | p2 = subprocess.Popen( |
| 251 | [ |
| 252 | global_zgrab_path, |
| 253 | "--port=80", |
| 254 | "--http=/", |
| 255 | "--http-max-redirects=10", |
| 256 | "--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'", |
| 257 | "--timeout=30", |
| 258 | "--output-file=./json_p80/p80-" + str(tnum) + ".json", |
| 259 | ], |
| 260 | stdin=p1.stdout, |
| 261 | stdout=subprocess.PIPE, |
| 262 | ) |
| 263 | p1.stdout.close() |
| 264 | output, _ = p2.communicate() |
| 265 | json_output = json.loads(output.decode("utf-8")) |
| 266 | return json_output |
| 267 | |
| 268 | |
| 269 | def run_port_443_command(target_list, tnum): |
nothing calls this directly
no outgoing calls
no test coverage detected