Created
January 23, 2022 06:23
-
-
Save blluv/043b2635cc8c6066492f626fb3b6c736 to your computer and use it in GitHub Desktop.
read another python process int list
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
from mem import MemoryOSX | |
import struct | |
proc = MemoryOSX(int(input("pid: "))) | |
idval = int(input("address: ")) | |
idval += 8 | |
m = struct.unpack("L", proc.read_bytes(idval, 8))[0] | |
idval += 8 | |
length = struct.unpack("L", proc.read_bytes(idval, 8))[0] | |
idval += 8 | |
arr = struct.unpack("L", proc.read_bytes(idval, 8))[0] | |
for i in range(length): | |
item_addr = struct.unpack("L", proc.read_bytes(arr+(8*i), 8))[0] | |
ob_size = struct.unpack("L", proc.read_bytes(item_addr + (8*2), 8))[0] | |
num = 0 | |
for i in range(ob_size): | |
n = struct.unpack("I", proc.read_bytes(item_addr + (8*3) + (4*i), 4))[0] | |
num += n * (2 ** (30 * i)) | |
print("val", num) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/blluv/8696c683d09889fc05d891a676e0b04a