Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env python3
f = open("out","rb")
data = f.read()
f.close()
state = False
a = []
for c in data:
if c == 0xd or c == 0xa:
state = True
continue
if state:
a.append(c)
# print("%02x" % c)
key = []
key.append(a[0] ^ ord('f'))
key.append(a[1] ^ ord('l'))
key.append(a[2] ^ ord('a'))
key.append(a[3] ^ ord('g'))
key.append(a[4] ^ ord('{'))
# key.append(a[5] ^ ord('y'))
key.append(0x2a ^ ord('_'))
key.append(a[6] ^ ord('0'))
# key.append(a[7] ^ ord('u'))
key.append(0x7b ^ ord('h'))
key.append(a[8] ^ ord('_'))
# key.append(a[9] ^ ord('c'))
key.append(0x5f ^ ord('_'))
# key.append(a[10] ^ ord('4'))
# key.append(a[11] ^ ord('n'))
# key.append(a[12] ^ ord('_'))
# key.append(0)
# key.append(0)
out = ""
import string
for i in range(0,len(a)):
oc = chr(a[i] ^ key[i % len(key)])
if oc in string.printable:
print("XORing %02x with index %d for %c" % (a[i],i % len(key),chr(a[i] ^ key[i % len(key)])))
out += oc
else:
print("XOR nonprintable")
out += "*"
print(out)
print("")
outhex = ""
for cx in out:
outhex += "%02x " % ord(cx)
print(outhex)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.