Skip to content

Instantly share code, notes, and snippets.

@ctnguyenvn
Created September 30, 2018 03:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ctnguyenvn/036b76716610f70205decb5cb8a5edf4 to your computer and use it in GitHub Desktop.
Save ctnguyenvn/036b76716610f70205decb5cb8a5edf4 to your computer and use it in GitHub Desktop.
challenge ransomware file decode D-CTF
import string
from random import *
import itertools
def caesar_cipher(x, y):
y = y * (len(x) / len(y) + 1)
return ('').join((chr(ord(a) ^ ord(b)) for a, b in itertools.izip(x, y)))
f = open('./FlagDCTF.pdf', 'r')
buf = f.read()
f.close()
allchar = string.ascii_letters + string.punctuation + string.digits
password = ('').join((choice(allchar) for _ in range(randint(60, 60))))
buf = caesar_cipher(buf, password)
f = open('./youfool!.exe', 'w')
buf = f.write(buf)
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment