Created
December 29, 2016 22:43
-
-
Save Treeki/b26c3668014cb408ce092243e7eeed33 to your computer and use it in GitHub Desktop.
Super Mario Run .stir file decrypter
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
# fun fact: | |
# this is internally referred to as 'SimpleEncryption' | |
# it is pretty damn simple, really | |
import sys | |
KEY = 0x5D | |
INITIAL_SPAN = 0x200 | |
SPAN = 0x100 | |
input_name = sys.argv[1] | |
if '.stir' in input_name: | |
output_name = input_name.replace('.stir', '') | |
else: | |
output_name = input_name + '_decrypted' | |
with open(input_name, 'rb') as f: | |
work = bytearray(f.read()) | |
first_block_size = min(INITIAL_SPAN, len(work)) | |
value = KEY | |
for i in range(first_block_size): | |
value ^= work[i] | |
work[i] = value | |
offset = first_block_size | |
while offset < len(work): | |
value ^= work[offset] | |
work[offset] = value | |
offset += SPAN | |
with open(output_name, 'wb') as f: | |
f.write(work) |
How to run this script on multiple files at same time?
Late but forfiles /s /m *.unity3d /C "cmd /c python unstir.py @file
can help you decrypt multiple on Windows.
*edit to fix errors with encoding
Late but
forfiles /s /m *.unity3d /c "python \"decstir.py\" @file
can help you decrypt multiple on Windows.
Thanks for this!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do py/python unstir.py STIRCOMPRESSSEDFILE.unity3d. What file(s) have this problem?