Last active
August 29, 2015 14:13
-
-
Save Mattias-/c02d46074a359c59a763 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
security find-certificate -a /System/Library/Keychains/SystemRootCertificates.keychain |
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
#!/bin/bash | |
function get_root_cert() { | |
host=$1 | |
echo x | | |
openssl s_client -connect $host:443 2> /dev/null | | |
sed -n "s/.*:\/C=.*CN=\(.*\)$/\1/p" | | |
tail -1 | |
} | |
query=" | |
SELECT DISTINCT | |
substr(url, 9, instr(substr(url, 9), '/') - 1) | |
FROM urls | |
WHERE url | |
LIKE 'https%'; | |
" | |
#histfile="History" | |
histfile="$HOME/Library/Application Support/Google/Chrome/Default/History" | |
temphistory="./temphistory" | |
# Copy the history since it's probably locked by Chrome | |
cp "$histfile" "$temphistory" | |
# Get all hosts from the history sqlite file that use HTTPS | |
sqlite3 "$temphistory" "$query" > urls.dump | |
hosts=$(tail -5 urls.dump) | |
#hosts=$(cat urls.dump) | |
rm -f certs.dump | |
for host in $hosts ; do | |
get_root_cert $host >> certs.dump | |
done | |
sort certs.dump | uniq -c | sort -nr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment