I will appreciate if someone can point me How to extract an X.509 certificate from live network traffic automatically during the handshake phase between client and server on Linux OS.
A similar question has been asked quiet some time back Extracting SSL certificates from the network or pcap files but the answer was incomplete.
The answer says to use the following command
ssldump -Nr file.pcap | awk 'BEGIN {c=0;} { if ($0 ~ /^[ ]+Certificate$/) {c=1; print "========================================";} if ($0 !~ /^ +/ ) {c=0;} if (c==1) print $0; }'
But it is given for manual extraction of the certificate due to the involvement of pcap file.
Can any one help in either modifying the above command to suit my requirement or suggest any other alternative method to do the same.