CGC#
- class cle.backends.cgc.CGC[source]#
Bases:
ELF
Backend to support the CGC elf format used by the Cyber Grand Challenge competition.
See : https://github.com/CyberGrandChallenge/libcgcef/blob/master/cgc_executable_format.md
- is_default = True#
- __init__(binary, binary_stream, *args, **kwargs)[source]#
- Parameters:
binary – The path to the binary to load
binary_stream – The open stream to this binary. The reference to this will be held until you call close.
is_main_bin – Whether this binary should be loaded as the main executable
- static is_compatible(stream)[source]#
Determine quickly whether this backend can load an object from this stream
- supported_filetypes = ['cgc']#
- imports: typing.Dict[str, 'Relocation']#
- relocs: List[Relocation]#
- child_objects: List['Backend']#
- exception_handlings: List[ExceptionHandling]#
- function_hints: List[FunctionHint]#
- memory: Clemory#
- cached_content: Optional[bytes]#
- class cle.backends.cgc.BackedCGC[source]#
Bases:
CGC
This is a backend for CGC executables that allows user provide a memory backer and a register backer as the initial state of the running binary.
- is_default = True#
- __init__(*args, memory_backer=None, register_backer=None, writes_backer=None, permissions_map=None, current_allocation_base=None, **kwargs)[source]#
- Parameters:
path – File path to CGC executable.
memory_backer – A dict of memory content, with beginning address of each segment as key and actual memory content as data.
register_backer – A dict of all register contents. EIP will be used as the entry point of this executable.
permissions_map – A dict of memory region to permission flags
current_allocation_base – An integer representing the current address of the top of the CGC heap.
- static is_compatible(stream)[source]#
Determine quickly whether this backend can load an object from this stream
- property threads#
If this backend represents a dump of a running program, it may contain one or more thread contexts, i.e. register files. This property should contain a list of names for these threads, which should be unique.
- thread_registers(thread=None)[source]#
If this backend represents a dump of a running program, it may contain one or more thread contexts, i.e. register files. This method should return the register file for a given thread (as named in
Backend.threads
) as a dict mapping register names (as seen in archinfo) to numbers. If the thread is not specified, it should return the context for a “default” thread. If there are no threads, it should return an empty dict.
- imports: typing.Dict[str, 'Relocation']#
- relocs: List[Relocation]#
- child_objects: List['Backend']#
- exception_handlings: List[ExceptionHandling]#
- function_hints: List[FunctionHint]#
- memory: Clemory#
- cached_content: Optional[bytes]#
- addr_to_line: SortedDict[int, Set[Tuple[int, int]]]#
- variables: Optional[List[Variable]]#
- compilation_units: Optional[List[CompilationUnit]]#
- class cle.backends.cgc.cgc.CGC[source]#
Bases:
ELF
Backend to support the CGC elf format used by the Cyber Grand Challenge competition.
See : https://github.com/CyberGrandChallenge/libcgcef/blob/master/cgc_executable_format.md
- is_default = True#
- __init__(binary, binary_stream, *args, **kwargs)[source]#
- Parameters:
binary – The path to the binary to load
binary_stream – The open stream to this binary. The reference to this will be held until you call close.
is_main_bin – Whether this binary should be loaded as the main executable
- static is_compatible(stream)[source]#
Determine quickly whether this backend can load an object from this stream
- supported_filetypes = ['cgc']#
- imports: typing.Dict[str, 'Relocation']#
- relocs: List[Relocation]#
- child_objects: List['Backend']#
- exception_handlings: List[ExceptionHandling]#
- function_hints: List[FunctionHint]#
- memory: Clemory#
- cached_content: Optional[bytes]#
- addr_to_line: SortedDict[int, Set[Tuple[int, int]]]#
- variables: Optional[List[Variable]]#
- compilation_units: Optional[List[CompilationUnit]]#
- class cle.backends.cgc.backedcgc.BackedCGC[source]#
Bases:
CGC
This is a backend for CGC executables that allows user provide a memory backer and a register backer as the initial state of the running binary.
- is_default = True#
- __init__(*args, memory_backer=None, register_backer=None, writes_backer=None, permissions_map=None, current_allocation_base=None, **kwargs)[source]#
- Parameters:
path – File path to CGC executable.
memory_backer – A dict of memory content, with beginning address of each segment as key and actual memory content as data.
register_backer – A dict of all register contents. EIP will be used as the entry point of this executable.
permissions_map – A dict of memory region to permission flags
current_allocation_base – An integer representing the current address of the top of the CGC heap.
- static is_compatible(stream)[source]#
Determine quickly whether this backend can load an object from this stream
- property threads#
If this backend represents a dump of a running program, it may contain one or more thread contexts, i.e. register files. This property should contain a list of names for these threads, which should be unique.
- thread_registers(thread=None)[source]#
If this backend represents a dump of a running program, it may contain one or more thread contexts, i.e. register files. This method should return the register file for a given thread (as named in
Backend.threads
) as a dict mapping register names (as seen in archinfo) to numbers. If the thread is not specified, it should return the context for a “default” thread. If there are no threads, it should return an empty dict.
- imports: typing.Dict[str, 'Relocation']#
- relocs: List[Relocation]#
- child_objects: List['Backend']#
- exception_handlings: List[ExceptionHandling]#
- function_hints: List[FunctionHint]#
- memory: Clemory#
- cached_content: Optional[bytes]#
- addr_to_line: SortedDict[int, Set[Tuple[int, int]]]#
- variables: Optional[List[Variable]]#
- compilation_units: Optional[List[CompilationUnit]]#