Last active
February 24, 2018 14:06
-
-
Save ioncodes/2840775c7d161b595c2ae9387881a342 to your computer and use it in GitHub Desktop.
Calculates the bytes used for a negative relative jump over 126 bytes in x64 asm (e.g: je $-300)
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
loc = 200 | |
asm = [0xfa, 0xff, 0xff, 0xff] | |
for i in range(0, loc): | |
if asm[0] == 0x00: | |
if asm[1] == 0x00: | |
if asm[2] == 0x00: | |
asm[3] -= 1 | |
asm[2] = 0xff | |
asm[1] = 0xff | |
asm[0] = 0xff | |
else: | |
asm[2] -= 1 | |
asm[1] = 0xff | |
asm[0] = 0xff | |
else: | |
asm[1] -= 1 | |
asm[0] = 0xff | |
else: | |
asm[0] -= 1 | |
print(''.join('{:02x} '.format(x) for x in asm)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment