From: Neil Smith Date: Fri, 25 Nov 2016 11:18:06 +0000 (+0000) Subject: Done 2016 challenge 6 X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=5aa4a19e1e3e141e47e7b867130013a92e18de10;p=cipher-training.git Done 2016 challenge 6 --- diff --git a/2016/2016-challenge6.ipynb b/2016/2016-challenge6.ipynb new file mode 100644 index 0000000..93431fc --- /dev/null +++ b/2016/2016-challenge6.ipynb @@ -0,0 +1,202 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import os,sys,inspect\n", + "currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))\n", + "parentdir = os.path.dirname(currentdir)\n", + "sys.path.insert(0,parentdir) \n", + "\n", + "import matplotlib.pyplot as plt\n", + "%matplotlib inline\n", + "\n", + "from cipherbreak import *\n", + "\n", + "c6a = open('6a.ciphertext').read()\n", + "c6b = open('6b.ciphertext').read()" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'\\nPZAED IRAHN NESGU AVMNJ TVFHR OAFUA ZHEQG UGSTN ZAPCE EUOYD EPLII WIAGS YGWUA CUZEZ MSGZA IWTUG UTZTJ SSFSF RTUGL UEFEQ GUGLO OWAZS JBJEE JOELO NNOVV SHKPV UIBFF EGMGZ EBLHR JHNUK RJSUW HNVTB KPRFD NDOGG FGAMR GNYAN RSNQL HRFSN OEEWW NLCUA NTGNR GFGZE YSPGG PFZEJ SSHKI AYHNV BRWNP GMCJO ZASRV AAVAA SUGGM NLEQK CNFFY SGTWD GZEFL RRSMS GRNFA YQSVK WRZAI WATWN GKOAL HROAL LOVFT RJVVW WUAMN FDVSM UGPVF GGZIF OIYDG VNEHK EAGUT ZTBMN ESVRD TUASZ QSGWR LANGZ EZWAA LIZWI PSLYW DVFAS WWSSV BMRFO IGZTU WEGBE AWSGW NJZOS GLYGW RVMNJ TVFTB SLBUA YTAAC HRASP SREQI AYOHL AYDCN KHGJA AKAPL IBFSV FAAWF SGRGL OFLAL GFSYR VVWUA CUASN DIGLL RARBF IPYII WNGZE JSYJW FBMNQ ZIZZE VKTES VRDLV FGHFD RJTUW NNEEW SMRKA AVIJG NQWRR VISLH NLWNK AUANG LHNLH RKTVD LUSSS WEYAN TKFBJ JNEEY AAUWI FMSVF GNXAX WPNKS CGRGO HVUHJ SSTGO QWNBM GULOS GOYLH RTAAC AAVIN ELBGK VFGSG RJSRQ LORPA ZANVF GVLAF AAZFO GKUEW HBOHR OOHDD USVRG BGSIA WDBFE BXTUA SDMAY ATLGU GKIQW TUWTE SDROE USVRL IRVHV KNBJW RYINF TESNF SCGAO AKTBS NNUCB MNGAN FOIGR EEDAA VWUAC UAGHW SFASA GSHJP EASRO EUSDG ZEHKU NDDVX FVUUY LIRKG RLTVF GNUCR KSSJO ZLHRK WVKSN MTUGR VLIRK BHLTU ANTKA EWAYG TRSSV WRGZE EWTUS NGZEL MSRVT BTENF DJATU UOBHE ESTVG NSJOZ LHRXI FAGNA NRVAP UEFKT BSSGJ OAYBB PHRDD VFMNJ TVFSA WWASM RLHRW NPDOF WDYWT GWRSJ OZLHN LBBPP EGMVK EFLOF ZEQDI TZTBF HVKRB DEVFA YDTUA SOMTH FFBJT HFAGW LLATV KATSI AWNPJ YCLEQ SNQLH VKTVE EGZEP APUWR VKAOA TFLRB FGRJT USNGZ EBFEF OEUSV RTERF DRSLV FGJAT UACBM LQOAV LFBJT UWIAL EENIR OWVLH ZSRGA NOMTV ZAIWA SWEYA NTLHN LTUWI ALEEN IROWV DLTGB RLTRJ ISAKA GWZGR RANNV VNFCR KOVOI YDSCW NQSLV LTYWT VEENF AYQSV FGVLI ALHRZ OCWOS YEGLI AYAOJ ENCOA WTUAN TLHNL PHRZY WSZWT UWMNF ATWRN LTUWS JASFT AACMR FTVGN RVTUS TGZEY SSGLI ZWHRK AJEAE LIAAN CWRFG NUWWN KTESV RDLVF GJATU SYBMN TOOZS NNFDG ZEQWS PJICL IBFSB MNQWD NDOGD IXWJN EEYAA VVIQF TCACX MPBFT UASNL FVJSG TEPSU FWINK SHEEQ LHNLT UASJS SCJIB JTBZE EVENL HOMTJ ZEAAC UWCXW DGZEQ STRKI GVIQF TGAEH HTUWY FWEZL OUSVR TERFA GLHRT AACTB YEGZE ELHEW EQSYF SFGWR WSMRD INKDR STUEO EWLNL EEZAE JY\\n'" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "c6a" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "('nsa', -2139.1561825446256)" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "key_a, score = vigenere_frequency_break(sanitise(c6a))\n", + "key_a, score" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "charlie i have found martin he was camped out at a hacker collective in oslo which he must have thought was safe but turned out to be a major error to avoid suspicion from the other hackers he had to spend alot of time online and the nsa were watching one of the laptops he was using had been compromised and an automated scan flagged the stream for analysis we have agents on the way to interview him and i am hoping this will give us enough to unravel this mystery in the meantime i called in a few favours with the et jen esten who followed martin to a local bank he is carrying out all cash transactions in an effort to stay off grid which is a little ironic given the way we found him he is travelling under the name james and i wondered if that was a hint that he still has feelings for jamelia he is using a fake passport which was goodenough to fool the bank and i am looking forward to examining it asia m not sure how he would have obtained one of this quality outside the trade we have tied his norwegian transactions to an account in switzerland which i guess is no surprise we had the usual difficulties getting access from the swiss authorities but things area lot easier there than they used to be and with cooperation from the f is i gained access to a strongbox held in martins new name the enclosed letter from that box promises to shed light on his role in all this but unfortunately it is again encrypted and this time the cipher is abit stronger than the ones we have been dealing with i could wait for the interview with martin but i have a feeling that the interview will go better if i know more in advance so i will spend a little time analysing it in the hope of getting a break one thing that puzzles me the manager at the swiss bank mentioned that the last time he saw martin in person he was travelling with a young woman and the description sounded alot like jamelia i didnt pickup on this at first because i assumed that this was prior to her death but when i checked the dates it didnt tie up they seem to have been at the bank together three days after jamelia s death more later harry\n" + ] + } + ], + "source": [ + "print(wcat(segment(vigenere_decipher(sanitise(c6a), key_a))))" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "[(' ', 315),\n", + " ('I', 117),\n", + " ('E', 113),\n", + " ('R', 102),\n", + " ('V', 101),\n", + " ('M', 90),\n", + " ('T', 77),\n", + " ('B', 76),\n", + " ('K', 74),\n", + " ('G', 74),\n", + " ('Z', 61),\n", + " ('L', 59),\n", + " ('X', 57),\n", + " ('F', 54),\n", + " ('W', 53),\n", + " ('A', 51),\n", + " ('C', 51),\n", + " ('P', 46),\n", + " ('J', 46),\n", + " ('S', 43),\n", + " ('Y', 41),\n", + " ('H', 41),\n", + " ('N', 37),\n", + " ('U', 32),\n", + " ('O', 29),\n", + " ('Q', 28),\n", + " ('D', 23),\n", + " ('\\n', 1)]" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "collections.Counter(c6b).most_common()" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "('trainer', -1995.616991556106)" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "key_b, score = vigenere_frequency_break(sanitise(c6b))\n", + "key_b, score" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "jamelia what do you think about this do you think dynamix would fund it proposal long baseline signal noise analysis in largescale heterogeneous networks m traynor and jd almar abstract in our work on signal noise analysis for ligo we have developed new tools for digital analysis of extremely low amplitude signals in an excessively noisy environment the classical features of this analysis are the exploitation of very long baseline signal collection and the synthesis of signals from a large sensor network to filter the noise the principle novel feature is the development of a large database of templates of target signals that allow them to be filtered from the noise and interpreted in realtime we believe this approach can be adapted to a wide variety of signal harvesting problems both within and outside the physical sciences as an example of a commercial application of the technology we have carried out analysis of a toy model which suggests that this approach maybe sensitive enough to track individual footfall across a shopping centre or airport concourse and to carryout gait analysis using seismometers embedded in the building fabric this would provide a new and less obtrusive alternative to the camera systems currently in use it has not escaped our attention that the template bank approach should scale to allow tracking of multiple targets and to search for patterns that may signal antisocial or potentially even terrorist behaviour patterns more speculatively the long baseline techniques which are key to triangulating the source of gravitational waves could be modified to provide a template based network analysis tool for finding long range correlations in network traffic this analysis could signal activity spikes among transnational criminal or terrorist groups triggering surveillance and targeting early intervention to prevent crime\n" + ] + } + ], + "source": [ + "print(wcat(segment(vigenere_decipher(sanitise(c6b), key_b))))" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.5.2" + } + }, + "nbformat": 4, + "nbformat_minor": 1 +} diff --git a/2016/6a.ciphertext b/2016/6a.ciphertext new file mode 100644 index 0000000..9173fe7 --- /dev/null +++ b/2016/6a.ciphertext @@ -0,0 +1,2 @@ + +PZAED IRAHN NESGU AVMNJ TVFHR OAFUA ZHEQG UGSTN ZAPCE EUOYD EPLII WIAGS YGWUA CUZEZ MSGZA IWTUG UTZTJ SSFSF RTUGL UEFEQ GUGLO OWAZS JBJEE JOELO NNOVV SHKPV UIBFF EGMGZ EBLHR JHNUK RJSUW HNVTB KPRFD NDOGG FGAMR GNYAN RSNQL HRFSN OEEWW NLCUA NTGNR GFGZE YSPGG PFZEJ SSHKI AYHNV BRWNP GMCJO ZASRV AAVAA SUGGM NLEQK CNFFY SGTWD GZEFL RRSMS GRNFA YQSVK WRZAI WATWN GKOAL HROAL LOVFT RJVVW WUAMN FDVSM UGPVF GGZIF OIYDG VNEHK EAGUT ZTBMN ESVRD TUASZ QSGWR LANGZ EZWAA LIZWI PSLYW DVFAS WWSSV BMRFO IGZTU WEGBE AWSGW NJZOS GLYGW RVMNJ TVFTB SLBUA YTAAC HRASP SREQI AYOHL AYDCN KHGJA AKAPL IBFSV FAAWF SGRGL OFLAL GFSYR VVWUA CUASN DIGLL RARBF IPYII WNGZE JSYJW FBMNQ ZIZZE VKTES VRDLV FGHFD RJTUW NNEEW SMRKA AVIJG NQWRR VISLH NLWNK AUANG LHNLH RKTVD LUSSS WEYAN TKFBJ JNEEY AAUWI FMSVF GNXAX WPNKS CGRGO HVUHJ SSTGO QWNBM GULOS GOYLH RTAAC AAVIN ELBGK VFGSG RJSRQ LORPA ZANVF GVLAF AAZFO GKUEW HBOHR OOHDD USVRG BGSIA WDBFE BXTUA SDMAY ATLGU GKIQW TUWTE SDROE USVRL IRVHV KNBJW RYINF TESNF SCGAO AKTBS NNUCB MNGAN FOIGR EEDAA VWUAC UAGHW SFASA GSHJP EASRO EUSDG ZEHKU NDDVX FVUUY LIRKG RLTVF GNUCR KSSJO ZLHRK WVKSN MTUGR VLIRK BHLTU ANTKA EWAYG TRSSV WRGZE EWTUS NGZEL MSRVT BTENF DJATU UOBHE ESTVG NSJOZ LHRXI FAGNA NRVAP UEFKT BSSGJ OAYBB PHRDD VFMNJ TVFSA WWASM RLHRW NPDOF WDYWT GWRSJ OZLHN LBBPP EGMVK EFLOF ZEQDI TZTBF HVKRB DEVFA YDTUA SOMTH FFBJT HFAGW LLATV KATSI AWNPJ YCLEQ SNQLH VKTVE EGZEP APUWR VKAOA TFLRB FGRJT USNGZ EBFEF OEUSV RTERF DRSLV FGJAT UACBM LQOAV LFBJT UWIAL EENIR OWVLH ZSRGA NOMTV ZAIWA SWEYA NTLHN LTUWI ALEEN IROWV DLTGB RLTRJ ISAKA GWZGR RANNV VNFCR KOVOI YDSCW NQSLV LTYWT VEENF AYQSV FGVLI ALHRZ OCWOS YEGLI AYAOJ ENCOA WTUAN TLHNL PHRZY WSZWT UWMNF ATWRN LTUWS JASFT AACMR FTVGN RVTUS TGZEY SSGLI ZWHRK AJEAE LIAAN CWRFG NUWWN KTESV RDLVF GJATU SYBMN TOOZS NNFDG ZEQWS PJICL IBFSB MNQWD NDOGD IXWJN EEYAA VVIQF TCACX MPBFT UASNL FVJSG TEPSU FWINK SHEEQ LHNLT UASJS SCJIB JTBZE EVENL HOMTJ ZEAAC UWCXW DGZEQ STRKI GVIQF TGAEH HTUWY FWEZL OUSVR TERFA GLHRT AACTB YEGZE ELHEW EQSYF SFGWR WSMRD INKDR STUEO EWLNL EEZAE JY diff --git a/2016/6b.ciphertext b/2016/6b.ciphertext new file mode 100644 index 0000000..297ddf4 --- /dev/null +++ b/2016/6b.ciphertext @@ -0,0 +1 @@ +CRMMY MRPYA BQSPH LTPVR BTSOC GXYBJ DWLSL MYIVX HPGRM QKAFN CDNHR UBKPZ BTFLR LTBRX URSMY MEXJI OAECG FIARE ETCYA VWZGC AZTIJ VRLMU IKXIO ORRVH LSVRX NHIKA ZXITP NWEEE WADIY QRKRB AGVRV KIVBY IPFRS BRJBX NIYRF BJEIA ECRJI ASSIE ZGWJI YTMEL RZVEF PMQRV PKOWY WWHID QTMKT CAVNP PLZSW SIOMI EURPP EFWIZ TCBKU LRWZZ EATFM ETEEF PIJLZ VMYCE HZSGR RMBIO VZIEM KHMPP RLJIK NPWXR TCEIJ HWTPV WRGRL GFMJT IEBUI VQGLW VXRMZ OVBJM XIYTB RXURS MYMEX JIOAE CVFLT RGKBF NIAHK AVSGA XYXJI ABJJB XNIYW WKFMI YEIZV SMAWF KEEBJ SIDKO NVPKX ITPRR FBJEB UIGKZ NKVTC XEODR PWXRT CEIZL KHMQI MXCOX ZIEMF FIYEI ZVDIG ESTJE WSXVF GLIGI JHWTI EKVMJ IOAEC LKHIG ECEFW BUIDM FBMSM CMVRM QJIHD TPRRF BJEIA HZGKE ZCVVM VDQAV VTCTQ ZINXS ETVIM XKHQF EGIIO IPLTT EBMNH RIKEL GSRPZ DMIEI BVTGB JJBXN IYLRK MEAGM EZGRW OPVFJ BWGLN BKHQA EEWFU BFMUX KHMCL PLZCI YWTBV NKRWR LRNMK EDICE WSETH DMMEG ZTCAX CPZVR TQBRF YKHMG ITAEO TBKPP VHIII TTIRQ RHFNK AVNPP LZSWS EKHPM WQICP YIKUW LZXEA GWKAR TBUMJ TGPZB ETADA GOIJX ESQGM MXVNW HKYMF TZNGB BEDQI MUNRL NBSKY RLTNG IHJSI FLFIG IVTGV GKRMB VRBIP WEXTH ECWHV JXRNL GSTTI RGBYK ZRIBN RREPS QFYJB EGARM JFFMM GIILV MJRHU XUIVG LVULI TQMEZ WAJEM TMYIA JSLEU PZBZZ WVAVR ARGUL MFWFU KRCFM MXRLB RVETK IDRXF MYEKN QVKRS GFXVF JCCEV VGKLG VRLLV IBUEJ GFTMF GRIVD WHVRM KEVGM FGKHI GXYXK EUCPR MVBIA ORIGR WNGYL YOCYH JVRLM GSREC OEGVR VBIVT SWFLL BVTCX KAZTI KLRNL GSJXR RKUJF KGABG IIGJT PNXDT PSQTR RERNB VWFVZ ATBVG HKEVG MRECY MIIEM VRZBV ZLKBM UEMBF UZCEK MVRVF QFKVS XRGLE RTQII CRKHM YSEZS AARPZ GVTMP LEBHU MFAYB THIEI BXPTW GVZTE GCYEK BEGBU IJHLR KRSWZ IADVX RMZOV NPNTM EAPSL EUBMZ SUBWI MQXFI IODVH VTKEU CPRMV BIFIU GVTEB VBTEA TLWZL KOWYJ FKWIV QMEZC OVTVR GXEKB VIXCA BVSEL ZNVRX NHIKB EEWYZ CBUMJ TEATL WZLTO CYHJB XNIYE TMZVQ GCJIZ KMFED HEGBE EELEA BVSET CCZVQ ZGRLW EXVKI OZVWK ZIOCC WKKZG ORVZG XSCEZ VBCLI AGVTE DBNVX XKIVT IRKCY QAXVK MEVGM FGKOX EIMXE TKEMD X