<div dir="ltr"><div><div>Hello fellows,<br><br></div>after some experimentation with various tools, I come out with a little shell tool that maybe can be useful to you too.<br><br></div><div>It can only work with non-forward secrecy ciphers, obviously, and only if is started before the client do the initial TLS handshake (eg, just restart the client). Forward secrecy cannot be decrypted after fact, so don't waste effort.<br><br></div><div>An example of ciphers that can be decrypted are the "AES256-SHA" openssl cipher group. You can use ssldump to check what cipher is used by serverhello.<br></div><div><br></div>Enjoy, make it better, and share it :)<br><br><br>#!/bin/bash <br># brought to you by Giovanni Maruzzelli<br># <br>SERVERIP="192.168.1.150"<br>SERVERPORT="5061"<br>PRIVKEY="/etc/certs/privkey.pem"<br>STDERR2DEVNULL=" 2>/dev/null "<br>REGEX="notyet"<br><br>if [ -z "$1" ]; then<br> REGEX="\\\.*"<br>else<br> REGEX="$1"<br>fi<br>FILTER="ssl.app_data and sip matches"<br>FILTER2="$FILTER \"$REGEX\""<br>FILTER3="'$FILTER2'"<br>ARGUMENT="-i 1 -Y $FILTER3 -E header=y -T fields -e frame.number -e frame.time -e frame.time_delta_displayed -e ip.src -e ip.dst -e sip.Status-Line -e sip.Request-Line -e sip.msg_hdr -l -d tcp.port\=\=5061,sip -o \"ssl.keys_list: $SERVERIP,$SERVERPORT,sip,$PRIVKEY\" $STDERR2DEVNULL | sed -u 's/\t/\n/g' | sed -u '/^$/d' | sed -u 's/^[0-9]*$/\n==&==============================/g'"<br><br>echo ""<br>echo "NB: if it do not works, edit script so that STDERR2DEVNULL=\" \" and try again"<br>echo ""<br>echo "NB: remember to quote and escape match patterns, using triple slash"<br>echo " eg, for matching <a href="mailto:1010@pbx.example.com">1010@pbx.example.com</a>, use \"<a href="mailto:1010@pbx.example.com">1010@pbx.example.com</a>\""<br>echo " eg, for matching anything, use \"\\\\\\.*\""<br>echo " eg, for matching *98, use \"\\\\\\*98\""<br>echo "USAGE: $0 \"\\\\\\*<a href="mailto:98@pbx.example.com">98@pbx.example.com</a>\""<br>echo ""<br><br><br>case "$1" in<br> -help|--help|?)<br> exit 0<br> ;;<br>*)<br> echo "THIS TIME WE'RE DOING:"<br> echo "tshark $ARGUMENT"<br> echo ""<br> bash -c "tshark $ARGUMENT"<br> ;;<br>esac<br><br><br clear="all"><div><div><div><div><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><span><span><br>Sincerely,<br></span><span><font color="#888888"><br>
Giovanni Maruzzelli<br>
OpenTelecom.IT</font></span><br><span>cell: +39 347 266 56 18<span><font color="#888888"><br></font></span></span></span></div></div></div>
</div></div></div></div></div>