{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "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 cipher.vigenere import *\n", "from cipher.bifid import *\n", "from support.utilities import *\n", "from support.text_prettify import *\n", "\n", "c7a = open('7a.ciphertext').read()\n", "c7b = open('7b.ciphertext').read()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'ELUOP PAIJO NPAVX VHLDQ ZCDUY LZVJK WTDVL VGZZE LLWKU AYMLF KUSSK PLOJZ EXHPK LZYGH VLHZD MSMXX PEXFV UHPPP ARAXP YQHXF INPJF EEHZT BHQJI QYQAE ZNQZT SEJIP XWZXS BEPDL MDYMP EYEEF LOLUE JIYJI YXFCE DMYIL HTRVV VLMLP DHLQY SEGOA VHLEA YIVHF JTSYX YHZLY SFYWW MKELC NOVHB AGLYG KILUN TLUCK MOAMO XFYPH BLFFI TEKHV WNYTM OXXIP CCAGA JCLMS GSYGL PASFI OWTPX KYHOV HLLUP OZLLW ELQWA HWPTC BUSUL LXTHH OISOV HXKLP OVBXG HZOMD RAAYT AVPUM TEMUI ZNELP AIJUH LMISL SWPSP PQFSR QOAGH SEWII JUJPP AXSBE OVHSD MZCIL RJIYT OUMNC WSBVF WLLJM OXLUS EMCIA FPMMD WWCCL QKMKV FDAAM XIPYW YSWFW PLHXA WJMLL XUYEZ ZWKFC PMPAS TYCLL UEJYS EWUEW HZSBP AFITE IJMFO XXWJR AYCLG LLLYG PQSIT YHCIT PSXLT TLQSD DTMNE LIZQM OXFCY LUVAW BEEIO XVHLC WUCSL EYQAV SGDTB JIHMF DMOXL USEGA RAUEC MJVSY YSBPA WPPTT LFWQD YWPWM FNYWJ IUHLW TPINL FDVLZ WMCFW MCLHP HBYIV HFDQR RSVZW AVIZN OYIKI JIETV VQYHT PJLVS GCTND EDYSE UVVXX YLWAW DFLNT SEVYS NBHAQ FPDWS GYHTP JZMVH LVVHF WBEEI FKGFZ YPJIL LPECW QGWZE AZIUW LOMZM JISEC HRMHT POHKF YZEGJ EJCAD VVGXI DPOYE ZWRYQ KRWJW TIIRG XPDIL PWLDL EAGWJ DFALL LYWWM KELCN CMYYL WLQCU EEMXC ILLLL ZQARV GQSNQ OAELT QEHPS IEOMN RGFPM OUEJY SEIOX WFTMW TIZNO PEVLK YNLZA PDUNL TSEUY SEMRE EIEOM DSDFL YMLFV USPPS MLHFD VVMLM PFYLV GGJYI YIOMY LWAHW MFQMY XUYAD CZIZN EFJYI FCLEM YRGLP JEHPS YGLPV XWPTE KLPDI NRVPO UUSLN VVWVX PUHVG ZWLCZ YFODL EAMLU SEBBS VYEYQ VTWQC PGDED MTSTS EUIEO MKRSG POGSH WNLPX LVVHL OMAEL CRLGS LYCSP UHGWV ENMWW MMPSB ZMZNE FWIEV YVDIU IZQYZ QAEYC EDMCR ALPOV BHGCC PXLLL AYTZB HZWYL ZIIEU DPPAX SXPZM KMNHP ENVWS QYZQA TALND MKWJU XWIKK FCSNB HQFUX ZEHXS BEOMJ MLIYZ ASEWQ CPDLA GBHPQ CVWNY TBHHW VTCKZ IVYSD MPXAP TEKHI ZNSEQ DHWCW WIAIJ YSEAA MKCGD QOXSB EOMDS ZMDTA FPSHL CMOXJ OQOVH OFUMD QOXXI PRIAS GZJMJ VPWPP TZAIJ IEEVL WWLPH AARWA LSKUE JVZWA VRSHT XQOJG YRLBV SXXLS MDXSB EPDLM DYMZB KIEYP DMOKF CCZBP RGGYP MIHSB PHSUE TMDTE ZIZNX ZZMOF UMEVL VWZQT LFPWL TEVLR SNFZJ HKFCV WIAWS QENMW WMMPS BAEZN EYMYE HJLPU HGWVE TZLZW QZSOU MFITE ALYIL PSBYY XLPOV BINCE NMSPG WPSBF FFYVL BUIWV OLPUS ANNLZ LLLLF QWUSK XYFWM RWYMO IOWWM DPVRE WQZYB HLLXY LMZMU LPIMA EZYET PDEKU HEQKI ECLWK LLKCS ENVCL CWLOL PWBEE CVFSX PRVLP DUSNV LLOSE TZBGW MDVVH FWBEQ WAWWN YZQAE JNPYM WIUHL WMLVX UYZVV MLCOP XEIYH TSAPL HUQZB YEHML PDPXU YWWWJ IZNQZ NSEZY MYWKI LCDTD KEZYS EIOXV YXTIS GWBOY IRRSV LQWFF TIWPP ARAGT SNVIY UEZWM HSBPH BHLLX PWILZ WLPHZ LHJUS RVPLK OASBB SEIEO VHLYH TGQSI FIPXW ZVGZQ QWSPW QZZBL FGNOP ZHIHJ LPPAE ZNEFW KILHT ZXLAF YSHVL ZWYGC MZIJB DLKZM ZNAPS LLWLP SEUMS FAIMA SFXWF WDVGN ZYLSY GWPSA PLLHZ OMZWW LAYMO ALOME VBSUW LVVHF SYGLP VXLIY OVHWA MLMPZ EUUYZ GSIJC EYMRV GQZEL LQAUW NMOXK LTQBH WLHPX MNRSL CLTHM UHLYQ MWLWP AABWW BEZBK IFLFE MDOFU MDAPA KYSEP AMOJT SAUSA NLWMY WJIYJ IYXLO ZMIUA GHVJL HIJFL DIDXS BHWIL ZWLZE BVRWL LNOUM CUEEQ AYGVL VTHXG NOPZH TWLAE WUWSQ OYIKR ABPMB HLLFW LBMID XLSMO XSBEO MAELM ENMWW MMPSB KPABN LAHIJ YSEMT MLZZE VBSEU PWJHV WXTDV VGSNY PXZIZ NDPON YKMNT BZMJY ENIYE ZWPNQ VZLUS EBJEX YSEMA MHMPO TSELU VFMOX ZNTHA RRAFZ YLUYG ZDRVP KFIWP JZXUY ADCZI ZNQZP JVSYD LVVMK MPCXW SXIWZ WAEWL PHALW SVLEI KEFXE LPAKF CELBZ WAMJW IUEJI QPTWQ SMLYL HIVCG ZZWSL MEDMB UWLOP ABJWL PSVPX JUXPJ VXKYX LRKIL WPAAB WWQEL PAPSY GPZAS FXTOM DXMVC ZVFEJ NYTBY EEZZO VHXUY ADCZI ZNQZA JMJNP XWPFW BEYML ALYMY WPXSF PCZVG XIPPZ NIVBR TPHHW QZSAZ MKSWL VHWWC ETZVL LOLJB PWJYG TVBIZ NSEQD XMIOP SJIZW JCWAW KCSWM AEZWF PVUMW WYPQJ WJYEF XTSUH TPUTE JAZCX LXSOO LZNEE ICQBB SHICO ILFGN OPUPE DWOYI UMLLL XALQS DQZMT EFYSE VPWLH PXCJS VSETB UIVCJ EQSEM KSRQO KFCJC ZHGKU HEKLT KODPP AWAHX ZZMWH YCOVH EKHTX MJRSX YPBAE FCCZV FEJNY TBYEE BETED IAPCP BUMEI CQALX GH\\n'" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "c7as = sanitise(c7a)\n", "c7ar = cat(reversed(c7as))\n", "c7a" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "('esullih', -3786.443520764479)" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "key_a, score = vigenere_frequency_break(sanitise(c7a))\n", "key_a, score" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "('usehill', -3786.443520764477)" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "key_a, score = vigenere_frequency_break(sanitise(c7ar))\n", "key_a, score" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "notes from interview with martin traynor in attendance mins a and reps from n is the suspect was carrying high quality identity documents in the name of james martin and claimed to be a dropout from a graduate programme in computer science in neuchatel his story checked out with the university authorities analysis showed a high degree of correlation between the biometrics of the suspect and of martin traynor but we did not reveal that we suspected james to be martin he refused requests to provide a dna sample for analysis stating that dna databases were a tool of oppression a search of the suspects belongings found no links with the uk at all despite the fact that voice characteristics suggest he spent a considerable amount of time there as a child the suspect stated that he had left all that behind and was not prepared to talkabout it taking care not to reveal what was already known about traynor s relationship with the swiss bank we turned to the suspects financial arrangements at first he claimed to work entirely on a cash basis and not to have a bank account but when pressed on this he could not or would not explain where he kept his cash reserve even when we pointed out that he appeared to be too well off for someone living hand to mouth pushing harder we revealed that we had footage of him in the lobby of a bank and he claimed that he had visited on behalf of the collective as part of a phishing expedition on a freelance penetration test of the banks security when challenged about the legality of this he claimed it was a white hat exercise and that no weaknesses had been found sono further action had been taken by the collective under further questioning however it became apparent that the suspect was talking about an entirely different bank from the swiss bank we had been monitoring he seemed to believe that we had footage of him in an oslo branch agents were sent to retrieve lobby footage of this bank and further analysis showed that his visits there tallied with the activities he described at interview however we also noticed that a woman matching dal mars description was often video ed at the same branch during the period under investigation when asked about this the suspect became highly agitated and repeatedly demanded to call his lawyer we pointed out that it was unusual for a member of a hacking collective to have a lawyer on retainer but the suspect refused to answer anymore questions until he had been allowed to make the call a call trace showed the mobile that he rang belonged to a lawfirm which works for the arms manufacturer citadelle the suspect was released on bail pending charges of conspiracy to engage in unauthorised access to computer technology at the bank and is being closely watched all calls to and from the lawfirm are being monitored and the oslo bank is under twentyfourseven surveillance conclusions we believe with near certainty that the suspect is martin traynor and that the woman in the footage is jamelia dal mar we believe they are in communication with one another and are both being protected by citadelle or one of its subsidiaries we believe that they are both living in or near oslo and that they are both now highly likely to be aware that the net is closing in we do not understand how dal mar contrived to fake her death and we still do not have a clear picture of the interaction between the pds syndicate dynamix and citadelle nor do we fully understand why they have a strong interest in traynor and dal mar we believe that some or all of that information maybe contained in the encrypted files on traynor s laptop which has been passed to forensics for analysis and to secure the data\n" ] } ], "source": [ "print(wcat(segment(vigenere_decipher(sanitise(c7ar), key_a))))" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'HTPEG WEEHW AOHCP NIRXE IEXZG OGDQK UEGBY KHWAO CDOTQ OTSLY OELDU MOSEQ OQYTP RNNIG ABADV QIAXV OODEE GWSSF QRGGS YEGWS SEQSX BTKBR FTGBY KBKEU QNETC KSOQB FOTSY QEOSU RBCTE KYORM TPLRA TTKMO BKEUO KCNDZ MROTR NCOYW QKPSH VTCVN FTQET CALWA VVFUK BSKFH RASAQ VFCRS GBTTT QWNEV YFRHE AQCHS QQTNN DPBTC PZEGR EAKKO HURRO CXNQG KNCQS TBSNQ BMTZO OSEBO RXKDE HEHRO YKEOB BFIKQ TTCIZ CCORU IHGYT IMBAH OAWOO ZSOQR OCDSS OQDGE YMKLO AQKXO BKPSF HSVLK WTEHN ATKTO UKNSI OCYDL TQGIT NUOCR KCEPO SRQCQ QCQSR HLWNO SKENN BTFLO LENAW BOCYT NETRN OWDEK SOQIP DWHEA WLOVV YFSCD OTLIN SOSYQ OPYNH TOCON RPTHN AWCOO DYTCO RETHL ULAEQ RPBNZ CSEHC ISDNR TNDTS PSQFC RBNPS YSRBE UELKE QTEYQ QLZLY KSOBD KNTGT WBURR BLQAK BSCVL IIUVT FQBPA KGSTC LSFSC KSKSO BAORE BQEVC BHQBL SVIQO ULKOT HQNFO IOSAH RATKT OXQUE HRYNB KPSKQ OFNWS EUOCX SOQYO VEFSC NREQS PUOED LFWKF ORUIN GTKGO ASDQS GEYMK QOPIO DEVSF NCERS QUPES OQYWB EKBQK PIADC OIUGN CTOII VOQBT ZCPEN BHZKA GOYCQ PCDET MIWFE BGEUE ORYCG SYEKM OQIPD AOCUI NGTHW AOQVT ETVCU BTOYS OQYBQ YBGLT NKVTF VQTFH STQES RQDEU MUKNS IOCYF ERRBL SRHQS THKPE TRPEW BEOSB QKQMP ZBRUE BLHTH HCSBD ACIGC YRENT HRAUQ NENKT ONOTW THUIK HIOOS GQEGO HXIRW TEINS QYFFQ NKTLT RSCNE TRGEY DANRL HFPTK TOFDQ TSOQR AGFTL HVNTS NYIIV OQETS BKFYO SEPQI VLTOY EHMIR WHEAW GOTBO QXRHR AKBRR GTXPR SEHFL RBIFL QOODE GAENO OUXWL ELSEH THMIR UDKQA DVTIH ROICC QTOYE HMIRI HWOIB CRQLP LWHEA WXOBO FYQEV RTRGX QLBQN TBYYR EBTRT TEENR MSDHQ OQXTC LOIFE QTHUA TOOUW BNTSI BDUKH SNQVR ARCTH VRSEC QSNSO QYSFH RGUTR OUREI OVUQP UTTLA VNVMT SLXDN HOAWB OEPGQ ECKEO THEAU OTUVL CLBPE QGCEE KQNTB GEUEO RYEBT QGELR SOQYV TTYHM IRVTT XHQOV FOKRK QFENK NOBLE LCQRR WGOEO LSOGE YNHUA TOVUF NHTZX DSTUL QFSCQ QGHYC NVSCU EURLK ASLOD TSBQR MRPET LMENH TASGS TFOTD HQTUN IWQIP OKOME GGFTT GOEXV TCMBM ARGEY NKFOS KTYEO BDUKB SEMCT RQVRI UITZB RYDCF SOSCQ RLIQO EAEBB SRQGP ECDAQ VBDUB GCYEQ ETSBK FYGEY NOUTE QTTNG SUQDK SYSGB ZUFKR LOBGT VWIWS OQOKD YSGBZ UCKRG EYIGO ENKKO MANE'" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "c7bs = sanitise(c7b)\n", "c7br = cat(reversed(c7bs))\n", "c7b" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('o', 138),\n", " ('t', 126),\n", " ('e', 124),\n", " ('q', 109),\n", " ('s', 103),\n", " ('r', 90),\n", " ('b', 77),\n", " ('k', 75),\n", " ('n', 73),\n", " ('c', 70),\n", " ('h', 63),\n", " ('g', 58),\n", " ('y', 57),\n", " ('i', 54),\n", " ('u', 54),\n", " ('l', 52),\n", " ('a', 51),\n", " ('f', 46),\n", " ('d', 43),\n", " ('v', 42),\n", " ('p', 37),\n", " ('w', 37),\n", " ('m', 25),\n", " ('x', 20),\n", " ('z', 15)]" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "collections.Counter(c7bs).most_common()" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(('ligo', , 4), -2067.501010592418)" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bifid_break_mp(c7bs, wordlist=['gravity', 'ligo'])" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'martin we have made a dreadful mistake and i have been too slow to admit that to myself i have had a visit from the woman from the syndicate and i confronted her about the source of the templates she confirmed my worst fears and now i want to crawl away and die what have we done our software has led to so much suffering when it was designed to do the opposite i asked her how the cabinet office could possibly have authorised this and she laughed and explained that the syndicate no longer worked for the british government call it private enterprises he said we have always been good at that my horror must have been written all over myfaces he didnt seem surprised at my reaction but equally she didnt take it well and civility was abandoned i asked her how it could be legal let alone moral to do what they proposed and her answer was that it was necessary i said we wouldnt help them and she said it was necessary that we did i said i wouldnt be able to face my family and friends if we cooperated and she said i wouldnt have to worry about that for long one way or another the pds syndicate were going to make sure we both disappeared looking back i can see that from the start this whole thing has acted to draw us into its centre and now i am at the event horizon almost unable to escape its pull but i think we have one last chance i am sure she will be visiting you as well she thinks we have no choice but i think a choice is all we have whatever you do hold out for better terms she has to believe that you are on side and motivated by greed so that she wont worry about any qualms you might have convince her that you will convince me to cooperate tell her that you think you should work from the collective in oslo and that you want payment via the bank in switzerland i got the impression that money is not a problem with money in a swiss bank and the expertise and connectivity afforded by the collective i think we have a chance to escape and to try to stop them perhaps we will survive this perhaps we can bring them down'" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "wcat(segment(bifid_decipher(c7bs, 'ligo', KeywordWrapAlphabet.from_a, period=4)))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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.6.3" } }, "nbformat": 4, "nbformat_minor": 1 }