1
0

Initial commit

This commit is contained in:
Markus Birth 2013-12-15 02:36:24 +01:00
commit 5efc502815
4 changed files with 131 additions and 0 deletions

3
README.md Normal file
View File

@ -0,0 +1,3 @@
Strike Suit Zero Savegame Decoder
=================================

41
mainsav_decode.php Executable file
View File

@ -0,0 +1,41 @@
#!/usr/bin/php
<?php
// can be found in ~/.local/share/Steam/userdata/119879364/209540/remote
$file = 'main.sav';
$data = file_get_contents($file);
$key = 'tkileyismoarawesome!!!!citationneede';
$header = substr($data, 0, 40);
$crypt = substr($data, 40);
file_put_contents('main_header.sav', $header);
$version = substr($header, 32, 4);
$version_num = unpack('L', $version);
echo 'Version: ' . $version_num[1] . PHP_EOL;
$length = substr($header, 36, 4);
$length_num = unpack('L', $length);
echo 'Payload length: ' . $length_num[1] . ' Bytes' . PHP_EOL;
$output = '';
for ($i=0; $i<strlen($crypt); $i++) {
$keyidx = $i % strlen($key);
$keychar = substr($key, $keyidx, 1);
$char = substr($crypt, $i, 1);
$newchar = ord($char) ^ ord($keychar);
$output .= chr($newchar);
}
#file_put_contents('main_data.sav', $output);
$json = json_decode($output);
$pretty = json_encode($json, JSON_PRETTY_PRINT);
file_put_contents('main_data.sav', $pretty);

49
mainsav_decode.py Executable file
View File

@ -0,0 +1,49 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import struct
import json
# can be found in ~/.local/share/Steam/userdata/119879364/209540/remote
filename = "main.sav"
key = bytearray("tkileyismoarawesome!!!!citationneede", "utf-8")
data = bytearray(open(filename, "rb").read())
header = data[0:40]
crypt = data[40:]
f = open("main_header.sav", "wb")
f.write(header)
f.close()
version = header[32:36]
version_num = struct.unpack("<L", version)
print("Version: %s" % version_num[0])
length = header[36:40]
length_num = struct.unpack("<L", length)
print("Payload length: %s Bytes" % length_num[0])
output = bytearray()
for i in range(0, len(crypt)):
keyidx = i % len(key)
keychar = key[keyidx]
char = crypt[i]
newchar = char ^ keychar
output.append(newchar)
f = open("main_data.sav", "wb")
f.write(output)
f.close()
json_data = json.loads(str(output, "utf-8"))
json_pretty = json.dumps(json_data, indent=4)
f = open("main_data.sav", "w")
f.write(json_pretty)
f.close()

38
mainsav_encode.php Executable file
View File

@ -0,0 +1,38 @@
#!/usr/bin/php
<?php
$key = 'tkileyismoarawesome!!!!citationneede';
$header = file_get_contents('main_header.sav');
$data = file_get_contents('main_data.sav');
$json = json_decode($data);
$crypt = json_encode($json);
$header = substr($header, 0, 36);
$header .= pack('L', strlen($crypt));
$version = substr($header, 32, 4);
$version_num = unpack('L', $version);
echo 'Version: ' . $version_num[1] . PHP_EOL;
$length = substr($header, 36, 4);
$length_num = unpack('L', $length);
echo 'Payload length: ' . $length_num[1] . ' Bytes' . PHP_EOL;
$output = $header;
for ($i=0; $i<strlen($crypt); $i++) {
$keyidx = $i % strlen($key);
$keychar = substr($key, $keyidx, 1);
$char = substr($crypt, $i, 1);
$newchar = ord($char) ^ ord($keychar);
$output .= chr($newchar);
}
file_put_contents('main_new.sav', $output);
// goes to: ~/.local/share/Steam/userdata/119879364/209540/remote