Skip to content

Instantly share code, notes, and snippets.

@jonjensen
Last active January 2, 2023 18:16
Show Gist options
  • Save jonjensen/74523a893eea239a6155ead9d236fe33 to your computer and use it in GitHub Desktop.
Save jonjensen/74523a893eea239a6155ead9d236fe33 to your computer and use it in GitHub Desktop.
Script to extract hostnames from request URLs in HAR files from Firefox & Chrome
#!/bin/bash
set -e -u -o pipefail
# Include user's home directory bin/ to use locally-installed jq
PATH=~/bin:$PATH
for f in "$@"
do
echo "Unique hostnames found in request URLs in: $f"
jq -r '.log.entries[].request.url' < "$f" | perl -pe 's,^\w+://,,; s,/.*,,;' | sort -u
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment