x64dbg / x64dbgpy

Automating x64dbg using Python, Snapshots:
https://ci.appveyor.com/project/mrexodia/x64dbg-python/build/artifacts
MIT License
1.47k stars 70 forks source link

pluginsdk.debug.StepOver(), pluginsdk.debug.Run() seem not to work in Open GUI or Open Async script #59

Open robertsi opened 3 years ago

robertsi commented 3 years ago

This works until I call pluginsdk.debug.StepOver() or pluginsdk.debug.Run in bp_callback. Everything just hangs or is not responding anymore. If I run these two commands from x64dbg GUI everything works as expected. Tried to execute as GUI and async script, seems there is no difference, am I missing something here?

`import threading bpAddress = 0x00007FF6EFB1F4D0

def bp_callback(): print("tid={num:d} 0x{num:X}".format(num=threading.currentThread().ident)) global bpAddress pluginsdk.bridgemain.GuiLogClear() print("rcx={num:d} 0x{num:X}".format(num=Register.RCX)) print("rdx={num:d} 0x{num:X}".format(num=Register.RDX))

#Breakpoint.remove(bpAddress)
#pluginsdk.debug.Run()
#pluginsdk.debug.Wait()
#pluginsdk.debug.Stop()
#pluginsdk.debug.StepIn()
#pluginsdk.debug.StepOut()
#pluginsdk.debug.StepOver()

Breakpoint.add(bpAddress, bp_callback)`

robertsi commented 3 years ago

Was suspecting that its thread related coz its not on the same thread, I have a workaround atm by calling pluginsdk.x64dbg.DbgCmdExec("run")

manfeel commented 3 years ago

Thank you so much! I ran into the same problem, but it seems that I can only run the pluginsdk.x64dbg.DbgCmdExecDirect('run') command to solve the current dilemma.

4144 commented 3 years ago

Only visible simple solution this. Dont use any callbacks on breakpoints, but save info about address with breakpoints into python dictionary. Something like callbacks emulation.

For continue execution run: pluginsdk.debug.Run() After debugger stop on breakpoint, check ip and saved info for address and run own code related to it. For continue execution run again pluginsdk.debug.Run()