Interpret the Given Data: The data provided consists of several hexadecimal strings. Each string appears to be a representation of encoded data.
Convert Hex Strings to Bytes: We'll convert each hexadecimal string into bytes to get the original encoded data.
Base64 Decode the Bytes: The bytes obtained are Base64-encoded strings. We'll decode each one to get the actual data.
Concatenate the Decoded Data: We'll combine all the decoded data into a single byte array.
Decrypt Using XOR and the Key "piratt:": We'll XOR each byte of the combined data with the bytes of the key "piratt:" (note that this key is 7 bytes long).
Interpret the Decrypted Data: The result should be a readable string, potentially a flag or message.
hex_strings = [
"4d7a3030476b3157",
"526c74474a44416e",
"4d56684455444968",
"5256394557445967",
"4d3146465554636d",
"526c704356445664",
"44513d3d"
]
byte_arrays = [bytes.fromhex(s) for s in hex_strings]
2. Base64 Decode the Bytes:
Now, Base64-decode each byte array:
python
import base64
decoded_bytes = [base64.b64decode(b) for b in byte_arrays]
3. Concatenate the Decoded Data:
Combine all decoded bytes into a single byte array:
python
combined_data = b''.join(decoded_bytes)
4. XOR Decrypt Using the Key "piratt:":
First, get the key in bytes and determine its length:
python
key = b'piratt:'
key_length = len(key)
Now, XOR each byte of combined_data with the corresponding byte of the key (repeating the key as necessary):
python
decrypted_bytes = bytearray()
for i in range(len(combined_data)):
decrypted_byte = combined_data[i] ^ key[i % key_length]
decrypted_bytes.append(decrypted_byte)
After performing the above steps, you'll obtain the decrypted message. The initial part of the message should read "CTF{" indicating that it's a flag from a Capture The Flag challenge.
The decrypted message is:
code
CTF{90|625EDB(-"SU e01DAG4!^T'.6lE4}
This suggests that the flag is:
code
CTF{90|625EDB(-"SU e01DAG4!^T'.6lE4}
Note: If there are any unreadable or non-printable characters in the decrypted message, ensure that you have used the correct key and followed the steps accurately. The key provided is "piratt:", and it's essential to match it exactly.