+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "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",
+ "c8a = open('8a.ciphertext').read()\n",
+ "c8b = open('8b.ciphertext').read()\n",
+ "\n",
+ "c8as = sanitise(c8a)\n",
+ "c8bs = sanitise(c8b)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "(matrix([[ 7, 8],\n",
+ " [11, 11]]), -5760.41300554484)"
+ ]
+ },
+ "execution_count": 9,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "key_a, score = hill_break(sanitise(c8a))\n",
+ "key_a, score"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false,
+ "scrolled": true
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "[('a', 312),\n",
+ " ('l', 243),\n",
+ " ('x', 228),\n",
+ " ('r', 220),\n",
+ " ('c', 216),\n",
+ " ('j', 214),\n",
+ " ('d', 210),\n",
+ " ('i', 208),\n",
+ " ('b', 207),\n",
+ " ('o', 198),\n",
+ " ('h', 192),\n",
+ " ('u', 183),\n",
+ " ('z', 169),\n",
+ " ('s', 163),\n",
+ " ('m', 162),\n",
+ " ('g', 160),\n",
+ " ('w', 145),\n",
+ " ('q', 143),\n",
+ " ('n', 140),\n",
+ " ('f', 135),\n",
+ " ('k', 133),\n",
+ " ('p', 132),\n",
+ " ('v', 131),\n",
+ " ('y', 128),\n",
+ " ('e', 120),\n",
+ " ('t', 90)]"
+ ]
+ },
+ "execution_count": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "collections.Counter(c8as).most_common()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "charlieandtrinityithinkwehavecomeascloseaswecantoasolutiontothisveryoddcaseofadeadwomanwhoneverdiedaweaponthatneverexistedandagovernmentinitiativethathadnothingtodowiththegovernmentmartinandjameliawereputinaterriblepositionihadntrealisedjusthowbaduntilireadtheattacheddocumentthatirecoveredfrommartinsandjameliasharddriveittellsthewholestorythesyndicateprobablythoughttheywerebeingcleverwhentheyfakedjameliasdeaththerewasaclearthreatthatonceherdeathwasrecordedassuicidetheycoulddisposeofherintheirownwayandintheirowntimeifshefailedtocooperatewhattheyfailedtorealiseisthatonceshewasofficiallydeadnoonewouldbelookingoutforheranditmadeitaloteasierforhertodisappearwhenshewantedtohavingbeencutloosefromthegovernmentthesyndicatewererelyingonsourcesintheinternationalintelligencecommunitytocarryoutsurveillanceforthembutnoonewouldbewatchingforaghostandtoomanyquestionswouldhavebeenaskediftheyrequestedasearchonceshewasofficiallydeadithinkthatdynamixrealisedearlyonwhatthetemplateapproachcoulddoforlargescalenetworkanalysisandtheyrealisedthatjameliahadthetalentandmartintheambitiontomakeitworkasasmallcompanytheyhadnothingtolosebyinvestinginitbutwhencitadelleheardrumoursthattheywereworkingonsomethingbigtheyrealisedthatthiscouldbethebreakthroughtheyneededtheirmassiveinvestmentinconventionalbattlefieldweaponrythreatenedtobecomeobsoleteonthecyberbattlefieldandtheyweresearchingforsomethingnewtorevitalisethecompanyatfirstithinktheygenuinelymisunderstoodwhatdynamixwereworkingontheconfusionbetweengravitywavesandgravitationalwavesledeveryonetoassumethatdynamixwerehopingtoweaponizeseismicactivityperhapsviaaresonanceeffectbutthiswasneveraboutaweaponofmassdestructionasjameliasexposemakescleariamnotsureatwhatpointthepostdigitalsurveillancesyndicategotinvolvedtheywereinitiallysetuptoprepareforatimewhendigitalsurveillanceisnolongereffectiveaquantumtechnologiesenvironmentinwhichthecontentofcommunicationsisencryptedsosecurelythatnoalgorithmcancrackitwithoutbetrayingitspresencetheywerekeepingacloseeyeonallthesoftwaredevelopmentteamsatarmsmanufacturersandhadkeptjameliaandmartinunderobservationwhenworkingfordynamixtheywerecertainlyquicktorealisethepotentialofthesignalnoiseanalysistechniquesthepairhaddevelopedforgravitationalwavedetectionatsomepointthoughsomeonerealisedthefundamentalflawinusingatemplatebasedapproachwhichinabetterworldwouldhaveledtotheendoftheprojectunfortunatelysomeevilgeniusatthesyndicatesawasolutionandgiventheobviouslimitsongovernmentactioninthisspheretheydecidedtoleverageprivatesectorinvolvementgiventheirhungerforrelevancecitadellewereanobvioustargetandwerebroughtintothepictureunfortunatelyforthesyndicatesomeoneatcitadelleblabbedtoaseniorcivilservantandthewholeoperationwasterminatedthejunioroperativesweredispersedamongotherdepartmentsbutthemajorplayerswereretiredwenowknowthattheremainsofthesyndicatecontinuedtooperatewithcitadelleanddynamixfundingagovernmentdepartmentnolongeriwasthrownbymartinscalltothephonelinkedtocitadelleduringtheinterviewlastweekandforamomentthoughtthathewasworkingwiththembutofcoursehewasnotphoningcitadelleifwetrackthephonewewillfindjameliawithnorealresourcesoftheirownsheandmartinseemstohaveplayedtheblackhatsattheirowngametakingwhattheyneedastheypreparedtodoublecrossthemyoumightaskwhysheisnotmakingmoreofanefforttohidefromthesyndicateanditsalliesbutthatisthebeautyofthewaytheyhavethissetupmartinstimewiththecollectivehasbeenspentseedingcopiesofthefileontoeveryserverhecouldfindifanythinghappenedtothemnowitwouldbeimpossibleforthesyndicatedynamixorcitadelletosuppresstheinformationitwouldfloodthewebtheirapparentcarelessnessweakencryptionandpoorlyhiddendocumentsmartinsappearanceonbanksurveillancecamerasandhisvisibilityonthewebwereallpartofaschemetoensuretheauthoritiesgotsuspiciousasortofinsurancepolicyitforcedthesyndicatetoprotectthemhencethehighqualitytraveldocumentstogetrealprotectionjameliahadtomakesuretheirstorycouldntbesquashedsotheyhadtobuytimesheandmartinagreedtoworkwiththesyndicateandtoconspireinjameliasfakeddeathandithinktheyconvincedthesyndicatetoletmartinjointhehackercollectivebypresentingitasagoodcoverfordatacollectionarguingthattheyneededtosetthebaselineforthebehaviouraltemplatesbutnowthebigquestiondowegopublicifwedoitwilllancetheboilandwehavearealchanceofbringingdownthesyndicateanditscollaboratorsinseveralmajorarmsmanufacturerswemightalsobeabletotracethetemplatetargetsontheotherhandifwedothatwealsoriskkillingjameliaandmartinoncethestoryispublicthereisnoreasonforthepdssyndicatetokeepthemaliveandeveryreasontosilencewitnessesidontknowwhatyouthinkbutithinkweneedtodealwiththisofflinetheoldfashionedway\n"
+ ]
+ }
+ ],
+ "source": [
+ "print(hill_decipher(key_a, c8as))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "charlie and trinity i think we have come as close as we can to a solution to this very odd case of a dead woman who never died a weapon that never existed and a government initiative that had nothing to do with the government martin and jamelia were putin a terrible position i hadnt realised just how bad until i read the attached document that i recovered from martins and jamelia s harddrive it tells the whole story the syndicate probably thought they were being clever when they faked jamelia s death there was a clear threat that once her death was recorded as suicide they could dispose of her in their own way and in their own time if she failed to cooperate what they failed to realise is that once she was officially dead no one would be looking out for her and it made it alot easier for her to disappear when she wanted to having been cut loose from the government the syndicate were relying on sources in the international intelligence community to carryout surveillance for them but no one would be watching for a ghost and too many questions would have been asked if they requested a search once she was officially dead i think that dynamix realised early on what the template approach could do for largescale network analysis and they realised that jamelia had the talent and martin the ambition to make it work as a small company they had nothing to lose by investing in it but when citadelle heard rumours that they were working on something big they realised that this could be the breakthrough they needed their massive investment in conventional battlefield weaponry threatened to become obsolete on the cyber battlefield and they were searching for something new to revitalise the company at first i think they genuinely misunderstood what dynamix were working on the confusion between gravity waves and gravitational waves led everyone to assume that dynamix were hoping to weapon ize seismic activity perhaps via a resonance effect but this was never about a weapon of mass destruction as jamelia s expose makes clear i am not sure at what point the post digital surveillance syndicate got involved they were initially setup to prepare for a time when digital surveillance is no longer effective a quantum technologies environment in which the content of communications is encrypted so securely that no algorithm can crack it without betraying its presence they were keeping a close eye on all the software development teams at arms manufacturers and had kept jamelia and martin under observation when working for dynamix they were certainly quick to realise the potential of the signal noise analysis techniques the pair had developed for gravitational wave detection at some point though someone realised the fundamental flaw in using a template based approach which in a better world would have led to the end of the project unfortunately some evil genius at the syndicate saw a solution and given the obvious limits on government action in this sphere they decided to leverage private sector involvement given their hunger for relevance citadelle were an obvious target and were brought into the picture unfortunately for the syndicate someone at citadelle blabbed to a senior civil servant and the whole operation was terminated the junior operatives were dispersed among other departments but the major players were retired we now know that the remains of the syndicate continued to operate with citadelle and dynamix funding a government department no longer i was thrown by martins call to the phone linked to citadelle during the interview last week and for a moment thought that he was working with them but of course he was not phoning citadelle if we track the phone we will find jamelia with no real resources of their own she and martin seems to have played the black hats at their own game taking what they need as they prepared to double cross them you might ask why she is not making more of an effort to hide from the syndicate and its allies but that is the beauty of the way they have this setup martins time with the collective has been spent seeding copies of the file on to every server he could find if anything happened to them now it would be impossible for the syndicate dynamix or citadelle to suppress the information it would flood the web their apparent carelessness weak encryption and poorly hidden documents martins appearance on bank surveillance cameras and his visibility on the web were all part of a scheme to ensure the authorities got suspicious a sort of insurance policy it forced the syndicate to protect them hence the high quality travel documents to get real protection jamelia had to make sure their story couldnt be squashed so they had to buy time she and martin agreed to work with the syndicate and to conspire in jamelia s faked death and i think they convinced the syndicate to let martin join the hacker collective by presenting it as a good cover for data collection arguing that they needed to set the baseline for the behavioural templates but now the big question do we go public if we do it will lance the boil and we have a real chance of bringing down the syndicate and its collaborators in several major arms manufacturers we might also be able to trace the template targets on the other hand if we do that we also risk killing jamelia and martin once the story is public there is no reason for the pds syndicate to keep them alive and every reason to silence witnesses i dont know what you think but i think we need to deal with this offline the oldfashioned way\n"
+ ]
+ }
+ ],
+ "source": [
+ "print(wcat(segment(hill_decipher(key_a, c8as))))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "[('0', 15368), ('1', 11257), (' ', 6508), ('2', 5920), ('\\n', 1)]"
+ ]
+ },
+ "execution_count": 19,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "collections.Counter(c8b).most_common()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "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.5.2"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}