Example #1
0
    def export_bp_notice(self):
        if not self.dbg_dialect:
            rs_log("idb isn't synced yet, can't export bp")
            return

        mod = self.name.split('.')[0].strip()
        nbp = ida_dbg.get_bpt_qty()

        for i in range(nbp):
            ea = idc.get_bpt_ea(i)
            attrs = [idc.BPTATTR_TYPE, idc.BPTATTR_COND, idc.BPTATTR_FLAGS]
            btype, cond, flags = [idc.get_bpt_attr(ea, x) for x in attrs]

            if cond:
                rs_log("bp %d: conditional bp not supported" % i)
            else:
                if ((btype in [idc.BPT_EXEC, idc.BPT_SOFT])
                        and ((flags & idc.BPT_ENABLED) != 0)):

                    offset = ea - self.base
                    bp = self.dbg_dialect['hbp' if
                                          (btype == idc.BPT_EXEC) else 'bp']
                    cmd = "%s%s+0x%x" % (bp, mod, offset)
                    self.notice_broker("cmd", "\"cmd\":\"%s\"" % cmd)
                    rs_log("bp %d: %s" % (i, cmd))

        rs_log('export done')
Example #2
0
    def export_bp_notice(self):
        if not self.dbg_dialect:
            rs_log("idb isn't synced yet, can't export bp")
            return

        is_windbg = (self.dbg_dialect == 'windbg')

        # Windbg supports relative address, ie. mod+0xCAFE
        # for non relative address the remote base address is needed
        if (not is_windbg) and (not self.base_remote):
            rs_log("idb isn't enabled, can't export bp")
            return

        mod = self.name.split('.')[0].strip()
        nbp = ida_dbg.get_bpt_qty()

        for i in range(nbp):
            ea = idc.get_bpt_ea(i)
            attrs = [idc.BPTATTR_TYPE, idc.BPTATTR_COND, idc.BPTATTR_FLAGS]
            btype, cond, flags = [idc.get_bpt_attr(ea, x) for x in attrs]

            if cond:
                rs_log("bp %d: conditional bp not supported" % i)
            else:
                if ((btype in [idc.BPT_EXEC, idc.BPT_SOFT])
                        and ((flags & idc.BPT_ENABLED) != 0)):

                    bp = self.dbg_dialect['hbp' if
                                          (btype == idc.BPT_EXEC) else 'bp']

                    if is_windbg:
                        offset = ea - self.base
                        cmd = "%s%s+0x%x" % (bp, mod, offset)
                    else:
                        offset = self.rebase_remote(ea)
                        cmd = "%s0x%x" % (bp, offset)

                    self.notice_broker("cmd", "\"cmd\":\"%s\"" % cmd)
                    rs_log("bp %d: %s" % (i, cmd))

        rs_log('export done')