Ejemplo n.º 1
0
def DelAllConditionBpt():
    ea = 0x2C13000
    while ea < 0x357D000:
        mnem = idc.GetMnem(ea)
        if mnem == 'jmp' or mnem == 'retn':
            idc.del_bpt(ea)
        ea = idc.NextHead(ea)
Ejemplo n.º 2
0
 def bp_del(self, tracebp=True, clear=False):
     bplist = self.tracebp if tracebp else self.userbp
     for ea in bplist:
         try:
             idc.del_bpt(ea + self.offset)
         except Exception as e:
             print(e)
             self.tracebp.remove(ea)
     if clear:
         bplist.clear()
Ejemplo n.º 3
0
 def bp_update(self):
     invalid = []
     for bp in range(idc.get_bpt_qty()):
         bpea = idc.get_bpt_ea(bp)
         offstr = idc.get_func_off_str(bpea)
         if not offstr:
             invalid.append(bpea)
             continue
         offstr = offstr.split("+")
         if len(offstr) == 1:
             self.userbp_add(bpea)
     if invalid:
         for bp in invalid:
             idc.del_bpt(bp)
         print("invalid bp:", str(invalid))
Ejemplo n.º 4
0
 def bp_recover(self, remove=True, suffix=""):
     bplist = DbgInfo.config_load("breakpoints" + suffix, list)
     if not bplist:
         return False
     if remove:
         nbp = idc.get_bpt_qty()
         bps = []
         for i in range(nbp):
             bp = idc.get_bpt_ea(i)
             bps.append(bp)
         for bp in bps:
             idc.del_bpt(bp)
     for bp in bplist:
         ea = bp[0]
         addr = ea + self.offset
         idc.add_bpt(addr)
         idc.enable_bpt(addr, bp[1])
     return True
Ejemplo n.º 5
0
	def stop_execution(self, eip, break_on_next):

		function = next((x for x in self.traced if x["ea"] == eip), None)
		
		if (function is not None):

			function["hit"] += 1
		
			print("[*] Executing %s" % function["name"])
		
			if (function["hit"] == self.max_hit_count):

				ret = ask_yn(-1, 'Function "%s" was hit %d times. Would you like to exclude it from trace list?' % (function["name"], self.max_hit_count))

				if (ret == 1):

					if (function["name"]):
						self.ignore_appended.append(function["name"])

					idc.del_bpt(function["ea"])

			# Check if we want to debug it

			if (break_on_next):
				return True

			if (function["name"] is not None):

				if (function["name"] in self.debug_if_equals):
					return True
	
				if (any(x for x in self.debug_if_contains if x in function["name"])):
					return True

			return False
		
		return True
Ejemplo n.º 6
0
	def cleanup_breakpoints(self):

		if (self.addr == {}):
			return False

		idc.del_bpt(self.addr["verifyNative"])
		idc.del_bpt(self.addr["setJit"])
		idc.del_bpt(self.addr["setInterp"])
		idc.del_bpt(self.addr["setInterpRet"])
		idc.del_bpt(self.addr["writePrologue"])
		idc.del_bpt(self.addr["hasReachableExceptionsRet"])

		# We want to delete all breakpoints that were set by plugin to trace execution 

		for function in self.traced:
			# Functions listed here can be either present in ".text" segment or in memory regions that are no longer present
			# Try to delete them twice
			idc.del_bpt(function["ea"])
			idc.del_bpt(function["ea"] - self.base + self.get_base())

		self.traced = []

		return True
Ejemplo n.º 7
0
    def unhook(self):
        """
        Remove breakpoint for bpt hook.
        """

        idc.del_bpt(self.func_addr)
Ejemplo n.º 8
0
 def __call__(self):
     try:
         self.result = idc.del_bpt(self.address)
     except Exception as e:
         l.debug("remove_breakpoint exception %s" % (e))
         self.exception = True