Created
June 30, 2021 13:03
-
-
Save cfra/87af6a38b7a665a600d580ce4fdfff19 to your computer and use it in GitHub Desktop.
Extract Hosts from HAR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import json | |
import sys | |
try: | |
file_path = sys.argv[1] | |
except IndexError: | |
sys.stderr.write(f"Usage: {sys.argv[0]} <file_path>\n") | |
sys.exit(1) | |
with open(file_path) as f: | |
doc = json.load(f) | |
print(set([ header['value'] | |
for entry in doc['log']['entries'] | |
for header in entry['request']['headers'] | |
if header['name'] == 'Host' | |
])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment