Created
September 30, 2018 03:17
-
-
Save ctnguyenvn/036b76716610f70205decb5cb8a5edf4 to your computer and use it in GitHub Desktop.
challenge ransomware file decode D-CTF
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
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