Created
November 3, 2020 20:12
-
-
Save pawlos/7ea00c307c21bee6dee547f9b60c50a2 to your computer and use it in GitHub Desktop.
Solution to Flare-on 2020's challenge no 2 - garbage
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
def decrypt(text, alphabet): | |
l = 0x66 | |
cnt = len(text) | |
i = 0 | |
res = [] | |
while i < cnt: | |
res.append(chr(text[i] ^ ord(alphabet[i%l]))) | |
i += 1 | |
return ''.join(res) | |
from struct import unpack,pack | |
fileName = b"\x3b\x02\x0e\x38"[::-1] | |
fileName += b"\x34\x1b\x3b\x19"[::-1] | |
fileName += b"\x3e\x23\x0c\x1b"[::-1] | |
fileName += b"\x42\x11\x08\x33"[::-1] | |
fileName += b"\x73\x1e\x12\x39"[::-1] | |
alphabet = "nPTnaGLkIqdcQwvieFQKGcTGOTbfMjDNmvibfBDdFBhoPaBbtfQuuGWYomtqTFqvBSKdUMmciqKSGZaosWCSoZlcIlyQpOwkcAgw " | |
alphabet2 = "KglPFOsQDxBPXmclOpmsdLDEPMRWbMDzwhDGOyqAkVMRvnBeIkpZIhFznwVylfjrkqprBPAdPuaiVoVugQAlyOQQtxBNsTdPZgDH " | |
content = b"\x2c\x33\x23\x23"[::-1] | |
content += b"\x49\x64\x3f\x0e"[::-1] | |
content += b"\x04\x0a\x1e\x0a"[::-1] | |
content += b"\x1a\x02\x16\x23"[::-1] | |
content += b"\x24\x08\x66\x44"[::-1] | |
content += b"\x2c\x74\x11\x32"[::-1] | |
content += b"\x0f\x42\x2d\x2a"[::-1] | |
content += b"\x0d\x64\x50\x3e"[::-1] | |
content += b"\x17\x1b\x04\x5d"[::-1] | |
content += b"\x05\x03\x36\x16"[::-1] | |
content += b"\x08\x09\x20\x34"[::-1] | |
content += b"\x0e\x24\x21\x63"[::-1] | |
content += b"\x58\x34\x14\x15"[::-1] | |
content += b"\x3a\x79\x29\x1a"[::-1] | |
content += b"\x58\x56\x00\x00"[::-1] | |
content += b'\x54'; | |
print(decrypt(fileName, alphabet2)) | |
print(decrypt(content, alphabet)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment