Skip to content

Commit

Permalink
More stamps
Browse files Browse the repository at this point in the history
  • Loading branch information
N3rdL0rd committed Aug 26, 2024
1 parent 8310a9f commit badb5ab
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
37 changes: 20 additions & 17 deletions alivecells.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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()

Expand All @@ -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
8 changes: 7 additions & 1 deletion stamps.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
{
"stamp": "f5601c10de243a6dcc424121ee4bcc2b9b36323a15a0dd00312f61b3e704c71f",
"commit": "f8349ab",
"platform": "win",
"platforms": ["windows", "linux", "macos"],
"version": 35
},
{
"stamp": "878899cc83f1960923243e3f667d01fdfab693f21ed7c27bd9906cb9c301288c",
"commit": "62334b0",
"platforms": ["linux"],
"version": 35
}
]

0 comments on commit badb5ab

Please sign in to comment.