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

Function upload_zgrab_443

python3_cron_scripts/upload_collection_to_splunk.py:37–80  ·  view source on GitHub ↗

Upload the HTTP Headers from Zgrab scans of HTTPS servers In a redirect scenario, this uploads the headers of the final page which returns a 200. It does not upload the headers of the first response which returned the 30x response. This also does not include headers from requests se

(logger, splunk_manager, mongo_connector)

Source from the content-addressed store, hash-verified

35
36
37def upload_zgrab_443(logger, splunk_manager, mongo_connector):
38 """
39 Upload the HTTP Headers from Zgrab scans of HTTPS servers
40 In a redirect scenario, this uploads the headers of the final page which returns a 200.
41 It does not upload the headers of the first response which returned the 30x response.
42 This also does not include headers from requests sent to IP addresses.
43 """
44 zgrab_443_collection = mongo_connector.get_zgrab_443_data_connection()
45
46 results = mongo_connector.perform_find(
47 zgrab_443_collection, {"domain": {"$ne": "<nil>"}}, batch_size=80
48 )
49
50 for result in results:
51 data = {}
52 data["zones"] = result["zones"]
53 data["timestamp"] = result["timestamp"]
54 data["domain"] = result["domain"]
55
56 try:
57 data["host"] = result["data"]["http"]["result"]["response"]["request"][
58 "host"
59 ]
60 except:
61 logger.debug("Passing on host")
62 pass
63
64 try:
65 data["response_headers"] = result["data"]["http"]["result"]["response"][
66 "headers"
67 ]
68 except:
69 logger.debug("Skipping on headers")
70 continue
71
72 try:
73 data["status_code"] = result["data"]["http"]["result"]["response"][
74 "status_code"
75 ]
76 except:
77 logger.debug("Passing on status_code")
78 pass
79
80 splunk_manager.push_to_splunk_hec("marinus_443_domain_headers", data)
81
82
83def upload_zgrab_80(logger, splunk_manager, mongo_connector):

Callers 1

mainFunction · 0.85

Calls 3

perform_findMethod · 0.80
push_to_splunk_hecMethod · 0.80

Tested by

no test coverage detected