kirk-bond / ACSC-2018

1 stars 2 forks source link

QA/QC decoder #136

Closed pyrodie18 closed 5 years ago

pyrodie18 commented 5 years ago
  1. base64 = base64 encoded string
  2. base32 = base32 encoded string
  3. reverse = reverse the order of the string (abc -> cba)
  4. CaseInvert = swap the capitalization of the strig (AbC -> aBc)
  5. rot13 = encode the string with 'rot_13'
    • Required Resources: The encoded string
    • Flag: acsc18{ItsOnlySlightlyScrambled}

When you are done with the QA/QC, please enter a comment stating so and how you would rate the difficulty . If you see any issues please note them in the comment as well.

Difficulty key

0 - No background 3 - JCAC (Basic) 6 - Scripting (Senior) 9 - Reverse Engineer (Master)

Instructions: For each new challenge complete the above information. Assign the "QA/QC" and "Load Game Engine", labels to all challenges. If required add "Dockerize" and "Challenge Server" for challenges that need to be dockerized or will have to be hosted on the challenge server

ghost commented 5 years ago

Tested and confirmed working. Attached is a decoder script to be able to decode any message. Difficulty-5

!/usr/bin/env python3

import base64 import codecs

in_file = open("output.txt", 'r')

encoded_raw_data = in_file.read()

encoded_raw_data = encoded_raw_data[:-1]

while (True): try: enc_type, enc_data = encoded_raw_data.split("... <", 1) except ValueError as e: break enc_data = enc_data[:-1]

if enc_type == "base32":
    encoded_raw_data = base64.b32decode(enc_data).decode('utf-8')
    continue
elif enc_type == "base64":
    encoded_raw_data = base64.b64decode(enc_data).decode('utf-8')
    continue
elif enc_type == "reverse":
    encoded_raw_data = enc_data[::-1]
    continue
elif enc_type == "Rot13":
    encoded_raw_data = codecs.decode(enc_data, 'rot_13')
    continue
elif enc_type == "CaseInvert":
    encoded_raw_data = enc_data.swapcase()
    continue

print(encoded_raw_data)

ghost commented 5 years ago

60 points