(self, flag_page=None, allocate_stack_page_count=0x100, **kwargs)
return s
:param flag_page:                   Flag page content, either a string or a list of BV8s
        :param allocate_stack_page_count:   Number of pages to pre-allocate for stack
:param flag_page:                   Flag page content, either a string or a list of BV8s
        :param allocate_stack_page_count:   Number of pages to pre-allocate for stack
: param flag_page : Flag page content either a string or a list of BV8s : param allocate_stack_page_count : Number of pages to pre - allocate for stack
def state_blank(self, flag_page=None, allocate_stack_page_count=0x100, **kwargs):
        """
        :param flag_page:                   Flag page content, either a string or a list of BV8s
        :param allocate_stack_page_count:   Number of pages to pre-allocate for stack
        """
        # default stack as specified in the cgc abi
        if kwargs.get('stack_end', None) is None:
            kwargs['stack_end'] = 0xbaaab000
        if kwargs.get('stack_size', None) is None:
            kwargs['stack_size'] = 1024*1024*8

        s = super(SimCGC, self).state_blank(**kwargs)  # pylint:disable=invalid-name

        # pre-grow the stack. unsure if this is strictly required or just a hack around a compiler bug
        if hasattr(s.memory, 'allocate_stack_pages'):
            s.memory.allocate_stack_pages(kwargs['stack_end'] - 1, allocate_stack_page_count * 0x1000)

        # Map the flag page
        if o.ABSTRACT_MEMORY not in s.options:
            s.memory.map_region(0x4347c000, 4096, 1)

        # Create the CGC plugin
        s.get_plugin('cgc')

        # Set maximum bytes a single receive syscall should read
        s.cgc.max_receive_size = kwargs.get("cgc_max_recv_size", 0)

        # Set up the flag page
        if flag_page is None:
            flag_page = [s.solver.BVS("cgc-flag-byte-%d" % i, 8, key=('flag', i), eternal=True) for i in range(0x1000)]
        elif type(flag_page) is bytes:
            flag_page = [s.solver.BVV(c, 8) for c in flag_page]
        elif type(flag_page) is list:
            pass
        else:
            raise ValueError("Bad flag page: expected None, bytestring, or list, but got %s" % type(flag_page))

        s.cgc.flag_bytes = flag_page
        if s.mode != 'static':
            s.memory.store(0x4347c000, claripy.Concat(*s.cgc.flag_bytes), priv=True)

        # set up the address for concrete transmits
        s.unicorn.transmit_addr = self.syscall_from_number(2).addr

        s.libc.max_str_len = 1000000
        s.libc.max_strtol_len = 10
        s.libc.max_memcpy_size = 0x100000
        s.libc.max_buffer_size = 0x100000

        return s
def state_blank ( self , flag_page = None , allocate_stack_page_count = 0x100 , * * kwargs ) : # default stack as specified in the cgc abi if kwargs . get ( 'stack_end' , None ) is None : kwargs [ 'stack_end' ] = 0xbaaab000 if kwargs . get ( 'stack_size' , None ) is None : kwargs [ 'stack_size' ] = 1024 * 1024 * 8 s = super ( SimCGC , self ) . state_blank ( * * kwargs ) # pylint:disable=invalid-name # pre-grow the stack. unsure if this is strictly required or just a hack around a compiler bug if hasattr ( s . memory , 'allocate_stack_pages' ) : s . memory . allocate_stack_pages ( kwargs [ 'stack_end' ] - 1 , allocate_stack_page_count * 0x1000 ) # Map the flag page if o . ABSTRACT_MEMORY not in s . options : s . memory . map_region ( 0x4347c000 , 4096 , 1 ) # Create the CGC plugin s . get_plugin ( 'cgc' ) # Set maximum bytes a single receive syscall should read s . cgc . max_receive_size = kwargs . get ( "cgc_max_recv_size" , 0 ) # Set up the flag page if flag_page is None : flag_page = [ s . solver . BVS ( "cgc-flag-byte-%d" % i , 8 , key = ( 'flag' , i ) , eternal = True ) for i in range ( 0x1000 ) ] elif type ( flag_page ) is bytes : flag_page = [ s . solver . BVV ( c , 8 ) for c in flag_page ] elif type ( flag_page ) is list : pass else : raise ValueError ( "Bad flag page: expected None, bytestring, or list, but got %s" % type ( flag_page ) ) s . cgc . flag_bytes = flag_page if s . mode != 'static' : s . memory . store ( 0x4347c000 , claripy . Concat ( * s . cgc . flag_bytes ) , priv = True ) # set up the address for concrete transmits s . unicorn . transmit_addr = self . syscall_from_number ( 2 ) . addr s . libc . max_str_len = 1000000 s . libc . max_strtol_len = 10 s . libc . max_memcpy_size = 0x100000 s . libc . max_buffer_size = 0x100000 return s