From badb5abfa11ccddf9a4171dceceec6034a21c243 Mon Sep 17 00:00:00 2001 From: N3rdL0rd <168280212+N3rdL0rd@users.noreply.github.com> Date: Mon, 26 Aug 2024 13:41:14 -0500 Subject: [PATCH] More stamps --- alivecells.py | 37 ++++++++++++++++++++----------------- stamps.json | 8 +++++++- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/alivecells.py b/alivecells.py index e241db2..1ff65ac 100644 --- a/alivecells.py +++ b/alivecells.py @@ -23,7 +23,6 @@ # For repak-ing BOUNDARY = b"\x00\x01\x25\x00\x00\x00\x05" PAK_HEADER = b"PAK" -BUFFER_SIZE = 1024 * 1024 # 1 MB buffer # endregion # region Utility functions @@ -187,20 +186,23 @@ def repair(dir, game_path, output="hlboot.dat", restore_respak=False): print("Repair complete.") -def commitbrute(pak): - f = open(pak, "rb") - header = f.read(3) - if header != PAK_HEADER: - raise ValueError("Incorrect header found") - file_ver = struct.unpack(">B", f.read(1))[0] - if file_ver != 1: - raise ValueError("Incorrect file version found!") - print("Everything seems okay.") - header_len = struct.unpack(">I", f.read(4))[0] - print("Header length:", header_len) - f.read(4) - stamp = f.read(64) - f.close() +def commitbrute(pak, stamp): + if pak: + f = open(pak, "rb") + header = f.read(3) + if header != PAK_HEADER: + raise ValueError("Incorrect header found") + file_ver = struct.unpack(">B", f.read(1))[0] + if file_ver != 1: + raise ValueError("Incorrect file version found!") + print("Everything seems okay.") + header_len = struct.unpack(">I", f.read(4))[0] + print("Header length:", header_len) + f.read(4) + stamp = f.read(64) + f.close() + if type(stamp) == str: + stamp = stamp.encode() print("Got stamp:", stamp) if stamp == "": raise ValueError("No stamp found") @@ -245,7 +247,8 @@ def commitbrute(pak): steam_parser.add_argument("dir", help="The directory containing the Hashlink VM installation.") commitbrute_parser = subparsers.add_parser("commitbrute", help="Find the short commit hash that the game was built from through a brute-force method (v35+ only!)") - commitbrute_parser.add_argument("pak", help="The signed pak to brute-force") + commitbrute_parser.add_argument("-p", "--pak", help="The signed pak to brute-force") + commitbrute_parser.add_argument("-s", "--stamp", help="The stamp to bruteforce") args = parser.parse_args() @@ -271,7 +274,7 @@ def commitbrute(pak): grid_path=os.path.join(os.path.dirname(__file__), "assets", "grid.png"), \ p_path=os.path.join(os.path.dirname(__file__), "assets", "grid2.png")) elif args.command == "commitbrute": - commitbrute(args.pak) + commitbrute(args.pak, args.stamp) else: raise ValueError("Invalid command.") # endregion diff --git a/stamps.json b/stamps.json index d1b7700..56929d7 100644 --- a/stamps.json +++ b/stamps.json @@ -2,7 +2,13 @@ { "stamp": "f5601c10de243a6dcc424121ee4bcc2b9b36323a15a0dd00312f61b3e704c71f", "commit": "f8349ab", - "platform": "win", + "platforms": ["windows", "linux", "macos"], + "version": 35 + }, + { + "stamp": "878899cc83f1960923243e3f667d01fdfab693f21ed7c27bd9906cb9c301288c", + "commit": "62334b0", + "platforms": ["linux"], "version": 35 } ] \ No newline at end of file