Sup, my first post here. You can decode and reencode like this
1. From Base64
2. From Base64
3. Gunzip
4. Change whatever you want.
5. Gzip
6. To Base64
7. To Base64
8. Success
Using CyberChef for doing it is nice.
[Link]
If you're lazy (it's Python so .txt=>.py. google can help with the rest):
Decoding:
Code: Select all
import os
import base64
import gzip
# Uses the folder where the script is located as root.
script_dir = os.path.dirname(os.path.abspath(__file__))
encoded_dir = os.path.join(script_dir, 'Encoded')
decoded_dir = os.path.join(script_dir, 'Decoded')
# Stuff
os.makedirs(decoded_dir, exist_ok=True)
# Things
encoded_file_path = None
for file_name in os.listdir(encoded_dir):
encoded_file_path = os.path.join(encoded_dir, file_name)
break
if not encoded_file_path:
raise FileNotFoundError("No file found in the 'Encoded' directory")
# Who knows
with open(encoded_file_path, 'r') as file:
encoded_str = file.read()
# Step 1: Decode from Base64
decoded_bytes = base64.b64decode(encoded_str)
# Step 2: Decode again from Base64
decoded_bytes = base64.b64decode(decoded_bytes)
# Step 3: Decompress using gzip
decompressed_bytes = gzip.decompress(decoded_bytes)
# Saves the file to 'decoded_file' inside the folder 'root//Decoded'.
decoded_file_path = os.path.join(decoded_dir, 'decoded_file')
with open(decoded_file_path, 'wb') as file:
file.write(decompressed_bytes)
print(f"Decoded file saved to {decoded_file_path}")
Re-Encode:
Code: Select all
import os
import base64
import gzip
import io
# Uses the folder where the script is located as root.
script_dir = os.path.dirname(os.path.abspath(__file__))
decoded_dir = os.path.join(script_dir, 'Decoded')
# Stuff
decoded_file_path = None
for file_name in os.listdir(decoded_dir):
decoded_file_path = os.path.join(decoded_dir, file_name)
break
if not decoded_file_path:
raise FileNotFoundError("No file found in the 'Decoded' directory")
# Things
with open(decoded_file_path, 'rb') as file:
decompressed_bytes = file.read()
# Step 1: Compress using gzip
compressed_bytes_io = io.BytesIO()
with gzip.GzipFile(fileobj=compressed_bytes_io, mode='wb') as gzip_file:
gzip_file.write(decompressed_bytes)
compressed_bytes = compressed_bytes_io.getvalue()
# Step 2: Encode to Base64
encoded_bytes = base64.b64encode(compressed_bytes)
# Step 3: Encode again to Base64
encoded_str = base64.b64encode(encoded_bytes).decode('utf-8')
# cba
reencoded_file_path = os.path.join(script_dir, 'reencoded_file')
with open(reencoded_file_path, 'w') as file:
file.write(encoded_str)
print(f"Re-encoded file saved to {reencoded_file_path}")
1. Make a folder for the scripts.
2. create 2 more folders next to the scripts. One called 'Decoded' and one called 'Encoded'.
3. place the save file you want to edit inside 'Encoded'.
4. Run the Script to decode it.
5. edit the 'decoded_file' however you want (it's inside the 'Decoded' folder).
6. run the Encode script.
7. Load the edited and re-encoded file.
8. Success.
I take no resposibility. Cheers