Last active
October 27, 2025 15:19
-
-
Save Vocaned/5e07b4f85a7ddb46488dd79d2ed52c62 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/bin/sh | |
| # crt.sh api is very unreliable, don't rely on this in any scripts | |
| if [ -z "$1" ]; then | |
| echo "Usage: $0 <domain>" | |
| exit 1 | |
| fi | |
| data=$(curl -s "https://crt.sh/?q=$1&output=json" | jq -r ' | |
| .[] | | |
| .entry_timestamp as $ts | | |
| .name_value | split("\n")[] as $name | | |
| "\($name)\t\($ts)" | |
| ' 2> /dev/null ) | |
| if [ -z "$data" ]; then | |
| echo "crt.sh broke." | |
| exit 1 | |
| fi | |
| epoch_lines="" | |
| while IFS=$'\t' read -r name ts; do | |
| ts_norm=${ts%T*} | |
| if ! epoch=$(date -d "$ts_norm" +%s 2>/dev/null); then | |
| echo "Could not parse date '$ts_norm' for '$name'" >&2 | |
| continue | |
| fi | |
| epoch_lines+="$epoch"$'\t'"$ts_norm"$'\t'"$name"$'\n' | |
| done <<< "$data" | |
| sorted=$(echo "$epoch_lines" | sort -n | awk -F'\t' '!seen[$3]++ { print $2 "\t" $3 }') | |
| echo "$sorted" | tac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment