Created
February 24, 2018 13:33
-
-
Save ioncodes/798ca634ee51962f409086d809e34ad0 to your computer and use it in GitHub Desktop.
Calculates the bytes used for a positve relative jump over 129 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 = 300 | |
asm = [-0x06, 0x00, 0x00, 0x00] | |
for i in range(0, loc): | |
if asm[0] == 0xff: | |
if asm[1] == 0xff: | |
if asm[2] == 0xff: | |
asm[3] += 1 | |
asm[2] = 0x00 | |
asm[1] = 0x00 | |
asm[0] = 0x00 | |
else: | |
asm[2] += 1 | |
asm[1] = 0x00 | |
asm[0] = 0x00 | |
else: | |
asm[1] += 1 | |
asm[0] = 0x00 | |
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