Ejemplo n.º 1
0
def cleanUpDisassembly():
	monitor.setMessage("Cleaning Up Disassembly")
	bmgr        = currentProgram.getBookmarkManager()
	listing     = currentProgram.getListing()
	previousSet = None
	while (True):
		badAddr = bmgr.getBookmarkAddresses("Error")
		bai = badAddr.getAddresses(True)
		while (bai.hasNext()):
			ba = bai.next()
			bm = bmgr.getBookmark(ba, "Error", "Bad Instruction")
			if (bm != None):
				contextReg = currentProgram.getProgramContext().getRegister("TMode")
				baEnd = ba
				if (listing.getCodeUnitAt(ba) != None):
					baEnd = listing.getCodeUnitAt(ba).getMaxAddress()
				while (getDataContaining(baEnd.add(4)) != None):
					baEnd = getDataContaining(baEnd.add(4)).getMaxAddress()
				while (getDataContaining(ba.subtract(1)) != None):
					ba = getDataContaining(ba.subtract(1)).getAddress()
				listing.clearCodeUnits(ba, baEnd, False)
				if (contextReg != None):
					paddr = listing.getInstructionBefore(ba).getAddress()
					if (paddr != None):
						rv = currentProgram.getProgramContext().getRegisterValue(contextReg,paddr)
						currentProgram.getProgramContext().setRegisterValue(ba, baEnd, rv)
				bmgr.removeBookmark(bm)
		else:
			break
		while (AutoAnalysisManager.getAnalysisManager(currentProgram).isAnalyzing()):
			sleep(500)
		if (badAddr.equals(previousSet)):
			break
		previousSet = badAddr
Ejemplo n.º 2
0
def getConstantAnalyzer(program):
    mgr = AutoAnalysisManager.getAnalysisManager(program)
    analyzers = ClassSearcher.getInstances(ConstantPropagationAnalyzer)
    for analyzer in analyzers:
        if analyzer.canAnalyze(program):
            return mgr.getAnalyzer(analyzer.getName())
    return None
Ejemplo n.º 3
0
def get_constant_analyzer(
    program, ):  # type: (Program) -> Optional[ConstantPropagationAnalyzer]
    manager = AutoAnalysisManager.getAnalysisManager(currentProgram)
    analyzers = ClassSearcher.getInstances(
        ConstantPropagationAnalyzer().getClass())
    for analyzer in analyzers:  # type: ConstantPropagationAnalyzer
        if analyzer.canAnalyze(program):
            return cast(ConstantPropagationAnalyzer,
                        manager.getAnalyzer(analyzer.getName()))
    return None