Skip to content

Instantly share code, notes, and snippets.

@diofeher
Created April 1, 2018 02:07
Show Gist options
  • Select an option

  • Save diofeher/feca93ddcdf33dd800d9b84ae50ebd4b to your computer and use it in GitHub Desktop.

Select an option

Save diofeher/feca93ddcdf33dd800d9b84ae50ebd4b to your computer and use it in GitHub Desktop.
import re
from base64 import b64decode
import pprint
story1 = '''
It's somewhat dark in here, but the walls (unbroken except for the door by
which I entered) encircle an area no more than eight feet in diameter.
It's horribly dank and dusty--no one can have been in here for years.
Is that an open envelope over there on the floor?
It seems there is a letter inside. Thank heavens it's in English.
Susanna:
I've been here for days, mystified by the writings on the walls of
these pagodas. I have no idea what purpose they serve for these
temples, shrines, whatever they may be. What I do know is that
they have inspired me to create a series of sculptures for you.
They have shone like a Beacon in the night. I have a clear Image
of what I must now undertake.
-- Walter De Maria
'''
story2 = '''
This Pagoda is much cleaner than the first. It seems that someone keeps
this one nice and tidy. There's a pool occupying nearly the entire floor
inside. If I squint my eyes, I can see koi swimming beneath the
reflections on the surface of the water.
Ah well, let's see what mysteries the text on the wall of this Pagoda contains.
'''
story3 = '''
This pagoda is yet again unlike the others.
Its walls are rimmed with high-set windows, no doubt to
illuminate the statue found in the middle of the floor.
Google translate helps me identify the inscription in Mandarin
kanji on the statue's base, "He who devised the eight trigrams."
I suppose I have him to thank for all this work.
But what message do the symbols on these walls communicate?
It doesn't seem to work just right.
'''
# FuXi is the creator!
b64alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
mapping = {
'111111': 1,
'000000': 2,
'010001': 3,
'100010': 4,
'010111': 5,
'111010': 6,
'000010': 7,
'010000': 8,
'110111': 9,
'111011': 10,
'000111': 11,
'111000': 12,
'111101': 13,
'101111': 14,
'000100': 15,
'001000': 16,
'011001': 17,
'100110': 18,
'000011': 19,
'110000': 20,
'101001': 21,
'100101': 22,
'100000': 23,
'000001': 24,
'111001': 25,
'100111': 26,
'100001': 27,
'011110': 28,
'010010': 29,
'101101': 30,
'011100': 31,
'001110': 32,
'111100': 33,
'001111': 34,
'101000': 35,
'000101': 36,
'110101': 37,
'101011': 38,
'010100': 39,
'001010': 40,
'100011': 41,
'110001': 42,
'011111': 43,
'111110': 44,
'011000': 45,
'000110': 46,
'011010': 47,
'010110': 48,
'011101': 49,
'101110': 50,
'001001': 51,
'100100': 52,
'110100': 53,
'001011': 54,
'001101': 55,
'101100': 56,
'110110': 57,
'011011': 58,
'110010': 59,
'010011': 60,
'110011': 61,
'001100': 62,
'010101': 63,
'101010': 64,
}
def transpose(pangoda_text):
pangoda_text = pangoda_text.replace('---------', '1').replace('--- ---', '0').replace(' ', '').strip()
arr = [list(l) for l in pangoda_text.splitlines()]
return [''.join(line) for line in zip(*arr)]
text = '''
--------- --------- --- --- --- --- --------- --- --- --- --- --- --- --------- --- --- --------- --------- --------- --- --- --- --- --- --- --------- --- --- --- --- --------- --------- --------- --------- --- --- --------- --- --- --------- --- --- --------- --------- --- --- --- --- --------- --- --- --- --- --------- --------- --- --- --------- --------- --------- --- --- --------- --- --- --------- --------- --------- --- --- --------- --- --- --- --- --------- --------- --- --- --------- --- --- --- --- --- --- --------- --------- --------- --- --- --------- --- --- --------- --------- --- --- --- --- --- --- --------- --------- --------- --- --- --------- --------- --------- --------- --- --- --- --- --- --- --------- --- --- --- --- --------- --- --- --- --- --------- ---------
--- --- --- --- --- --- --- --- --------- --- --- --- --- --- --- --- --- --------- --- --- --------- --- --- --- --- --- --- --------- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --------- --------- --- --- --- --- --------- --------- --------- --- --- --- --- --- --- --- --- --- --- --------- --------- --- --- --------- --- --- --------- --- --- --- --- --------- --------- --- --- --- --- --------- --------- --------- --- --- --- --- --- --- --- --- --- --- --------- --------- --- --- --- --- --- --- --------- --- --- --------- --------- --- --- --- --- --------- --- --- --------- --- --- --------- --------- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --------- --------- --------- --- --- --------- --------- --- --- --------- ---------
--- --- --- --- --------- --------- --- --- --- --- --------- --------- --------- --- --- --------- --------- --- --- --- --- --------- --------- --- --- --- --- --- --- --------- --- --- --- --- --------- --------- --- --- --- --- --------- --------- --- --- --------- --- --- --------- --- --- --------- --------- --- --- --------- --- --- --------- --------- --- --- --- --- --- --- --------- --------- --- --- --------- --- --- --------- --- --- --------- --- --- --------- --- --- --- --- --- --- --------- --------- --------- --- --- --------- --------- --------- --------- --- --- --- --- --- --- --------- --------- --------- --- --- --------- --- --- --- --- --------- --- --- --- --- --------- --------- --------- --------- --- --- --------- --- --- --------- --------- --- ---
--- --- --- --- --------- --- --- --------- --- --- --------- --------- --------- --------- --- --- --------- --------- --- --- --------- --- --- --------- --- --- --- --- --------- --------- --- --- --------- --- --- --------- --- --- --- --- --- --- --------- --- --- --- --- --------- --------- --------- --------- --------- --- --- --- --- --------- --------- --------- --- --- --------- --- --- --- --- --- --- --------- --- --- --- --- --------- --- --- --- --- --------- --- --- --------- --------- --------- --------- --------- --------- --------- --- --- --- --- --- --- --- --- --------- --- --- --- --- --------- --- --- --- --- --- --- --- --- --- --- --------- --- --- --------- --------- --------- --------- --- --- --------- --- --- --------- --------- --- --- ---------
--- --- --- --- --- --- --------- --------- --------- --------- --------- --- --- --- --- --- --- --- --- --------- --------- --- --- --------- --------- --------- --- --- --- --- --------- --- --- --------- --- --- --------- --------- --------- --------- --------- --------- --- --- --------- --------- --- --- --- --- --- --- --- --- --------- --------- --------- --------- --------- --------- --- --- --- --- --- --- --- --- --------- --- --- --- --- --------- --- --- --------- --------- --------- --------- --------- --- --- --- --- --- --- --- --- --------- --------- --------- --- --- --- --- --------- --------- --------- --------- --- --- --- --- --------- --- --- --- --- --- --- --------- --- --- --------- --- --- --- --- --- --- --------- --- --- --- --- --------- --- --- ---------
--- --- --- --- --- --- --------- --------- --- --- --------- --------- --------- --- --- --------- --- --- --------- --- --- --- --- --- --- --------- --------- --- --- --- --- --------- --- --- --- --- --- --- --------- --- --- --------- --- --- --------- --- --- --- --- --------- --------- --------- --- --- --------- --------- --------- --------- --- --- --------- --- --- --------- --- --- --------- --- --- --------- --------- --------- --- --- --------- --- --- --------- --- --- --- --- --------- --- --- --------- --------- --------- --------- --------- --------- --------- --- --- --------- --- --- --------- --- --- --------- --------- --------- --------- --- --- --------- --- --- --- --- --------- --------- --------- --------- --- --- --------- --------- --- --- --- --- --- --- ---------
'''
ans = transpose(text)
text = ''
for i in ans:
text = text + str(b64alphabet[mapping[i]-1])
print 'encoded: '+text+'='
print b64decode(text + '=')
print '[+] ' + b64decode('bmV4dDogU3RyYW5nZXIgVGhpbmdz')
text2 = '''
--------- --- --- --------- --------- --------- --- --- --------- --------- --------- --- --- --------- --------- --------- --- --- --------- --- --- --- --- --------- --------- --- --- --------- --- --- --------- --------- --------- --- --- --------- --------- --------- --------- --- --- --- --- --------- --------- --- --- --------- --------- --- --- --------- --- --- --------- --- --- --------- --- --- --------- --------- --------- --------- --------- --- --- --------- --- --- --------- --------- --------- --- --- --------- --- --- --------- --- --- --------- --- --- --------- --------- --------- --- --- --------- --------- --------- --- --- --- --- --- --- --------- --- --- --- --- --------- --------- --------- --------- --------- --- --- --- --- --------- --------- --- --- --------- --- --- --------- --------- --- --- --------- --- ---
--- --- --------- --------- --------- --------- --- --- --------- --------- --- --- --- --- --------- --------- --- --- --- --- --- --- --- --- --------- --- --- --- --- --- --- --- --- --------- --------- --------- --------- --- --- --------- --------- --- --- --- --- --- --- --------- --------- --- --- --- --- --- --- --- --- --- --- --- --- --------- --------- --------- --------- --- --- --- --- --- --- --------- --------- --------- --- --- --------- --------- --- --- --- --- --------- --- --- --------- --------- --------- --- --- --- --- --- --- --- --- --------- --- --- --- --- --------- --------- --- --- --- --- --------- --- --- --- --- --------- --------- --- --- --- --- --- --- --------- --- --- --- --- --- --- --------- --- --- --- --- --- --- --------- --- --- --------- --------- --------- --- ---
--------- --- --- --------- --- --- --------- --- --- --------- --- --- --- --- --------- --- --- --- --- --------- --- --- --------- --------- --------- --------- --- --- --------- --------- --- --- --------- --- --- --------- --- --- --------- --- --- --- --- --------- --------- --- --- --------- --- --- --- --- --- --- --- --- --- --- --------- --------- --------- --- --- --------- --------- --- --- --- --- --- --- --- --- --------- --- --- --- --- --------- --------- --- --- --- --- --------- --------- --- --- --------- --- --- --- --- --- --- --------- --- --- --- --- --- --- --- --- --------- --------- --------- --------- --- --- --- --- --- --- --------- --------- --- --- --- --- --- --- --------- --- --- --------- --- --- --- --- --- --- --------- --------- --- --- --------- --- --- --------- ---------
--- --- --- --- --------- --------- --- --- --- --- --------- --------- --------- --------- --------- --------- --------- --- --- --------- --------- --------- --------- --------- --------- --------- --- --- --------- --------- --- --- --- --- --------- --------- --------- --------- --------- --------- --- --- --- --- --- --- --------- --------- --- --- --------- --- --- --- --- --- --- --- --- --------- --------- --- --- --------- --------- --- --- --- --- --------- --- --- --------- --- --- --------- --- --- --- --- --- --- --- --- --------- --------- --- --- --------- --- --- --------- --- --- --------- --- --- --------- --- --- --- --- --- --- --- --- --- --- --------- --- --- --- --- --------- --------- --------- --- --- --- --- --------- --- --- --- --- --------- --- --- --------- --- --- --- --- --------- ---------
--- --- --- --- --- --- --- --- --------- --------- --- --- --- --- --------- --- --- --------- --- --- --- --- --------- --------- --------- --------- --- --- --------- --------- --- --- --- --- --- --- --- --- --------- --------- --- --- --- --- --------- --- --- --- --- --------- --- --- --------- --- --- --------- --------- --- --- --- --- --------- --- --- --- --- --------- --------- --------- --- --- --------- --- --- --------- --------- --- --- --------- --- --- --- --- --------- --- --- --------- --- --- --- --- --------- --------- --- --- --- --- --------- --- --- --- --- --------- --- --- --- --- --------- --- --- --------- --- --- --- --- --- --- --- --- --- --- --- --- --------- --- --- --- --- --------- --- --- --------- --------- --- --- --- --- --------- --- --- --- --- --- --- --- ---
--------- --- --- --- --- --------- --------- --- --- --------- --------- --------- --------- --------- --------- --------- --- --- --------- --------- --- --- --- --- --------- --------- --------- --- --- --- --- --------- --------- --- --- --------- --------- --------- --- --- --- --- --- --- --------- --- --- --- --- --- --- --------- --------- --------- --- --- --------- --- --- --- --- --------- --------- --- --- --------- --------- --------- --- --- --------- --- --- --------- --- --- --------- --------- --------- --- --- --------- --- --- --------- --------- --------- --- --- --------- --------- --- --- --- --- --------- --- --- --------- --- --- --------- --- --- --------- --- --- --------- --------- --------- --- --- --------- --- --- --------- --- --- --------- --- --- --------- --------- --------- --- --- --- --- --- ---
'''
ans = transpose(text2)
text2 = ''
for i in ans:
text2 = text2 + str(b64alphabet[mapping[i[::-1]]-1])
print 'encoded: '+text2
print b64decode(text2)
print '[+] ' + b64decode('QnJvdGhlciBvZiBOdXdh')
text3 = '''
--- --- --- --- --------- --------- --------- --- --- --------- --------- --- --- --- --- --------- --- --- --------- --- --- --- --- --- --- --------- --- --- --- --- --- --- --- --- --- --- --------- --- --- --------- --------- --- --- --- --- --------- --- --- --------- --------- --------- --------- --------- --------- --------- --------- --------- --------- --- --- --------- --------- --- --- --- --- --- --- --------- --------- --- --- --- --- --------- --- --- --- --- --- --- --------- --------- --- --- --------- --- --- --------- --------- --------- --- --- ---------
--------- --------- --- --- --- --- --------- --------- --- --- --- --- --- --- --------- --- --- --------- --- --- --------- --- --- --- --- --------- --------- --- --- --- --- --- --- --------- --- --- --- --- --------- --------- --- --- --- --- --- --- --------- --- --- --- --- --- --- --------- --- --- --- --- --- --- --------- --- --- --- --- --------- --- --- --- --- --------- --------- --------- --- --- --------- --- --- --- --- --- --- --------- --- --- --- --- --- --- --------- --- --- --- --- --- --- --- --- --------- --------- --- --- ---------
--- --- --- --- --------- --- --- --- --- --- --- --- --- --- --- --- --- --------- --------- --------- --- --- --- --- --- --- --- --- --- --- --------- --------- --- --- --- --- --------- --------- --------- --- --- --------- --------- --- --- --- --- --------- --- --- --- --- --- --- --------- --------- --- --- --------- --------- --- --- --- --- --------- --------- --------- --------- --- --- --------- --------- --- --- --- --- --------- --------- --- --- --------- --------- --- --- --- --- --- --- --------- --------- --------- --- --- --------- ---------
--- --- --- --- --------- --- --- --------- --- --- --- --- --- --- --------- --- --- --------- --- --- --------- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --------- --- --- --- --- --------- --------- --- --- --------- --- --- --------- --- --- --- --- --- --- --------- --- --- --------- --- --- --- --- --- --- --- --- --------- --- --- --- --- --------- --- --- --------- --- --- --- --- --- --- --- --- --- --- --------- --- --- --------- --- --- --------- --------- --------- --- --- --------- --- --- --------- --- --- --- ---
--------- --------- --------- --- --- --------- --- --- --- --- --- --- --------- --- --- --------- --------- --------- --------- --------- --- --- --------- --- --- --- --- --- --- --------- --- --- --------- --- --- --------- --------- --------- --- --- --------- --- --- --------- --- --- --------- --------- --- --- --------- --------- --------- --- --- --------- --------- --- --- --------- --- --- --------- --------- --------- --------- --------- --- --- --------- --- --- --- --- --------- --- --- --- --- --------- --------- --------- --------- --------- --- --- --------- ---------
--- --- --------- --- --- --------- --- --- --------- --- --- --------- --- --- --------- --------- --------- --- --- --- --- --------- --------- --- --- --- --- --------- --------- --- --- --------- --- --- --------- --- --- --------- --- --- --------- --- --- --------- --------- --------- --- --- --------- --------- --- --- --- --- --------- --------- --------- --- --- --------- --- --- --- --- --- --- --------- --- --- --- --- --- --- --------- --- --- --------- --- --- --------- --------- --------- --- --- --- --- --- --- --------- --- --- --------- --------- ---------
'''
# ans = transpose(text3)
# text3 = ''
# for i in ans:
# text3 = text3 + str(b64alphabet[mapping[i[::-1]]-1])
# print ''.join([b64alphabet[c] for c in text3]) + '='
# print b64decode(''.join([b64alphabet[c] for c in text3]) + '=')
# print b64decode('x7dd4URgwII5XfKS6ybPoW/24MxSXTgvXMvY/PdRpAakq5/6MbpX91Bnl/ar4B1'+'=')
# python3 shifty.py -k FuXi -if base64 c7xa4CWatQN5RcSX6syXtQ/24JfXRQoaRJdD/JaZuUxsv5/6GyxC91Vkt/fl4Y1=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment