Page 1 of 1

[H] Write Pointer to file

Posted: Fri May 01, 2020 1:01 pm
by Sam

Syntax: Select all

ptr: Pointer = ... # Size: 0x3749
from io import BytesIO
io = BytesIO()
# How can I write a pointer from memory to a file? Is there a better way?
for bi in range(0, ptr.size):
io.write(chr(ptr.get_uchar(bi)).encode())
buf = bytes(io.getbuffer())
f = open('ptr.bin', 'wb+')
f.write(buf)
f.close()

Re: [H] Write Pointer to file

Posted: Fri May 01, 2020 1:41 pm
by InvisibleSoldiers
> Write Pointer to file

Syntax: Select all

with open('test.data', 'wb') as f:
b = struct.pack('i', ptr.address)
f.write(b)