Skip to content

Instantly share code, notes, and snippets.

@matteyeux
Created June 9, 2025 06:05
Show Gist options
  • Save matteyeux/390e390b5904970908137454af0fb2d2 to your computer and use it in GitHub Desktop.
Save matteyeux/390e390b5904970908137454af0fb2d2 to your computer and use it in GitHub Desktop.
"""
0001565c int64_t sub_1565c(int64_t arg1)
0001565c {
0001565c uint64_t x8 = arg1 >> 0x28;
00015670 uint64_t x9 = arg1 >> 0x1e & 0x3ff;
00015674 uint64_t x10 = arg1 >> 0x14 & 0x3ff;
00015678 uint64_t x11 = arg1 >> 0xa & 0x3ff;
0001567c uint64_t x12 = arg1 & 0x3ff;
"""
import sys
import struct
if len(sys.argv) != 2:
print("needs SEP")
sys.exit(1)
with open(sys.argv[1], "rb") as f:
sep = f.read()
sepos = sep.find(b"SEPOS")
print(f"SEPOS @ {hex(sepos)}")
version_field = sepos + 32
print(f"SEPOS version @ {hex(version_field)}")
f.seek(version_field)
version = f.read(8)
print(version)
value = struct.unpack("<Q", version)[0]
print(value)
sepos_version = f"{value >> 40}.{(value >> 30) & 0x3ff}.{(value >> 20) & 0x3ff}.{(value >> 10) & 0x3ff}.{value & 0x3ff}"
print(sepos_version)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment