Insert the matched domain into the collection of positive results.
(entry, port, ip_context, zones, results_collection)
| 184 | |
| 185 | |
| 186 | def insert_result(entry, port, ip_context, zones, results_collection): |
| 187 | """ |
| 188 | Insert the matched domain into the collection of positive results. |
| 189 | """ |
| 190 | if "zgrab2" in global_zgrab_path: |
| 191 | temp_date = entry["data"]["http"]["timestamp"] |
| 192 | new_date = parse(temp_date) |
| 193 | entry["timestamp"] = new_date |
| 194 | entry["data"]["http"]["timestamp"] = new_date |
| 195 | else: |
| 196 | temp_date = entry["timestamp"] |
| 197 | new_date = parse(temp_date) |
| 198 | entry["timestamp"] = new_date |
| 199 | |
| 200 | entry["domain"] = "<nil>" |
| 201 | |
| 202 | matches = check_ip_context(entry["ip"], ip_context) |
| 203 | |
| 204 | zones = [] |
| 205 | if len(matches) > 0: |
| 206 | for match in matches: |
| 207 | if match["zone"] not in zones: |
| 208 | zones.append(match["zone"]) |
| 209 | if port == "443": |
| 210 | cert_zones = check_in_zone(entry, zones) |
| 211 | for zone in cert_zones: |
| 212 | if zone not in zones: |
| 213 | zones.append(zone) |
| 214 | |
| 215 | entry["zones"] = zones |
| 216 | |
| 217 | results_collection.replace_one({"ip": entry["ip"]}, entry, upsert=True) |
| 218 | |
| 219 | |
| 220 | def run_port_80_command(target_list, tnum): |
no test coverage detected