Skip to content

Instantly share code, notes, and snippets.

@ahhh
Created May 3, 2015 17:25
Show Gist options
  • Save ahhh/625c24bddb2822bda7ac to your computer and use it in GitHub Desktop.
Save ahhh/625c24bddb2822bda7ac to your computer and use it in GitHub Desktop.
VolgaCTF 2015 Quals Interstellar
offset = "01111101001000101000000111101001001011111110010011100111010011000010101101110110100001101011100101001110000000001101000110001011011010101001000000010010001100011001100011001011010101111011110110001100101100101000110011101111101101000110110010101001100100110100010101101111101111011001100011111101"
string = "From a seed a mighty trunk may grow.\n"
#string_entered = "01000110011100100110111101101101001000000110000100100000011100110110010101100101011001000010000001100001001000000110110101101001011001110110100001110100011110010010000001110100011100100111010101101110011010110010000001101101011000010111100100100000011001110111001001101111011101110010111000001010"
tmp = len(offset)
result = [None] * tmp
'''finalString = []
for i in range(0, len(result) >> 3):
tmpString = 0
for j in range(0,8):
tmpString = (j + result[8*i] - 2 * tmpString) +48
finalString.append(tmpString)
#print(finalString)'''
fuckit ="01000110011100100110111101101101001000000110000100100000011100110110010101100101011001000010000001100001001000000110110101101001011001110110100001110100011110010010000001110100011100100111010101101110011010110010000001101101011000010111100100100000011001110111001001101111011101110010111000001010"
for i in range(0, len(offset)):
if (fuckit[i]== '1'):
temp = offset[i]
else:
temp = str(int(offset[i]) ^ 1)
result[i] = temp
fuckit2 = ''.join(result)
v16 = int(fuckit2,2)
finalString=""
for i in range(0,36):
s = (v16 % 307)
finalString = finalString + chr(int(s))
v16 = v16 - s;
v16 = v16 // 307;
print (finalString)
flag = finalString[::-1]
print (flag)
[email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment