Skip to content

Instantly share code, notes, and snippets.

@CreateRemoteThread
Created October 26, 2019 02:43
Show Gist options
  • Save CreateRemoteThread/1ff2e0e49866583565f9a586daaac4cd to your computer and use it in GitHub Desktop.
Save CreateRemoteThread/1ff2e0e49866583565f9a586daaac4cd to your computer and use it in GitHub Desktop.
#!/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