-
-
Save cablethief/a2b8f0f7d5ece96423ba376d261bd711 to your computer and use it in GitHub Desktop.
A simple tshark EAP certificate extractor
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 | |
# Simple tshark WiFi EAP certificate extractor | |
# By [email protected] | |
# All rights reserved 2018 | |
if [ ! -x $(which tshark) ]; then | |
echo "tshark not installed" | |
exit 0 | |
fi | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: $0 [-r file.cap | -i interface]" | |
echo "Extracted certificates will be written to <file|int>.cert.rand.der" | |
exit 0 | |
fi | |
tmpbase=$(basename $2) | |
for x in $(tshark $1 $2 \ | |
-Y "ssl.handshake.certificate and eapol" \ | |
-T fields -e "ssl.handshake.certificate"); do | |
echo $x | \ | |
sed "s/://g" | \ | |
xxd -ps -r | \ | |
tee $(mktemp $tmpbase.cert.XXXX.der) | \ | |
openssl x509 -inform der -text; | |
done |
That’s super useful. Thanks. We should probably give this thing a proper repo now.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks @cablethief and @singe
Updated in https://gist.github.com/glefait/10e28d8e40a752453ed6d87633953ed8 to: