Skip to content

Instantly share code, notes, and snippets.

@nk0t
Created September 29, 2013 13:33
Show Gist options
  • Save nk0t/6752560 to your computer and use it in GitHub Desktop.
Save nk0t/6752560 to your computer and use it in GitHub Desktop.
tkbctf2 SkillAnalyzer (Binary 350)
import sys
a = [2, 3, 5, 7, 11, 13, 17]
b = [132, 110, 112, 38, 112, 96, 33, 115, 194, 104, 87, 118, 3, 105, 50, 103, 99, 75, 9, 85, 74, 72, 92, 78, 188, 16]
c = [4, 84, 0, 162, 72, 144, 64, 138, 16, 0, 8, 2, 0, 8, 0, 163]
print "You're the DJ of this gig!"
print '========'
for c1 in c:
print '{0:08b}'.format(c1)[::-1].replace('0', ' ').replace('1','-')
print '========'
numArray = [0] * 16
for i in range(16):
n = 1
str = raw_input()
if str == '':
n = 1
else:
if str[0] == 'S':
str = str[1:]
n = 19
for c in str:
if '1' <= c <= '7':
n = a[ord(c) - ord('1')] * n % 255
else:
print 'Oops.'
sys.exit(0)
numArray[i] = n
for i in range(len(b)):
index = i % 16
n = numArray[index]
b[i] = b[i] ^ n
numArray[index] = (n + 36) % 255
r = ''.join([chr(a) if a <= 126 else '?' for a in b])
print r
'''
S157
3
1
3
4
137
6
47
36
157
246
2
You're the 7th dan player!
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment