How to use the angr.errors.AngrError function in angr

To help you get started, we’ve selected a few angr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angr / angr / angr / analyses / identifier / identify.py View on Github external
def check_tests(self, cfg_func, match_func):
        try:
            if not match_func.pre_test(cfg_func, self._runner):
                return False
            for _ in range(NUM_TESTS):
                test_data = match_func.gen_input_output_pair()
                if test_data is not None and not self._runner.test(cfg_func, test_data):
                    return False
            return True
        except SimSegfaultError:
            return False
        except SimError as e:
            l.warning("SimError %s", e)
            return False
        except AngrError as e:
            l.warning("AngrError %s", e)
            return False
github angr / angr / angr / errors.py View on Github external
class AngrBackwardSlicingError(AngrError):
    pass

class AngrGirlScoutError(AngrError):
    pass

class AngrCallableError(AngrSurveyorError):
    pass

class AngrCallableMultistateError(AngrCallableError):
    pass

class AngrSyscallError(AngrError):
    pass

class AngrSimOSError(AngrError):
    pass

class AngrAssemblyError(AngrError):
    pass

# Congruency check failure
class AngrIncongruencyError(AngrAnalysisError):
    pass

#
# ForwardAnalysis errors
#

class AngrForwardAnalysisError(AngrError):
    pass
github angr / angr / angr / errors.py View on Github external
class AngrAnalysisError(AngrError):
    pass

class AngrBladeError(AngrError):
    pass

class AngrBladeSimProcError(AngrBladeError):
    pass

class AngrAnnotatedCFGError(AngrError):
    pass

class AngrBackwardSlicingError(AngrError):
    pass

class AngrGirlScoutError(AngrError):
    pass

class AngrCallableError(AngrSurveyorError):
    pass

class AngrCallableMultistateError(AngrCallableError):
    pass

class AngrSyscallError(AngrError):
    pass

class AngrSimOSError(AngrError):
    pass

class AngrAssemblyError(AngrError):
    pass
github angr / angr / angr / errors.py View on Github external
pass

#
# Concrete Targets Execution errors
#


class SimConcreteMemoryError(AngrError):
    pass


class SimConcreteRegisterError(AngrError):
    pass


class SimConcreteBreakpointError(AngrError):
    pass
github angr / angr / angr / errors.py View on Github external
class AngrGirlScoutError(AngrError):
    pass

class AngrCallableError(AngrSurveyorError):
    pass

class AngrCallableMultistateError(AngrCallableError):
    pass

class AngrSyscallError(AngrError):
    pass

class AngrSimOSError(AngrError):
    pass

class AngrAssemblyError(AngrError):
    pass

# Congruency check failure
class AngrIncongruencyError(AngrAnalysisError):
    pass

#
# ForwardAnalysis errors
#

class AngrForwardAnalysisError(AngrError):
    pass

class AngrSkipJobNotice(AngrForwardAnalysisError):
    pass
github angr / angr / angr / surveyors / surveyor.py View on Github external
self.pruned = []
        self.suspended = []
        self.unconstrained = []

        self.split_paths = {}
        self._current_step = 0
        self._hierarchy = StateHierarchy()

        if isinstance(start, SimState):
            self.active.append(start)
        elif isinstance(start, (tuple, list, set)):
            self.active.extend(start)
        elif start is None:
            self.active.append(self._project.factory.entry_state())
        else:
            raise AngrError('invalid "start" argument')
github angr / angr / angr / factory.py View on Github external
Many different types can be passed to this method:

        * If nothing is passed in, the SimulationManager is seeded with a state initialized for the program
          entry point, i.e. :meth:`entry_state()`.
        * If a :class:`SimState` is passed in, the SimulationManager is seeded with that state.
        * If a list is passed in, the list must contain only SimStates and the whole list will be used to seed the SimulationManager.
        """
        if thing is None:
            thing = [ self.entry_state() ]
        elif isinstance(thing, (list, tuple)):
            if any(not isinstance(val, SimState) for val in thing):
                raise AngrError("Bad type to initialize SimulationManager")
        elif isinstance(thing, SimState):
            thing = [ thing ]
        else:
            raise AngrError("BadType to initialze SimulationManager: %s" % repr(thing))

        return SimulationManager(self.project, active_states=thing, **kwargs)
github angr / angr / angr / errors.py View on Github external
class AngrVaultError(AngrError):
    pass

class PathUnreachableError(AngrPathError):
    pass

class SimulationManagerError(AngrError):
    pass

class AngrInvalidArgumentError(AngrError):
    pass

class AngrSurveyorError(AngrError):
    pass

class AngrAnalysisError(AngrError):
    pass

class AngrBladeError(AngrError):
    pass

class AngrBladeSimProcError(AngrBladeError):
    pass

class AngrAnnotatedCFGError(AngrError):
    pass

class AngrBackwardSlicingError(AngrError):
    pass

class AngrGirlScoutError(AngrError):
    pass
github angr / angr / angr / analyses / girlscout.py View on Github external
def _scan_block_(self, addr, state, current_function_addr, function_exits, remaining_exits, traced_addresses):

        # Get a basic block
        state.ip = addr

        s_path = self.project.factory.path(state)
        try:
            s_run = s_path.next_run
        except SimIRSBError as ex:
            l.debug(ex)
            return
        except AngrError as ex:
            # "No memory at xxx"
            l.debug(ex)
            return
        except (SimValueError, SimSolverModeError) as ex:
            # Cannot concretize something when executing the SimRun
            l.debug(ex)
            return
        except SimError as ex:
            # Catch all simuvex errors
            l.debug(ex)
            return

        if type(s_run) is SimIRSB:
            # Calculate its entropy to avoid jumping into uninitialized/all-zero space
            bytes = s_run.irsb._state[1]['bytes']
            size = s_run.irsb.size
github angr / angr / angr / orgy.py View on Github external
def _load_one(self, e):
        try:
            return pickle.load(open(self._save_dir + '/' + e + '/project.p'))
        except IOError: #pylint:disable=broad-except
            l.warning("Unable to load fucker %s (IOError)", e)

        try:
            return Project(self._dir + '/' + e)
        except (AngrError, cle.CLException):
            l.warning("Unable to create fucker %s", e, exc_info=True)