Skip to content

Instantly share code, notes, and snippets.

@anch0vy
Created July 25, 2018 00:58
Show Gist options
  • Save anch0vy/cc68517a162391285fdc2ac8721b34f1 to your computer and use it in GitHub Desktop.
Save anch0vy/cc68517a162391285fdc2ac8721b34f1 to your computer and use it in GitHub Desktop.
dingjmax
import gdb
gdb.execute('file ./dingjmax')
class MyBreakpoint(gdb.Breakpoint):
first = True
def stop (self):
if self.first:
gdb.execute('set *(unsigned char*)0x401b90 = 0')
gdb.execute('set *(unsigned char*)0x401b91 = 0')
self.first = False
if gdb.parse_and_eval('*(int*)($rbp-64)') % 20 != 0:
return False
dl = int(gdb.parse_and_eval('*(char*)(0x60764C - 4)'))
fl = int(gdb.parse_and_eval('*(char*)(0x60764D - 4)'))
jl = int(gdb.parse_and_eval('*(char*)(0x60764E - 4)'))
kl = int(gdb.parse_and_eval('*(char*)(0x60764F - 4)'))
if dl == 0x6f:
gdb.execute('set $eax = %d' % ord('d'))
elif fl == 0x6f:
gdb.execute('set $eax = %d' % ord('f'))
elif jl == 0x6f:
gdb.execute('set $eax = %d' % ord('j'))
elif kl == 0x6f:
gdb.execute('set $eax = %d' % ord('k'))
return False
MyBreakpoint('*0x40141A')
gdb.execute('run')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment