1{ 2 "cells": [ 3 { 4 "cell_type": "markdown", 5 "metadata": {}, 6 "source": [ 7 "# The lack of PFS: a danger to privacy" 8 ] 9 }, 10 { 11 "cell_type": "code", 12 "execution_count": null, 13 "metadata": { 14 "collapsed": true 15 }, 16 "outputs": [], 17 "source": [ 18 "from scapy.all import *" 19 ] 20 }, 21 { 22 "cell_type": "code", 23 "execution_count": null, 24 "metadata": { 25 "collapsed": false 26 }, 27 "outputs": [], 28 "source": [ 29 "record1_str = open('raw_data/tls_session_compromised/01_cli.raw').read()\n", 30 "record1 = TLS(record1_str)\n", 31 "record1.msg[0].show()" 32 ] 33 }, 34 { 35 "cell_type": "code", 36 "execution_count": null, 37 "metadata": { 38 "collapsed": false, 39 "scrolled": true 40 }, 41 "outputs": [], 42 "source": [ 43 "record2_str = open('raw_data/tls_session_compromised/02_srv.raw').read()\n", 44 "record2 = TLS(record2_str, tls_session=record1.tls_session.mirror())\n", 45 "record2.msg[0].show()" 46 ] 47 }, 48 { 49 "cell_type": "code", 50 "execution_count": null, 51 "metadata": { 52 "collapsed": true 53 }, 54 "outputs": [], 55 "source": [ 56 "# Suppose we possess the private key of the server\n", 57 "# Try registering it to the session\n", 58 "#key = PrivKey('raw_data/pki/srv_key.pem')\n", 59 "#record2.tls_session.server_rsa_key = key" 60 ] 61 }, 62 { 63 "cell_type": "code", 64 "execution_count": null, 65 "metadata": { 66 "collapsed": false 67 }, 68 "outputs": [], 69 "source": [ 70 "record3_str = open('raw_data/tls_session_compromised/03_cli.raw').read()\n", 71 "record3 = TLS(record3_str, tls_session=record2.tls_session.mirror())\n", 72 "record3.show()" 73 ] 74 }, 75 { 76 "cell_type": "code", 77 "execution_count": null, 78 "metadata": { 79 "collapsed": false 80 }, 81 "outputs": [], 82 "source": [ 83 "record4_str = open('raw_data/tls_session_compromised/04_srv.raw').read()\n", 84 "record4 = TLS(record4_str, tls_session=record3.tls_session.mirror())\n", 85 "record4.show()" 86 ] 87 }, 88 { 89 "cell_type": "code", 90 "execution_count": null, 91 "metadata": { 92 "collapsed": false 93 }, 94 "outputs": [], 95 "source": [ 96 "record5_str = open('raw_data/tls_session_compromised/05_cli.raw').read()\n", 97 "record5 = TLS(record5_str, tls_session=record4.tls_session.mirror())\n", 98 "record5.show()" 99 ] 100 } 101 ], 102 "metadata": { 103 "kernelspec": { 104 "display_name": "Python 2", 105 "language": "python", 106 "name": "python2" 107 }, 108 "language_info": { 109 "codemirror_mode": { 110 "name": "ipython", 111 "version": 2 112 }, 113 "file_extension": ".py", 114 "mimetype": "text/x-python", 115 "name": "python", 116 "nbconvert_exporter": "python", 117 "pygments_lexer": "ipython2", 118 "version": "2.7.13" 119 } 120 }, 121 "nbformat": 4, 122 "nbformat_minor": 2 123} 124