(project, stack_length)
return initial_state
:return: an initial state with a symbolic stack and good options for rop
:return: an initial state with a symbolic stack and good options for rop
: return : an initial state with a symbolic stack and good options for rop
def make_initial_state(project, stack_length):
        """
        :return: an initial state with a symbolic stack and good options for rop
        """
        initial_state = project.factory.blank_state(
            add_options={options.AVOID_MULTIVALUED_READS, options.AVOID_MULTIVALUED_WRITES,
                         options.NO_SYMBOLIC_JUMP_RESOLUTION, options.CGC_NO_SYMBOLIC_RECEIVE_LENGTH,
                         options.NO_SYMBOLIC_SYSCALL_RESOLUTION, options.TRACK_ACTION_HISTORY},
            remove_options=options.resilience | options.simplification)
        initial_state.options.discard(options.CGC_ZERO_FILL_UNCONSTRAINED_MEMORY)
        initial_state.options.update({options.TRACK_REGISTER_ACTIONS, options.TRACK_MEMORY_ACTIONS,
                                      options.TRACK_JMP_ACTIONS, options.TRACK_CONSTRAINT_ACTIONS})
        symbolic_stack = initial_state.solver.BVS("symbolic_stack", project.arch.bits * stack_length)
        initial_state.memory.store(initial_state.regs.sp, symbolic_stack)
        if initial_state.arch.bp_offset != initial_state.arch.sp_offset:
            initial_state.regs.bp = initial_state.regs.sp + 20 * initial_state.arch.bytes
        initial_state.solver._solver.timeout = 500  # only solve for half a second at most
        return initial_state
def make_initial_state ( project , stack_length ) : initial_state = project . factory . blank_state ( add_options = { options . AVOID_MULTIVALUED_READS , options . AVOID_MULTIVALUED_WRITES , options . NO_SYMBOLIC_JUMP_RESOLUTION , options . CGC_NO_SYMBOLIC_RECEIVE_LENGTH , options . NO_SYMBOLIC_SYSCALL_RESOLUTION , options . TRACK_ACTION_HISTORY } , remove_options = options . resilience | options . simplification ) initial_state . options . discard ( options . CGC_ZERO_FILL_UNCONSTRAINED_MEMORY ) initial_state . options . update ( { options . TRACK_REGISTER_ACTIONS , options . TRACK_MEMORY_ACTIONS , options . TRACK_JMP_ACTIONS , options . TRACK_CONSTRAINT_ACTIONS } ) symbolic_stack = initial_state . solver . BVS ( "symbolic_stack" , project . arch . bits * stack_length ) initial_state . memory . store ( initial_state . regs . sp , symbolic_stack ) if initial_state . arch . bp_offset != initial_state . arch . sp_offset : initial_state . regs . bp = initial_state . regs . sp + 20 * initial_state . arch . bytes initial_state . solver . _solver . timeout = 500 # only solve for half a second at most return initial_state