(
        self,
        syscall_hooks=None,
        cache_key=None,
        unicount=None,
        symbolic_var_counts=None,
        symbolic_inst_counts=None,
        concretized_asts=None,
        always_concretize=None,
        never_concretize=None,
        concretize_at=None,
        concretization_threshold_memory=None,
        concretization_threshold_registers=None,
        concretization_threshold_instruction=None,
        cooldown_symbolic_stop=2,
        cooldown_unsupported_stop=2,
        cooldown_nonunicorn_blocks=100,
        cooldown_stop_point=1,
        max_steps=1000000,
    )
Initializes the Unicorn plugin for angr. This plugin handles communication with
        UnicornEngine.
Initializes the Unicorn plugin for angr. This plugin handles communication with
        UnicornEngine.
Initializes the Unicorn plugin for angr . This plugin handles communication with UnicornEngine .
def __init__(
        self,
        syscall_hooks=None,
        cache_key=None,
        unicount=None,
        symbolic_var_counts=None,
        symbolic_inst_counts=None,
        concretized_asts=None,
        always_concretize=None,
        never_concretize=None,
        concretize_at=None,
        concretization_threshold_memory=None,
        concretization_threshold_registers=None,
        concretization_threshold_instruction=None,
        cooldown_symbolic_stop=2,
        cooldown_unsupported_stop=2,
        cooldown_nonunicorn_blocks=100,
        cooldown_stop_point=1,
        max_steps=1000000,
    ):
        """
        Initializes the Unicorn plugin for angr. This plugin handles communication with
        UnicornEngine.
        """

        SimStatePlugin.__init__(self)

        self._syscall_pc = None
        self.jumpkind = 'Ijk_Boring'
        self.error = None
        self.errno = 0
        self.trap_ip = None

        self.cache_key = hash(self) if cache_key is None else cache_key

        # cooldowns to avoid thrashing in and out of unicorn
        # the countdown vars are the CURRENT counter that is counting down
        # when they hit zero execution will start
        # the cooldown vars are the settings for what the countdown should start at
        # the val is copied from cooldown to countdown on check fail
        self.cooldown_nonunicorn_blocks = cooldown_nonunicorn_blocks
        self.cooldown_symbolic_stop = cooldown_symbolic_stop
        self.cooldown_unsupported_stop = cooldown_unsupported_stop
        self.cooldown_stop_point = cooldown_stop_point
        self.countdown_nonunicorn_blocks = 0
        self.countdown_symbolic_stop = 0
        self.countdown_unsupported_stop = 0
        self.countdown_stop_point = 0

        # the default step limit
        self.max_steps = max_steps

        self.steps = 0
        self._mapped = 0
        self._uncache_regions = []
        self._symbolic_offsets = None
        self.gdt = None

        # following variables are used in python level hook
        # we cannot see native hooks from python
        self.syscall_hooks = { } if syscall_hooks is None else syscall_hooks

        # native state in libsimunicorn
        self._uc_state = None
        self.stop_reason = None
        self.stop_details = None
        self.stop_message = None

        # this is the counter for the unicorn count
        self._unicount = next(_unicounter) if unicount is None else unicount

        #
        # Selective concretization stuff
        #

        # this is the number of times specific symbolic variables have kicked us out of unicorn
        self.symbolic_var_counts = { } if symbolic_var_counts is None else symbolic_var_counts

        # this is the number of times we've been kept out of unicorn at given instructions
        self.symbolic_inst_counts = { } if symbolic_inst_counts is None else symbolic_inst_counts

        # these are threshold for the number of times that we tolerate being kept out of unicorn
        # before we start concretizing
        self.concretization_threshold_memory = concretization_threshold_memory
        self.concretization_threshold_registers = concretization_threshold_registers
        self.concretization_threshold_instruction = concretization_threshold_instruction

        # these are sets of names of variables that should either always or never
        # be concretized
        self.always_concretize = set() if always_concretize is None else always_concretize
        self.never_concretize = set() if never_concretize is None else never_concretize
        self.concretize_at = set() if concretize_at is None else concretize_at

        # this is a record of the ASTs for which we've added concretization constraints
        self._concretized_asts = set() if concretized_asts is None else concretized_asts

        # the address to use for concrete transmits
        self.transmit_addr = None

        self.time = None

        self._bullshit_cb = ctypes.cast(unicorn.unicorn.UC_HOOK_MEM_INVALID_CB(self._hook_mem_unmapped), unicorn.unicorn.UC_HOOK_MEM_INVALID_CB)
        self._skip_next_callback = False
def __init__ ( self , syscall_hooks = None , cache_key = None , unicount = None , symbolic_var_counts = None , symbolic_inst_counts = None , concretized_asts = None , always_concretize = None , never_concretize = None , concretize_at = None , concretization_threshold_memory = None , concretization_threshold_registers = None , concretization_threshold_instruction = None , cooldown_symbolic_stop = 2 , cooldown_unsupported_stop = 2 , cooldown_nonunicorn_blocks = 100 , cooldown_stop_point = 1 , max_steps = 1000000 , ) : SimStatePlugin . __init__ ( self ) self . _syscall_pc = None self . jumpkind = 'Ijk_Boring' self . error = None self . errno = 0 self . trap_ip = None self . cache_key = hash ( self ) if cache_key is None else cache_key # cooldowns to avoid thrashing in and out of unicorn # the countdown vars are the CURRENT counter that is counting down # when they hit zero execution will start # the cooldown vars are the settings for what the countdown should start at # the val is copied from cooldown to countdown on check fail self . cooldown_nonunicorn_blocks = cooldown_nonunicorn_blocks self . cooldown_symbolic_stop = cooldown_symbolic_stop self . cooldown_unsupported_stop = cooldown_unsupported_stop self . cooldown_stop_point = cooldown_stop_point self . countdown_nonunicorn_blocks = 0 self . countdown_symbolic_stop = 0 self . countdown_unsupported_stop = 0 self . countdown_stop_point = 0 # the default step limit self . max_steps = max_steps self . steps = 0 self . _mapped = 0 self . _uncache_regions = [ ] self . _symbolic_offsets = None self . gdt = None # following variables are used in python level hook # we cannot see native hooks from python self . syscall_hooks = { } if syscall_hooks is None else syscall_hooks # native state in libsimunicorn self . _uc_state = None self . stop_reason = None self . stop_details = None self . stop_message = None # this is the counter for the unicorn count self . _unicount = next ( _unicounter ) if unicount is None else unicount # # Selective concretization stuff # # this is the number of times specific symbolic variables have kicked us out of unicorn self . symbolic_var_counts = { } if symbolic_var_counts is None else symbolic_var_counts # this is the number of times we've been kept out of unicorn at given instructions self . symbolic_inst_counts = { } if symbolic_inst_counts is None else symbolic_inst_counts # these are threshold for the number of times that we tolerate being kept out of unicorn # before we start concretizing self . concretization_threshold_memory = concretization_threshold_memory self . concretization_threshold_registers = concretization_threshold_registers self . concretization_threshold_instruction = concretization_threshold_instruction # these are sets of names of variables that should either always or never # be concretized self . always_concretize = set ( ) if always_concretize is None else always_concretize self . never_concretize = set ( ) if never_concretize is None else never_concretize self . concretize_at = set ( ) if concretize_at is None else concretize_at # this is a record of the ASTs for which we've added concretization constraints self . _concretized_asts = set ( ) if concretized_asts is None else concretized_asts # the address to use for concrete transmits self . transmit_addr = None self . time = None self . _bullshit_cb = ctypes . cast ( unicorn . unicorn . UC_HOOK_MEM_INVALID_CB ( self . _hook_mem_unmapped ) , unicorn . unicorn . UC_HOOK_MEM_INVALID_CB ) self . _skip_next_callback = False