Skip to content

Instantly share code, notes, and snippets.

@kos0ng
Created February 22, 2021 03:43
Show Gist options
  • Save kos0ng/4d3177efb93e5eaf9b8aadc4d9c90e91 to your computer and use it in GitHub Desktop.
Save kos0ng/4d3177efb93e5eaf9b8aadc4d9c90e91 to your computer and use it in GitHub Desktop.
darkCON CTF 2021 - CyberDark0x01: ShitComp [ RE ]
from Crypto.Util.number import bytes_to_long as b2l
f=open("Installer.shitty","r")
plain=f.read()
f.close()
v4 = "CyberDarkIsACoolGameAndIWannaPlayIt"
file = ""
for i in range(0,len(plain),3):
v8 = ord(v4[i%len(v4)])
v9 = v8
v11 = (v9>>4)&0xff
for j in range(0xff+1):
v10 = (j^v8)&0xf
tmp = v10 | 16 * ( v11 ^ ((j>>4)&0xff))
if(tmp==ord(plain[i])):
v8 = ord(v4[(i+2)%len(v4)])
v9 = v8
v11 = (v9>>4)&0xff
for k in range(0xff+1):
v10 = (k^v8)&0xf
tmp2 = v10 | 16 * ( v11 ^ ((k>>4)&0xff))
if(tmp2==ord(plain[i+2])):
v8 = ord(v4[(i+1)%len(v4)])
v9 = v8
v11 = (v9>>4)&0xff
for l in range(0xff+1):
v10 = (l^v8)&0xf
tmp3 = v10 | 16 * ( v11 ^ ((l>>4)&0xff))
if(tmp3==ord(plain[i+1])):
file+=chr(j)*b2l(chr(l)+chr(k))
break
break
break
file+="\x00"*15
f=open("original","wb")
f.write(file)
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment