From 08e8bdf3991941f13b37626814ca5fbc52355395 Mon Sep 17 00:00:00 2001 From: r0th3r <503407184@qq.com> Date: Fri, 24 Mar 2023 15:49:59 +0800 Subject: [PATCH] update get breakpoint condition --- test.py | 19 +++++++++++++++++-- x64dbgpy3/x64dbgpyt3.py | 5 +++++ x64dbgpy3svr/x64dbghandler.hpp | 23 +++++++++++++++++------ 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/test.py b/test.py index af8fb19..edaff43 100644 --- a/test.py +++ b/test.py @@ -19,11 +19,26 @@ for bp in dbgDebug.GetBreakpointList(): - print( "bp: {} {:#x} {} {} {}".format( + descriptor = [] + if (bp.breakCondition): + descriptor.append( "breakif({})".format(bp.breakCondition) ) + if (bp.logText): + descriptor.append( + "logif({}, \"{}\")".format(bp.logCondition, bp.logText) \ + if (bp.logCondition) else "log(\"{}\")".format(bp.logText) + ) + if (bp.commandText): + descriptor.append( + "cmdif({}, \"{}\")".format(bp.commandCondition, bp.commandText) \ + if (bp.commandCondition) else "cmd(\"{}\")".format(bp.commandText) + ) + + print( "bp: {} {:#x} {} {} {} {}".format( ( "soft" if (1 == bp.type) else ( "hard" if (2 == bp.type) else "蔡徐坤" ) ), bp.addr, bp.mod, ( "once" if (bp.singleshoot) else ( "enable" if (bp.enabled) else "disable" ) ), - bp.hitCount ) ) + bp.hitCount, + ', '.join(descriptor) ) ) for book in dbgBookmark.GetBookmarkList(): print( "book: {}+{:#x}".format( book.mod, book.rva ) ) diff --git a/x64dbgpy3/x64dbgpyt3.py b/x64dbgpy3/x64dbgpyt3.py index 6286cb5..253b484 100644 --- a/x64dbgpy3/x64dbgpyt3.py +++ b/x64dbgpy3/x64dbgpyt3.py @@ -641,6 +641,11 @@ class BPXTYPE: name:str mod:str hitCount:int + breakCondition:str + logCondition:str + commandCondition:str + logText:str + commandText:str @staticmethod def GetBreakpointList(bpxtype:DBGBREAKPOINTINFO.BPXTYPE=DBGBREAKPOINTINFO.BPXTYPE.bp_none): diff --git a/x64dbgpy3svr/x64dbghandler.hpp b/x64dbgpy3svr/x64dbghandler.hpp index 0889edc..d4c575b 100644 --- a/x64dbgpy3svr/x64dbghandler.hpp +++ b/x64dbgpy3svr/x64dbghandler.hpp @@ -60,9 +60,15 @@ namespace x64dbgSvrWrapper { std::string name; std::string mod; uint32_t hitCount; + std::string breakCondition; + std::string logCondition; + std::string commandCondition; + std::string logText; + std::string commandText; }; NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(BREAKPOINT_INFO_WRAPPER, \ - type, addr, enabled, singleshoot, active, name, mod, hitCount) + type, addr, enabled, singleshoot, active, name, mod, hitCount, + breakCondition, logCondition, commandCondition, logText, commandText) struct ARGUMENT_INFO_WRAPPER { std::string mod; @@ -688,27 +694,32 @@ namespace x64dbgSvrWrapper { bps.bp[i].addr, bps.bp[i].enabled, bps.bp[i].singleshoot, bps.bp[i].active, bps.bp[i].name, bps.bp[i].mod, - bps.bp[i].hitCount + bps.bp[i].hitCount, + bps.bp[i].breakCondition, + bps.bp[i].logCondition, + bps.bp[i].commandCondition, + bps.bp[i].logText, + bps.bp[i].commandText, }; } BridgeFree(bps.bp); return breaks; } auto SetBreakpoint(ptr_t addr) { - return Script::Debug::SetBreakpoint(addr); + return Script::Debug::SetBreakpoint(addr); } auto DeleteBreakpoint(ptr_t addr) { return Script::Debug::DeleteBreakpoint(addr); } auto DisableBreakpoint(ptr_t addr) { - return Script::Debug::DisableBreakpoint(addr); + return Script::Debug::DisableBreakpoint(addr); } auto SetHardwareBreakpoint(ptr_t addr, int32_t hard) { - return Script::Debug::SetHardwareBreakpoint(addr, Script::Debug::HardwareType(hard)); + return Script::Debug::SetHardwareBreakpoint(addr, Script::Debug::HardwareType(hard)); } auto DeleteHardwareBreakpoint(ptr_t addr) { - return Script::Debug::DeleteHardwareBreakpoint(addr); + return Script::Debug::DeleteHardwareBreakpoint(addr); } } };