Created
June 25, 2020 13:38
-
-
Save Darth-Carrotpie/746c1b486360e98baa4a4c7e0f5fc609 to your computer and use it in GitHub Desktop.
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 base64 | |
import binascii | |
decodedFlag = 'That would have been too easy ^^' | |
encodedFlag = b'646a310e2d261f1121013717516236040e01161b183b2a0a0f54095126112f300e1d231b500705690e20103e01163423010e251727775331112f000c27013b200e1d2308390c3d0e2d2616330e1567570f2b3215390a3e202b5a006b' | |
def __encode_flag(decodedFlag): | |
print(decodedFlag.encode('utf-8')) | |
b64encoded = base64.b64encode(decodedFlag.encode('utf-8')) | |
print(b64encoded) | |
barray = [] | |
i = 0 | |
while i < len(b64encoded): | |
barray.append(b64encoded[i] ^ b64encoded[((i + 1) % len(b64encoded))]) | |
i = i + 1 | |
encodedFlag = binascii.hexlify(bytearray(barray)) | |
return encodedFlag | |
def __decode_flag(encodedFlag): | |
print('You are suppose to work a bit') | |
def main(): | |
print('Try to decode this:') | |
print("b'646a310e2d261f1121013717516236040e01161b183b2a0a0f54095126112f300e1d231b500705690e20103e01163423010e251727775331112f000c27013b200e1d2308390c3d0e2d2616330e1567570f2b3215390a3e202b5a006b'") | |
hint = __encode_flag(decodedFlag) | |
print(hint) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment