Created
March 5, 2017 10:57
-
-
Save CreateRemoteThread/27b4239965917b1cecc78aeaffa34732 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
import string | |
# k = [int(z) for z in "26 25 30 28 22 25 20 23 21 29 22 24 26 23 21 26 27 20 28 22 25 23 30 29 23 28 24 20 21 26 25 20 23 27 23 29 25 22 23 26 27 29 24 23 30 21 25 24 26 20 24 22 21 30 26 20 25 24 21 23 27 29 26 22 20 21 23 22 30 26 29 26 28 27 22 20 27 29 26 30 28 27 26 23 29 21 22 25 27 24 21 29 25 24 20 25 23 22 30 28 27 29 25 20 24 21 23 20 23 21 29 26".split(" ")] | |
k = [26, 29, 21, 23, 20, 23, 21, 24, 20, 25, 29, 27, 28, 30, 22, 23, 25, 20, 24, 25, 29, 21, 24, 27, 25, 22, 21, 29, 23, 26, 27, 28, 30, 26, 29, 27, 20, 22, 27, 28, 26, 29, 26, 30, 22, 23, 21, 20, 22, 26, 29, 27, 23, 21, 24, 25, 20, 26, 30, 21, 22, 24] | |
# k.reverse() | |
currentNum = 0 | |
lastNum = 0 | |
outString = "PRAGYANCTF{" | |
while True: | |
if currentNum == 0: | |
x = raw_input(" %s > " % outString).rstrip() | |
else: | |
x = raw_input(" %s [%d][%c] > " % (outString,currentNum,chr(currentNum ^ 61))).rstrip() | |
if x == "g": | |
lastNum = k.pop() | |
currentNum += lastNum | |
elif x == "p": | |
currentNum -= lastNum | |
k.append(lastNum) | |
lastNum = 0 | |
elif x == "s": | |
outString += chr(currentNum ^ 61) | |
currentNum = 0 | |
elif x == "d": | |
print outString | |
print k | |
else: | |
print "g : get another number" | |
print "p : push a number back onto the stack" | |
print "s : save a character" | |
print "d : print debug" | |
# print k.pop() | |
# print k.pop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment