Monday, 9 November 2015

cipher - Justice and Fairness: Part 2


A friend of yours was part of a secret society and was put on trial on 15 December 2014 without a lawyer. Alice encrypted the trial's transcript and sent it to Bob, but double agent Carol was able to e-mail a copy of the ciphertext to you. Your friend desperately needed help from a lawyer, but you were unable to provide one with the plaintext so that you could relay the proper advice back to your friend.


RESULTS OF TRIAL: Your friend was executed on 26 December 2014, and the rest of your friend's family followed on 20 January 2015.


Recently, Carol was able to intercept communications containing a rather ominous message. It seems that your friend's secret society has learned of the work you and your associates have been conducting and are less than pleased. Your life appears to be in jeopardy unless you solve the mystery of your friend's trial by the end of this quarter. If you fail, you will find out if there is an afterlife.


E-mail: Show




URGENT: Carol just intercepted the following e-mail. Someone must be watching out for you.


E-mail: Show





Can you produce the plaintext for the message below to prevent your untimely demise?


Ciphertext: Show




Hint 31:


The telephone at your desk begins to ring, and after answering, you hear a recorded message spoken with a distorted voice coming from the earpiece. "This is your friend Randall, and I have the dynamic-link library you requested for managing the reputation of the users on your web site. Please let Adam know that he needs to nag a ram and avoid Pan if he wishes to ever understand his wife."




Hint 32:


While walking back from lunch, Victor flags you down in the hall and urges you to check your inbox as soon as you get back to your office. It is easy to spot his e-mail once seated at your desk as it is marked as a high priority message which summarizes some findings reported to him by our corporate firewall. In each of the three encoded e-mails you received last week, a nonstandard X-Security-Warning: SOS header was ominously included.





Hint 33:


Just as on Monday, your telephone starts ringing; and upon picking it up, you hear the voice of Paul over in customer service. "In a meeting this morning, a friend told me that you only have sixteen more days until DIE takes you out, and something has been bothering me over the past couple of weeks. Does all the information we have mesh together such that there are no conflicts or contradictions among the multitude of observations?"




Hint 34:


Inspectors from Myutsu Mutucsoecul Corporation have been hired yet again in the interest of verifying Paul's question from last week. After reviewing the past five weeks since their last audit, Alloy believes he has found some inconsistencies. "One might infer an unproven relationship between ciphertext and primer from Trudy's question, and the data Chuck provided does not appear to allow proper decryption."




Hint 35:


"Don't you think this is unmerited discrimination against fresh workers?" Without waiting for Alloy to respond, Cobalt continues her defense of Trudy by showing that M1 and M2 provided by Team Bolt (as the Clingans are now calling themselves) have an even number of alpha characters as does the primer. "Furthermore, changes in the ciphertext match the profile of Chuck's key, so there could be some sort of clerical misunderstanding."




Hint 36:



Back again but somewhat under the weather, Blastus apologizes for missing his meeting with you yesterday but reveals he was verifying a letter from someone called Velociraptor. This mysterious individual must have wanted to contribute something to your friend's case without being involved in the investigative process. A familiarity with Team Bolt's work is evident since Velociraptor's writing directly utilizes data taken from their test.


Letter: Show




Hint 37:


A familiar name from Tenebris Lamina shows up in your inbox, but Dave has a significantly larger message for you than he did the last time he sent you an e-mail.


E-mail: Show




Hint 38:


Some people would look at her name and think she was their grandestmother, but this individual from Nigrum Gladio upholds her organization's name in a different way.


E-mail: Show





Hint 39:


Your computer announces a new e-mail with a rather humorless tone, and upon seeing who the unread message is from, you can only wonder if the devilish saber is meant for you or for your enemy.


E-mail: Show



Answer



The plain text of payload.me is:



Congratulations! Laziness, impatience, and hubris could not withhold the prize
of this puzzle from you. Your actions are deserving of a reward, but if joy is
a part of satisfaction, can attaining this goal be beaten? Spoils for the 1st!

Yes, there is more to saying you are 1st to read this. If the latter be valid,

then you have treasure to retrieve. Go to http://www.gog.com/redeem and see if
the following codes can be claimed. These be the diadem reserved for a victor.

WZZL-WE4D-WLLD-RQHN
WF79-KCSX-36Y5-9FTU
DD9DB-7E243-F133C-95C75



Hint 36


If you don't want to write your own implementation go to http://code.activestate.com/recipes/578075/ for existing Python code. This puzzle is pretty much impossible to do without Python.


Hint 37


The message body reads




The disk jockey appears to be a reference to Dreary Jeans.



The body is really long so I won't repeat it hear since probably won't display correctly. Here are the first few hundred characters


(b\'p/H5Od+#_"{\\\\sf;<:^\\nE[J&QkWDS\\x0bT*B,]Pbcy\\x0
c07qUw(63`@Lo}ZeaYGC%zmRF9uM|.v-1N>2\\t A\\\'hi!Ixtl=?g
X4j$n~8KV)\\rr\',\n b\'3Tv+ Y9cnK%7ao*db6ryu@\\x0b)=~m?
4W`>f<#MhNX1-ljIe(].Z\\t/|58wRE{tP![GS0A}kq"x2Oi$H;psgQ
LJCD:\\\\B\\x0c\\nU_,\\\'\\r^zV&F\',\n b\'UGZ]\\n@{lgkb
hH>nup4^ML6\\\'})7R.Pq[E\\\\9Q\\x0bOK_mBjs;#!y-`o2W\\r0Ca3\',


I appreciate the 'hi!' in the first line. I hope that as intentional. This is likely not the key for the payload.me, that key should only contain alphanumerics. The important things to note are that it looks like a tuple of binary strings so you know we're dealing with Python 3.x. Also all control characters are no actually there \n is two different characters, you will need to map those back to control characters. In the end you should have a 160 strings, each containing a scrambled copy of string.printable.


Hint 38


message body reads



Has man's rib caused yet another fall? Yes, but this time it is on death itself.



after decoding payload.py doesn't look super useful. It's 1788 mostly random characters (which I'm not even going to try to include). The operating assumption is that this is a message encrypted with the key above. We're still missing the primer.


Hint 39


I just used http://www.dcode.fr/ascii-85-encoding to convert between ASCII85 and hex, then decode as usual. I don't think I even bothered with the body. primer.data looks like it could be a primer. Again, the decode text is really ugly so I'm not going to try to include it.



The important thing it is the primer for the key and cipher text of the last two hints. When decrypted you get:


import itertools
import random
import re
import string

import markov_encryption as me

###############################################################################


encode = lambda s: s.encode('ascii')
decode = lambda b: b.decode('ascii')


def main():
ciphertext, primertext, keytext = load_puzzle_data()
plaintext = generate_plaintext(primertext, keytext, ciphertext)
key, primer = create_key_and_primer(plaintext)
globals().update(locals())



def load_puzzle_data():
with open('ciphertext.txt') as file:
ciphertext = file.read()
with open('transcript_primer.txt') as file:
primertext = file.read()
with open('transcript_key.pickle') as file:
keytext = file.read()
return ciphertext, primertext, keytext



def generate_plaintext(primertext, keytext, ciphertext):
primer = me.Primer(encode(primertext))
key = me.Key(tuple(map(encode, keytext.split('\n'))))
decrypter = me.Decrypter(key, primer)
plaintext = decode(decrypter.process(encode(ciphertext)))
return plaintext


def create_key_and_primer(plain):

primer = ''.join(m.groups()[0] for m in re.finditer(r'\((.)\)', plain))
base = []
for c in itertools.chain(filter(str.isalnum, plain),
string.ascii_letters,
string.digits):
if c not in base:
base.append(c)
key = ''.join(base)
randomizer = random.Random()
for i in map(ord, primer):

randomizer.seed(i)
randomizer.shuffle(base)
key += '\n' + ''.join(base)
p = me.Primer(encode(primer))
k = me.Key(tuple(map(encode, key.split('\n'))))
return k, p

###############################################################################

if __name__ == '__main__':

main()

This is pretty straightforward, load the cipher text, primer and key (from part 1) and decrypt. Then use the decrypted text as input in create_key_and_primer to generate a new key and primer containing only alpha numeric comparators which can be used to decrypt the payload.me, atleast if you use Python 3.x. There were enough changes to random between 2 and 3 that even with the same seed I still got a wrong answer on 2.7 until I switched over to 3.4.


No comments:

Post a Comment

Understanding Stagnation point in pitot fluid

What is stagnation point in fluid mechanics. At the open end of the pitot tube the velocity of the fluid becomes zero.But that should result...