partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
StateBase.new_symbolic_buffer
Create and return a symbolic buffer of length `nbytes`. The buffer is not written into State's memory; write it to the state's memory to introduce it into the program state. :param int nbytes: Length of the new buffer :param str label: (keyword arg only) The label to assign to the buffe...
manticore/core/state.py
def new_symbolic_buffer(self, nbytes, **options): """Create and return a symbolic buffer of length `nbytes`. The buffer is not written into State's memory; write it to the state's memory to introduce it into the program state. :param int nbytes: Length of the new buffer :param s...
def new_symbolic_buffer(self, nbytes, **options): """Create and return a symbolic buffer of length `nbytes`. The buffer is not written into State's memory; write it to the state's memory to introduce it into the program state. :param int nbytes: Length of the new buffer :param s...
[ "Create", "and", "return", "a", "symbolic", "buffer", "of", "length", "nbytes", ".", "The", "buffer", "is", "not", "written", "into", "State", "s", "memory", ";", "write", "it", "to", "the", "state", "s", "memory", "to", "introduce", "it", "into", "the",...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/state.py#L173-L200
[ "def", "new_symbolic_buffer", "(", "self", ",", "nbytes", ",", "*", "*", "options", ")", ":", "label", "=", "options", ".", "get", "(", "'label'", ")", "avoid_collisions", "=", "False", "if", "label", "is", "None", ":", "label", "=", "'buffer'", "avoid_c...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
StateBase.new_symbolic_value
Create and return a symbolic value that is `nbits` bits wide. Assign the value to a register or write it into the address space to introduce it into the program state. :param int nbits: The bitwidth of the value returned :param str label: The label to assign to the value :param ...
manticore/core/state.py
def new_symbolic_value(self, nbits, label=None, taint=frozenset()): """Create and return a symbolic value that is `nbits` bits wide. Assign the value to a register or write it into the address space to introduce it into the program state. :param int nbits: The bitwidth of the value retu...
def new_symbolic_value(self, nbits, label=None, taint=frozenset()): """Create and return a symbolic value that is `nbits` bits wide. Assign the value to a register or write it into the address space to introduce it into the program state. :param int nbits: The bitwidth of the value retu...
[ "Create", "and", "return", "a", "symbolic", "value", "that", "is", "nbits", "bits", "wide", ".", "Assign", "the", "value", "to", "a", "register", "or", "write", "it", "into", "the", "address", "space", "to", "introduce", "it", "into", "the", "program", "...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/state.py#L202-L221
[ "def", "new_symbolic_value", "(", "self", ",", "nbits", ",", "label", "=", "None", ",", "taint", "=", "frozenset", "(", ")", ")", ":", "assert", "nbits", "in", "(", "1", ",", "4", ",", "8", ",", "16", ",", "32", ",", "64", ",", "128", ",", "256...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
StateBase.concretize
This finds a set of solutions for symbolic using policy. This raises TooManySolutions if more solutions than maxcount
manticore/core/state.py
def concretize(self, symbolic, policy, maxcount=7): """ This finds a set of solutions for symbolic using policy. This raises TooManySolutions if more solutions than maxcount """ assert self.constraints == self.platform.constraints symbolic = self.migrate_expression(symbolic) ...
def concretize(self, symbolic, policy, maxcount=7): """ This finds a set of solutions for symbolic using policy. This raises TooManySolutions if more solutions than maxcount """ assert self.constraints == self.platform.constraints symbolic = self.migrate_expression(symbolic) ...
[ "This", "finds", "a", "set", "of", "solutions", "for", "symbolic", "using", "policy", ".", "This", "raises", "TooManySolutions", "if", "more", "solutions", "than", "maxcount" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/state.py#L223-L258
[ "def", "concretize", "(", "self", ",", "symbolic", ",", "policy", ",", "maxcount", "=", "7", ")", ":", "assert", "self", ".", "constraints", "==", "self", ".", "platform", ".", "constraints", "symbolic", "=", "self", ".", "migrate_expression", "(", "symbol...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
StateBase.solve_one
Concretize a symbolic :class:`~manticore.core.smtlib.expression.Expression` into one solution. :param manticore.core.smtlib.Expression expr: Symbolic value to concretize :param bool constrain: If True, constrain expr to concretized value :return: Concrete value :rtype: int
manticore/core/state.py
def solve_one(self, expr, constrain=False): """ Concretize a symbolic :class:`~manticore.core.smtlib.expression.Expression` into one solution. :param manticore.core.smtlib.Expression expr: Symbolic value to concretize :param bool constrain: If True, constrain expr to concretized...
def solve_one(self, expr, constrain=False): """ Concretize a symbolic :class:`~manticore.core.smtlib.expression.Expression` into one solution. :param manticore.core.smtlib.Expression expr: Symbolic value to concretize :param bool constrain: If True, constrain expr to concretized...
[ "Concretize", "a", "symbolic", ":", "class", ":", "~manticore", ".", "core", ".", "smtlib", ".", "expression", ".", "Expression", "into", "one", "solution", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/state.py#L286-L303
[ "def", "solve_one", "(", "self", ",", "expr", ",", "constrain", "=", "False", ")", ":", "expr", "=", "self", ".", "migrate_expression", "(", "expr", ")", "value", "=", "self", ".", "_solver", ".", "get_value", "(", "self", ".", "_constraints", ",", "ex...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
StateBase.solve_n
Concretize a symbolic :class:`~manticore.core.smtlib.expression.Expression` into `nsolves` solutions. :param manticore.core.smtlib.Expression expr: Symbolic value to concretize :return: Concrete value :rtype: list[int]
manticore/core/state.py
def solve_n(self, expr, nsolves): """ Concretize a symbolic :class:`~manticore.core.smtlib.expression.Expression` into `nsolves` solutions. :param manticore.core.smtlib.Expression expr: Symbolic value to concretize :return: Concrete value :rtype: list[int] """ ...
def solve_n(self, expr, nsolves): """ Concretize a symbolic :class:`~manticore.core.smtlib.expression.Expression` into `nsolves` solutions. :param manticore.core.smtlib.Expression expr: Symbolic value to concretize :return: Concrete value :rtype: list[int] """ ...
[ "Concretize", "a", "symbolic", ":", "class", ":", "~manticore", ".", "core", ".", "smtlib", ".", "expression", ".", "Expression", "into", "nsolves", "solutions", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/state.py#L305-L315
[ "def", "solve_n", "(", "self", ",", "expr", ",", "nsolves", ")", ":", "expr", "=", "self", ".", "migrate_expression", "(", "expr", ")", "return", "self", ".", "_solver", ".", "get_all_values", "(", "self", ".", "_constraints", ",", "expr", ",", "nsolves"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
StateBase.solve_max
Solves a symbolic :class:`~manticore.core.smtlib.expression.Expression` into its maximum solution :param manticore.core.smtlib.Expression expr: Symbolic value to solve :return: Concrete value :rtype: list[int]
manticore/core/state.py
def solve_max(self, expr): """ Solves a symbolic :class:`~manticore.core.smtlib.expression.Expression` into its maximum solution :param manticore.core.smtlib.Expression expr: Symbolic value to solve :return: Concrete value :rtype: list[int] """ if isinsta...
def solve_max(self, expr): """ Solves a symbolic :class:`~manticore.core.smtlib.expression.Expression` into its maximum solution :param manticore.core.smtlib.Expression expr: Symbolic value to solve :return: Concrete value :rtype: list[int] """ if isinsta...
[ "Solves", "a", "symbolic", ":", "class", ":", "~manticore", ".", "core", ".", "smtlib", ".", "expression", ".", "Expression", "into", "its", "maximum", "solution" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/state.py#L317-L329
[ "def", "solve_max", "(", "self", ",", "expr", ")", ":", "if", "isinstance", "(", "expr", ",", "int", ")", ":", "return", "expr", "expr", "=", "self", ".", "migrate_expression", "(", "expr", ")", "return", "self", ".", "_solver", ".", "max", "(", "sel...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
StateBase.solve_min
Solves a symbolic :class:`~manticore.core.smtlib.expression.Expression` into its minimum solution :param manticore.core.smtlib.Expression expr: Symbolic value to solve :return: Concrete value :rtype: list[int]
manticore/core/state.py
def solve_min(self, expr): """ Solves a symbolic :class:`~manticore.core.smtlib.expression.Expression` into its minimum solution :param manticore.core.smtlib.Expression expr: Symbolic value to solve :return: Concrete value :rtype: list[int] """ if isinsta...
def solve_min(self, expr): """ Solves a symbolic :class:`~manticore.core.smtlib.expression.Expression` into its minimum solution :param manticore.core.smtlib.Expression expr: Symbolic value to solve :return: Concrete value :rtype: list[int] """ if isinsta...
[ "Solves", "a", "symbolic", ":", "class", ":", "~manticore", ".", "core", ".", "smtlib", ".", "expression", ".", "Expression", "into", "its", "minimum", "solution" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/state.py#L331-L343
[ "def", "solve_min", "(", "self", ",", "expr", ")", ":", "if", "isinstance", "(", "expr", ",", "int", ")", ":", "return", "expr", "expr", "=", "self", ".", "migrate_expression", "(", "expr", ")", "return", "self", ".", "_solver", ".", "min", "(", "sel...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
StateBase.solve_minmax
Solves a symbolic :class:`~manticore.core.smtlib.expression.Expression` into its minimum and maximun solution. Only defined for bitvects. :param manticore.core.smtlib.Expression expr: Symbolic value to solve :return: Concrete value :rtype: list[int]
manticore/core/state.py
def solve_minmax(self, expr): """ Solves a symbolic :class:`~manticore.core.smtlib.expression.Expression` into its minimum and maximun solution. Only defined for bitvects. :param manticore.core.smtlib.Expression expr: Symbolic value to solve :return: Concrete value :rtyp...
def solve_minmax(self, expr): """ Solves a symbolic :class:`~manticore.core.smtlib.expression.Expression` into its minimum and maximun solution. Only defined for bitvects. :param manticore.core.smtlib.Expression expr: Symbolic value to solve :return: Concrete value :rtyp...
[ "Solves", "a", "symbolic", ":", "class", ":", "~manticore", ".", "core", ".", "smtlib", ".", "expression", ".", "Expression", "into", "its", "minimum", "and", "maximun", "solution", ".", "Only", "defined", "for", "bitvects", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/state.py#L345-L357
[ "def", "solve_minmax", "(", "self", ",", "expr", ")", ":", "if", "isinstance", "(", "expr", ",", "int", ")", ":", "return", "expr", "expr", "=", "self", ".", "migrate_expression", "(", "expr", ")", "return", "self", ".", "_solver", ".", "minmax", "(", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
StateBase.solve_buffer
Reads `nbytes` of symbolic data from a buffer in memory at `addr` and attempts to concretize it :param int address: Address of buffer to concretize :param int nbytes: Size of buffer to concretize :param bool constrain: If True, constrain the buffer to the concretized value :retu...
manticore/core/state.py
def solve_buffer(self, addr, nbytes, constrain=False): """ Reads `nbytes` of symbolic data from a buffer in memory at `addr` and attempts to concretize it :param int address: Address of buffer to concretize :param int nbytes: Size of buffer to concretize :param bool cons...
def solve_buffer(self, addr, nbytes, constrain=False): """ Reads `nbytes` of symbolic data from a buffer in memory at `addr` and attempts to concretize it :param int address: Address of buffer to concretize :param int nbytes: Size of buffer to concretize :param bool cons...
[ "Reads", "nbytes", "of", "symbolic", "data", "from", "a", "buffer", "in", "memory", "at", "addr", "and", "attempts", "to", "concretize", "it" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/state.py#L362-L380
[ "def", "solve_buffer", "(", "self", ",", "addr", ",", "nbytes", ",", "constrain", "=", "False", ")", ":", "buffer", "=", "self", ".", "cpu", ".", "read_bytes", "(", "addr", ",", "nbytes", ")", "result", "=", "[", "]", "with", "self", ".", "_constrain...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
StateBase.symbolicate_buffer
Mark parts of a buffer as symbolic (demarked by the wildcard byte) :param str data: The string to symbolicate. If no wildcard bytes are provided, this is the identity function on the first argument. :param str label: The label to assign to the value :param str wildcard: The byte...
manticore/core/state.py
def symbolicate_buffer(self, data, label='INPUT', wildcard='+', string=False, taint=frozenset()): """Mark parts of a buffer as symbolic (demarked by the wildcard byte) :param str data: The string to symbolicate. If no wildcard bytes are provided, this is the identity function on the fir...
def symbolicate_buffer(self, data, label='INPUT', wildcard='+', string=False, taint=frozenset()): """Mark parts of a buffer as symbolic (demarked by the wildcard byte) :param str data: The string to symbolicate. If no wildcard bytes are provided, this is the identity function on the fir...
[ "Mark", "parts", "of", "a", "buffer", "as", "symbolic", "(", "demarked", "by", "the", "wildcard", "byte", ")" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/state.py#L382-L417
[ "def", "symbolicate_buffer", "(", "self", ",", "data", ",", "label", "=", "'INPUT'", ",", "wildcard", "=", "'+'", ",", "string", "=", "False", ",", "taint", "=", "frozenset", "(", ")", ")", ":", "if", "wildcard", "in", "data", ":", "size", "=", "len"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
UnicornEmulator._create_emulated_mapping
Create a mapping in Unicorn and note that we'll need it if we retry. :param uc: The Unicorn instance. :param address: The address which is contained by the mapping. :rtype Map
manticore/utils/fallback_emulator.py
def _create_emulated_mapping(self, uc, address): """ Create a mapping in Unicorn and note that we'll need it if we retry. :param uc: The Unicorn instance. :param address: The address which is contained by the mapping. :rtype Map """ m = self._cpu.memory.map_conta...
def _create_emulated_mapping(self, uc, address): """ Create a mapping in Unicorn and note that we'll need it if we retry. :param uc: The Unicorn instance. :param address: The address which is contained by the mapping. :rtype Map """ m = self._cpu.memory.map_conta...
[ "Create", "a", "mapping", "in", "Unicorn", "and", "note", "that", "we", "ll", "need", "it", "if", "we", "retry", ".", ":", "param", "uc", ":", "The", "Unicorn", "instance", ".", ":", "param", "address", ":", "The", "address", "which", "is", "contained"...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/fallback_emulator.py#L64-L86
[ "def", "_create_emulated_mapping", "(", "self", ",", "uc", ",", "address", ")", ":", "m", "=", "self", ".", "_cpu", ".", "memory", ".", "map_containing", "(", "address", ")", "permissions", "=", "UC_PROT_NONE", "if", "'r'", "in", "m", ".", "perms", ":", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
UnicornEmulator._hook_xfer_mem
Handle memory operations from unicorn.
manticore/utils/fallback_emulator.py
def _hook_xfer_mem(self, uc, access, address, size, value, data): """ Handle memory operations from unicorn. """ assert access in (UC_MEM_WRITE, UC_MEM_READ, UC_MEM_FETCH) if access == UC_MEM_WRITE: self._cpu.write_int(address, value, size * 8) # If client c...
def _hook_xfer_mem(self, uc, access, address, size, value, data): """ Handle memory operations from unicorn. """ assert access in (UC_MEM_WRITE, UC_MEM_READ, UC_MEM_FETCH) if access == UC_MEM_WRITE: self._cpu.write_int(address, value, size * 8) # If client c...
[ "Handle", "memory", "operations", "from", "unicorn", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/fallback_emulator.py#L97-L121
[ "def", "_hook_xfer_mem", "(", "self", ",", "uc", ",", "access", ",", "address", ",", "size", ",", "value", ",", "data", ")", ":", "assert", "access", "in", "(", "UC_MEM_WRITE", ",", "UC_MEM_READ", ",", "UC_MEM_FETCH", ")", "if", "access", "==", "UC_MEM_W...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
UnicornEmulator._hook_unmapped
We hit an unmapped region; map it into unicorn.
manticore/utils/fallback_emulator.py
def _hook_unmapped(self, uc, access, address, size, value, data): """ We hit an unmapped region; map it into unicorn. """ try: m = self._create_emulated_mapping(uc, address) except MemoryException as e: self._to_raise = e self._should_try_agai...
def _hook_unmapped(self, uc, access, address, size, value, data): """ We hit an unmapped region; map it into unicorn. """ try: m = self._create_emulated_mapping(uc, address) except MemoryException as e: self._to_raise = e self._should_try_agai...
[ "We", "hit", "an", "unmapped", "region", ";", "map", "it", "into", "unicorn", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/fallback_emulator.py#L123-L136
[ "def", "_hook_unmapped", "(", "self", ",", "uc", ",", "access", ",", "address", ",", "size", ",", "value", ",", "data", ")", ":", "try", ":", "m", "=", "self", ".", "_create_emulated_mapping", "(", "uc", ",", "address", ")", "except", "MemoryException", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
UnicornEmulator._interrupt
Handle software interrupt (SVC/INT)
manticore/utils/fallback_emulator.py
def _interrupt(self, uc, number, data): """ Handle software interrupt (SVC/INT) """ from ..native.cpu.abstractcpu import Interruption # prevent circular imports self._to_raise = Interruption(number) return True
def _interrupt(self, uc, number, data): """ Handle software interrupt (SVC/INT) """ from ..native.cpu.abstractcpu import Interruption # prevent circular imports self._to_raise = Interruption(number) return True
[ "Handle", "software", "interrupt", "(", "SVC", "/", "INT", ")" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/fallback_emulator.py#L138-L145
[ "def", "_interrupt", "(", "self", ",", "uc", ",", "number", ",", "data", ")", ":", "from", ".", ".", "native", ".", "cpu", ".", "abstractcpu", "import", "Interruption", "# prevent circular imports", "self", ".", "_to_raise", "=", "Interruption", "(", "number...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
UnicornEmulator.emulate
Emulate a single instruction.
manticore/utils/fallback_emulator.py
def emulate(self, instruction): """ Emulate a single instruction. """ # The emulation might restart if Unicorn needs to bring in a memory map # or bring a value from Manticore state. while True: self.reset() # Establish Manticore state, potentia...
def emulate(self, instruction): """ Emulate a single instruction. """ # The emulation might restart if Unicorn needs to bring in a memory map # or bring a value from Manticore state. while True: self.reset() # Establish Manticore state, potentia...
[ "Emulate", "a", "single", "instruction", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/fallback_emulator.py#L162-L194
[ "def", "emulate", "(", "self", ",", "instruction", ")", ":", "# The emulation might restart if Unicorn needs to bring in a memory map", "# or bring a value from Manticore state.", "while", "True", ":", "self", ".", "reset", "(", ")", "# Establish Manticore state, potentially from...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
UnicornEmulator._step
A single attempt at executing an instruction.
manticore/utils/fallback_emulator.py
def _step(self, instruction): """ A single attempt at executing an instruction. """ logger.debug("0x%x:\t%s\t%s" % (instruction.address, instruction.mnemonic, instruction.op_str)) registers = set(self._cpu.canonical_registers) # Refer to EFLAGS inst...
def _step(self, instruction): """ A single attempt at executing an instruction. """ logger.debug("0x%x:\t%s\t%s" % (instruction.address, instruction.mnemonic, instruction.op_str)) registers = set(self._cpu.canonical_registers) # Refer to EFLAGS inst...
[ "A", "single", "attempt", "at", "executing", "an", "instruction", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/fallback_emulator.py#L196-L287
[ "def", "_step", "(", "self", ",", "instruction", ")", ":", "logger", ".", "debug", "(", "\"0x%x:\\t%s\\t%s\"", "%", "(", "instruction", ".", "address", ",", "instruction", ".", "mnemonic", ",", "instruction", ".", "op_str", ")", ")", "registers", "=", "set...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
rlp_encode
r""" Recursive Length Prefix Encoding :param item: the object to encode, either a string, bytes, bytearray, int, long, or sequence https://github.com/ethereum/wiki/wiki/RLP >>> rlp_encode('dog') b'\x83dog' >>> rlp_encode([ 'cat', 'dog' ]) b'\xc8\x83cat\x83dog' >>> rlp_encode('') ...
manticore/utils/rlp.py
def rlp_encode(item): r""" Recursive Length Prefix Encoding :param item: the object to encode, either a string, bytes, bytearray, int, long, or sequence https://github.com/ethereum/wiki/wiki/RLP >>> rlp_encode('dog') b'\x83dog' >>> rlp_encode([ 'cat', 'dog' ]) b'\xc8\x83cat\x83dog' ...
def rlp_encode(item): r""" Recursive Length Prefix Encoding :param item: the object to encode, either a string, bytes, bytearray, int, long, or sequence https://github.com/ethereum/wiki/wiki/RLP >>> rlp_encode('dog') b'\x83dog' >>> rlp_encode([ 'cat', 'dog' ]) b'\xc8\x83cat\x83dog' ...
[ "r", "Recursive", "Length", "Prefix", "Encoding", ":", "param", "item", ":", "the", "object", "to", "encode", "either", "a", "string", "bytes", "bytearray", "int", "long", "or", "sequence" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/rlp.py#L13-L64
[ "def", "rlp_encode", "(", "item", ")", ":", "if", "item", "is", "None", "or", "item", "==", "0", ":", "ret", "=", "b'\\x80'", "elif", "isinstance", "(", "item", ",", "str", ")", ":", "ret", "=", "rlp_encode", "(", "item", ".", "encode", "(", "'utf8...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Solver.must_be_true
Check if expression is True and that it can not be False with current constraints
manticore/core/smtlib/solver.py
def must_be_true(self, constraints, expression) -> bool: """Check if expression is True and that it can not be False with current constraints""" solutions = self.get_all_values(constraints, expression, maxcnt=2, silent=True) return solutions == [True]
def must_be_true(self, constraints, expression) -> bool: """Check if expression is True and that it can not be False with current constraints""" solutions = self.get_all_values(constraints, expression, maxcnt=2, silent=True) return solutions == [True]
[ "Check", "if", "expression", "is", "True", "and", "that", "it", "can", "not", "be", "False", "with", "current", "constraints" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/solver.py#L71-L74
[ "def", "must_be_true", "(", "self", ",", "constraints", ",", "expression", ")", "->", "bool", ":", "solutions", "=", "self", ".", "get_all_values", "(", "constraints", ",", "expression", ",", "maxcnt", "=", "2", ",", "silent", "=", "True", ")", "return", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Solver.max
Iteratively finds the maximum value for a symbol within given constraints. :param X: a symbol or expression :param M: maximum number of iterations allowed
manticore/core/smtlib/solver.py
def max(self, constraints, X: BitVec, M=10000): """ Iteratively finds the maximum value for a symbol within given constraints. :param X: a symbol or expression :param M: maximum number of iterations allowed """ assert isinstance(X, BitVec) return self.optimize(con...
def max(self, constraints, X: BitVec, M=10000): """ Iteratively finds the maximum value for a symbol within given constraints. :param X: a symbol or expression :param M: maximum number of iterations allowed """ assert isinstance(X, BitVec) return self.optimize(con...
[ "Iteratively", "finds", "the", "maximum", "value", "for", "a", "symbol", "within", "given", "constraints", ".", ":", "param", "X", ":", "a", "symbol", "or", "expression", ":", "param", "M", ":", "maximum", "number", "of", "iterations", "allowed" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/solver.py#L84-L91
[ "def", "max", "(", "self", ",", "constraints", ",", "X", ":", "BitVec", ",", "M", "=", "10000", ")", ":", "assert", "isinstance", "(", "X", ",", "BitVec", ")", "return", "self", ".", "optimize", "(", "constraints", ",", "X", ",", "'maximize'", ",", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Solver.min
Iteratively finds the minimum value for a symbol within given constraints. :param constraints: constraints that the expression must fulfil :param X: a symbol or expression :param M: maximum number of iterations allowed
manticore/core/smtlib/solver.py
def min(self, constraints, X: BitVec, M=10000): """ Iteratively finds the minimum value for a symbol within given constraints. :param constraints: constraints that the expression must fulfil :param X: a symbol or expression :param M: maximum number of iterations allowed ...
def min(self, constraints, X: BitVec, M=10000): """ Iteratively finds the minimum value for a symbol within given constraints. :param constraints: constraints that the expression must fulfil :param X: a symbol or expression :param M: maximum number of iterations allowed ...
[ "Iteratively", "finds", "the", "minimum", "value", "for", "a", "symbol", "within", "given", "constraints", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/solver.py#L93-L102
[ "def", "min", "(", "self", ",", "constraints", ",", "X", ":", "BitVec", ",", "M", "=", "10000", ")", ":", "assert", "isinstance", "(", "X", ",", "BitVec", ")", "return", "self", ".", "optimize", "(", "constraints", ",", "X", ",", "'minimize'", ",", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Solver.minmax
Returns the min and max possible values for x within given constraints
manticore/core/smtlib/solver.py
def minmax(self, constraints, x, iters=10000): """Returns the min and max possible values for x within given constraints""" if issymbolic(x): m = self.min(constraints, x, iters) M = self.max(constraints, x, iters) return m, M else: return x, x
def minmax(self, constraints, x, iters=10000): """Returns the min and max possible values for x within given constraints""" if issymbolic(x): m = self.min(constraints, x, iters) M = self.max(constraints, x, iters) return m, M else: return x, x
[ "Returns", "the", "min", "and", "max", "possible", "values", "for", "x", "within", "given", "constraints" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/solver.py#L104-L111
[ "def", "minmax", "(", "self", ",", "constraints", ",", "x", ",", "iters", "=", "10000", ")", ":", "if", "issymbolic", "(", "x", ")", ":", "m", "=", "self", ".", "min", "(", "constraints", ",", "x", ",", "iters", ")", "M", "=", "self", ".", "max...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Z3Solver._solver_version
If we fail to parse the version, we assume z3's output has changed, meaning it's a newer version than what's used now, and therefore ok. Anticipated version_cmd_output format: 'Z3 version 4.4.2' 'Z3 version 4.4.5 - 64 bit - build hashcode $Z3GITHASH'
manticore/core/smtlib/solver.py
def _solver_version(self) -> Version: """ If we fail to parse the version, we assume z3's output has changed, meaning it's a newer version than what's used now, and therefore ok. Anticipated version_cmd_output format: 'Z3 version 4.4.2' 'Z3...
def _solver_version(self) -> Version: """ If we fail to parse the version, we assume z3's output has changed, meaning it's a newer version than what's used now, and therefore ok. Anticipated version_cmd_output format: 'Z3 version 4.4.2' 'Z3...
[ "If", "we", "fail", "to", "parse", "the", "version", "we", "assume", "z3", "s", "output", "has", "changed", "meaning", "it", "s", "a", "newer", "version", "than", "what", "s", "used", "now", "and", "therefore", "ok", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/solver.py#L166-L179
[ "def", "_solver_version", "(", "self", ")", "->", "Version", ":", "self", ".", "_reset", "(", ")", "if", "self", ".", "_received_version", "is", "None", ":", "self", ".", "_send", "(", "'(get-info :version)'", ")", "self", ".", "_received_version", "=", "s...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Z3Solver._start_proc
Spawns z3 solver process
manticore/core/smtlib/solver.py
def _start_proc(self): """Spawns z3 solver process""" assert '_proc' not in dir(self) or self._proc is None try: self._proc = Popen(shlex.split(self._command), stdin=PIPE, stdout=PIPE, bufsize=0, universal_newlines=True) except OSError as e: print(e, "Probably too...
def _start_proc(self): """Spawns z3 solver process""" assert '_proc' not in dir(self) or self._proc is None try: self._proc = Popen(shlex.split(self._command), stdin=PIPE, stdout=PIPE, bufsize=0, universal_newlines=True) except OSError as e: print(e, "Probably too...
[ "Spawns", "z3", "solver", "process" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/solver.py#L181-L193
[ "def", "_start_proc", "(", "self", ")", ":", "assert", "'_proc'", "not", "in", "dir", "(", "self", ")", "or", "self", ".", "_proc", "is", "None", "try", ":", "self", ".", "_proc", "=", "Popen", "(", "shlex", ".", "split", "(", "self", ".", "_comman...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Z3Solver._stop_proc
Stops the z3 solver process by: - sending an exit command to it, - sending a SIGKILL signal, - waiting till the process terminates (so we don't leave a zombie process)
manticore/core/smtlib/solver.py
def _stop_proc(self): """ Stops the z3 solver process by: - sending an exit command to it, - sending a SIGKILL signal, - waiting till the process terminates (so we don't leave a zombie process) """ if self._proc is None: return if self._proc.re...
def _stop_proc(self): """ Stops the z3 solver process by: - sending an exit command to it, - sending a SIGKILL signal, - waiting till the process terminates (so we don't leave a zombie process) """ if self._proc is None: return if self._proc.re...
[ "Stops", "the", "z3", "solver", "process", "by", ":", "-", "sending", "an", "exit", "command", "to", "it", "-", "sending", "a", "SIGKILL", "signal", "-", "waiting", "till", "the", "process", "terminates", "(", "so", "we", "don", "t", "leave", "a", "zom...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/solver.py#L195-L223
[ "def", "_stop_proc", "(", "self", ")", ":", "if", "self", ".", "_proc", "is", "None", ":", "return", "if", "self", ".", "_proc", ".", "returncode", "is", "None", ":", "try", ":", "self", ".", "_send", "(", "\"(exit)\"", ")", "except", "(", "SolverErr...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Z3Solver._reset
Auxiliary method to reset the smtlib external solver to initial defaults
manticore/core/smtlib/solver.py
def _reset(self, constraints=None): """Auxiliary method to reset the smtlib external solver to initial defaults""" if self._proc is None: self._start_proc() else: if self.support_reset: self._send("(reset)") for cfg in self._init: ...
def _reset(self, constraints=None): """Auxiliary method to reset the smtlib external solver to initial defaults""" if self._proc is None: self._start_proc() else: if self.support_reset: self._send("(reset)") for cfg in self._init: ...
[ "Auxiliary", "method", "to", "reset", "the", "smtlib", "external", "solver", "to", "initial", "defaults" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/solver.py#L242-L256
[ "def", "_reset", "(", "self", ",", "constraints", "=", "None", ")", ":", "if", "self", ".", "_proc", "is", "None", ":", "self", ".", "_start_proc", "(", ")", "else", ":", "if", "self", ".", "support_reset", ":", "self", ".", "_send", "(", "\"(reset)\...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Z3Solver._send
Send a string to the solver. :param cmd: a SMTLIBv2 command (ex. (check-sat))
manticore/core/smtlib/solver.py
def _send(self, cmd: str): """ Send a string to the solver. :param cmd: a SMTLIBv2 command (ex. (check-sat)) """ logger.debug('>%s', cmd) try: self._proc.stdout.flush() self._proc.stdin.write(f'{cmd}\n') except IOError as e: ra...
def _send(self, cmd: str): """ Send a string to the solver. :param cmd: a SMTLIBv2 command (ex. (check-sat)) """ logger.debug('>%s', cmd) try: self._proc.stdout.flush() self._proc.stdin.write(f'{cmd}\n') except IOError as e: ra...
[ "Send", "a", "string", "to", "the", "solver", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/solver.py#L258-L269
[ "def", "_send", "(", "self", ",", "cmd", ":", "str", ")", ":", "logger", ".", "debug", "(", "'>%s'", ",", "cmd", ")", "try", ":", "self", ".", "_proc", ".", "stdout", ".", "flush", "(", ")", "self", ".", "_proc", ".", "stdin", ".", "write", "("...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Z3Solver._recv
Reads the response from the solver
manticore/core/smtlib/solver.py
def _recv(self) -> str: """Reads the response from the solver""" buf, left, right = self.__readline_and_count() bufl = [buf] while left != right: buf, l, r = self.__readline_and_count() bufl.append(buf) left += l right += r buf = ...
def _recv(self) -> str: """Reads the response from the solver""" buf, left, right = self.__readline_and_count() bufl = [buf] while left != right: buf, l, r = self.__readline_and_count() bufl.append(buf) left += l right += r buf = ...
[ "Reads", "the", "response", "from", "the", "solver" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/solver.py#L271-L287
[ "def", "_recv", "(", "self", ")", "->", "str", ":", "buf", ",", "left", ",", "right", "=", "self", ".", "__readline_and_count", "(", ")", "bufl", "=", "[", "buf", "]", "while", "left", "!=", "right", ":", "buf", ",", "l", ",", "r", "=", "self", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Z3Solver._is_sat
Check the satisfiability of the current state :return: whether current state is satisfiable or not.
manticore/core/smtlib/solver.py
def _is_sat(self) -> bool: """ Check the satisfiability of the current state :return: whether current state is satisfiable or not. """ logger.debug("Solver.check() ") start = time.time() self._send('(check-sat)') status = self._recv() logger.debug...
def _is_sat(self) -> bool: """ Check the satisfiability of the current state :return: whether current state is satisfiable or not. """ logger.debug("Solver.check() ") start = time.time() self._send('(check-sat)') status = self._recv() logger.debug...
[ "Check", "the", "satisfiability", "of", "the", "current", "state" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/solver.py#L294-L315
[ "def", "_is_sat", "(", "self", ")", "->", "bool", ":", "logger", ".", "debug", "(", "\"Solver.check() \"", ")", "start", "=", "time", ".", "time", "(", ")", "self", ".", "_send", "(", "'(check-sat)'", ")", "status", "=", "self", ".", "_recv", "(", ")...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Z3Solver._assert
Auxiliary method to send an assert
manticore/core/smtlib/solver.py
def _assert(self, expression: Bool): """Auxiliary method to send an assert""" assert isinstance(expression, Bool) smtlib = translate_to_smtlib(expression) self._send('(assert %s)' % smtlib)
def _assert(self, expression: Bool): """Auxiliary method to send an assert""" assert isinstance(expression, Bool) smtlib = translate_to_smtlib(expression) self._send('(assert %s)' % smtlib)
[ "Auxiliary", "method", "to", "send", "an", "assert" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/solver.py#L317-L321
[ "def", "_assert", "(", "self", ",", "expression", ":", "Bool", ")", ":", "assert", "isinstance", "(", "expression", ",", "Bool", ")", "smtlib", "=", "translate_to_smtlib", "(", "expression", ")", "self", ".", "_send", "(", "'(assert %s)'", "%", "smtlib", "...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Z3Solver._getvalue
Ask the solver for one possible assignment for given expression using current set of constraints. The current set of expressions must be sat. NOTE: This is an internal method: it uses the current solver state (set of constraints!).
manticore/core/smtlib/solver.py
def _getvalue(self, expression): """ Ask the solver for one possible assignment for given expression using current set of constraints. The current set of expressions must be sat. NOTE: This is an internal method: it uses the current solver state (set of constraints!). """ ...
def _getvalue(self, expression): """ Ask the solver for one possible assignment for given expression using current set of constraints. The current set of expressions must be sat. NOTE: This is an internal method: it uses the current solver state (set of constraints!). """ ...
[ "Ask", "the", "solver", "for", "one", "possible", "assignment", "for", "given", "expression", "using", "current", "set", "of", "constraints", ".", "The", "current", "set", "of", "expressions", "must", "be", "sat", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/solver.py#L323-L355
[ "def", "_getvalue", "(", "self", ",", "expression", ")", ":", "if", "not", "issymbolic", "(", "expression", ")", ":", "return", "expression", "assert", "isinstance", "(", "expression", ",", "Variable", ")", "if", "isinstance", "(", "expression", ",", "Array"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Z3Solver.can_be_true
Check if two potentially symbolic values can be equal
manticore/core/smtlib/solver.py
def can_be_true(self, constraints, expression): """Check if two potentially symbolic values can be equal""" if isinstance(expression, bool): if not expression: return expression else: # if True check if constraints are feasible self...
def can_be_true(self, constraints, expression): """Check if two potentially symbolic values can be equal""" if isinstance(expression, bool): if not expression: return expression else: # if True check if constraints are feasible self...
[ "Check", "if", "two", "potentially", "symbolic", "values", "can", "be", "equal" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/solver.py#L366-L380
[ "def", "can_be_true", "(", "self", ",", "constraints", ",", "expression", ")", ":", "if", "isinstance", "(", "expression", ",", "bool", ")", ":", "if", "not", "expression", ":", "return", "expression", "else", ":", "# if True check if constraints are feasible", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Z3Solver.get_all_values
Returns a list with all the possible values for the symbol x
manticore/core/smtlib/solver.py
def get_all_values(self, constraints, expression, maxcnt=None, silent=False): """Returns a list with all the possible values for the symbol x""" if not isinstance(expression, Expression): return [expression] assert isinstance(constraints, ConstraintSet) assert isinstance(expr...
def get_all_values(self, constraints, expression, maxcnt=None, silent=False): """Returns a list with all the possible values for the symbol x""" if not isinstance(expression, Expression): return [expression] assert isinstance(constraints, ConstraintSet) assert isinstance(expr...
[ "Returns", "a", "list", "with", "all", "the", "possible", "values", "for", "the", "symbol", "x" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/solver.py#L383-L423
[ "def", "get_all_values", "(", "self", ",", "constraints", ",", "expression", ",", "maxcnt", "=", "None", ",", "silent", "=", "False", ")", ":", "if", "not", "isinstance", "(", "expression", ",", "Expression", ")", ":", "return", "[", "expression", "]", "...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Z3Solver.optimize
Iteratively finds the maximum or minimum value for the operation (Normally Operators.UGT or Operators.ULT) :param constraints: constraints to take into account :param x: a symbol or expression :param goal: goal to achieve, either 'maximize' or 'minimize' :param M: maximum number...
manticore/core/smtlib/solver.py
def optimize(self, constraints: ConstraintSet, x: BitVec, goal: str, M=10000): """ Iteratively finds the maximum or minimum value for the operation (Normally Operators.UGT or Operators.ULT) :param constraints: constraints to take into account :param x: a symbol or expression ...
def optimize(self, constraints: ConstraintSet, x: BitVec, goal: str, M=10000): """ Iteratively finds the maximum or minimum value for the operation (Normally Operators.UGT or Operators.ULT) :param constraints: constraints to take into account :param x: a symbol or expression ...
[ "Iteratively", "finds", "the", "maximum", "or", "minimum", "value", "for", "the", "operation", "(", "Normally", "Operators", ".", "UGT", "or", "Operators", ".", "ULT", ")" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/solver.py#L425-L488
[ "def", "optimize", "(", "self", ",", "constraints", ":", "ConstraintSet", ",", "x", ":", "BitVec", ",", "goal", ":", "str", ",", "M", "=", "10000", ")", ":", "assert", "goal", "in", "(", "'maximize'", ",", "'minimize'", ")", "assert", "isinstance", "("...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Z3Solver.get_value
Ask the solver for one possible result of given expression using given set of constraints.
manticore/core/smtlib/solver.py
def get_value(self, constraints, expression): """ Ask the solver for one possible result of given expression using given set of constraints. """ if not issymbolic(expression): return expression assert isinstance(expression, (Bool, BitVec, Array)) with constrai...
def get_value(self, constraints, expression): """ Ask the solver for one possible result of given expression using given set of constraints. """ if not issymbolic(expression): return expression assert isinstance(expression, (Bool, BitVec, Array)) with constrai...
[ "Ask", "the", "solver", "for", "one", "possible", "result", "of", "given", "expression", "using", "given", "set", "of", "constraints", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/smtlib/solver.py#L490-L543
[ "def", "get_value", "(", "self", ",", "constraints", ",", "expression", ")", ":", "if", "not", "issymbolic", "(", "expression", ")", ":", "return", "expression", "assert", "isinstance", "(", "expression", ",", "(", "Bool", ",", "BitVec", ",", "Array", ")",...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ContextFilter.summarized_name
Produce a summarized record name i.e. manticore.core.executor -> m.c.executor
manticore/utils/log.py
def summarized_name(self, name): """ Produce a summarized record name i.e. manticore.core.executor -> m.c.executor """ components = name.split('.') prefix = '.'.join(c[0] for c in components[:-1]) return f'{prefix}.{components[-1]}'
def summarized_name(self, name): """ Produce a summarized record name i.e. manticore.core.executor -> m.c.executor """ components = name.split('.') prefix = '.'.join(c[0] for c in components[:-1]) return f'{prefix}.{components[-1]}'
[ "Produce", "a", "summarized", "record", "name", "i", ".", "e", ".", "manticore", ".", "core", ".", "executor", "-", ">", "m", ".", "c", ".", "executor" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/log.py#L20-L27
[ "def", "summarized_name", "(", "self", ",", "name", ")", ":", "components", "=", "name", ".", "split", "(", "'.'", ")", "prefix", "=", "'.'", ".", "join", "(", "c", "[", "0", "]", "for", "c", "in", "components", "[", ":", "-", "1", "]", ")", "r...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ContextFilter.colored_level_name
Colors the logging level in the logging record
manticore/utils/log.py
def colored_level_name(self, levelname): """ Colors the logging level in the logging record """ if self.colors_disabled: return self.plain_levelname_format.format(levelname) else: return self.colored_levelname_format.format(self.color_map[levelname], level...
def colored_level_name(self, levelname): """ Colors the logging level in the logging record """ if self.colors_disabled: return self.plain_levelname_format.format(levelname) else: return self.colored_levelname_format.format(self.color_map[levelname], level...
[ "Colors", "the", "logging", "level", "in", "the", "logging", "record" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/log.py#L43-L50
[ "def", "colored_level_name", "(", "self", ",", "levelname", ")", ":", "if", "self", ".", "colors_disabled", ":", "return", "self", ".", "plain_levelname_format", ".", "format", "(", "levelname", ")", "else", ":", "return", "self", ".", "colored_levelname_format"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
_find_zero
Helper for finding the closest NULL or, effectively NULL byte from a starting address. :param Cpu cpu: :param ConstraintSet constrs: Constraints for current `State` :param int ptr: Address to start searching for a zero from :return: Offset from `ptr` to first byte that is 0 or an `Expression` that must...
manticore/native/models.py
def _find_zero(cpu, constrs, ptr): """ Helper for finding the closest NULL or, effectively NULL byte from a starting address. :param Cpu cpu: :param ConstraintSet constrs: Constraints for current `State` :param int ptr: Address to start searching for a zero from :return: Offset from `ptr` to fi...
def _find_zero(cpu, constrs, ptr): """ Helper for finding the closest NULL or, effectively NULL byte from a starting address. :param Cpu cpu: :param ConstraintSet constrs: Constraints for current `State` :param int ptr: Address to start searching for a zero from :return: Offset from `ptr` to fi...
[ "Helper", "for", "finding", "the", "closest", "NULL", "or", "effectively", "NULL", "byte", "from", "a", "starting", "address", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/models.py#L35-L58
[ "def", "_find_zero", "(", "cpu", ",", "constrs", ",", "ptr", ")", ":", "offset", "=", "0", "while", "True", ":", "byt", "=", "cpu", ".", "read_int", "(", "ptr", "+", "offset", ",", "8", ")", "if", "issymbolic", "(", "byt", ")", ":", "if", "not", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
strcmp
strcmp symbolic model. Algorithm: Walks from end of string (minimum offset to NULL in either string) to beginning building tree of ITEs each time either of the bytes at current offset is symbolic. Points of Interest: - We've been building up a symbolic tree but then encounter two concrete by...
manticore/native/models.py
def strcmp(state, s1, s2): """ strcmp symbolic model. Algorithm: Walks from end of string (minimum offset to NULL in either string) to beginning building tree of ITEs each time either of the bytes at current offset is symbolic. Points of Interest: - We've been building up a symbolic tree b...
def strcmp(state, s1, s2): """ strcmp symbolic model. Algorithm: Walks from end of string (minimum offset to NULL in either string) to beginning building tree of ITEs each time either of the bytes at current offset is symbolic. Points of Interest: - We've been building up a symbolic tree b...
[ "strcmp", "symbolic", "model", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/models.py#L61-L114
[ "def", "strcmp", "(", "state", ",", "s1", ",", "s2", ")", ":", "cpu", "=", "state", ".", "cpu", "if", "issymbolic", "(", "s1", ")", ":", "raise", "ConcretizeArgument", "(", "state", ".", "cpu", ",", "1", ")", "if", "issymbolic", "(", "s2", ")", "...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
strlen
strlen symbolic model. Algorithm: Walks from end of string not including NULL building ITE tree when current byte is symbolic. :param State state: current program state :param int s: Address of string :return: Symbolic strlen result :rtype: Expression or int
manticore/native/models.py
def strlen(state, s): """ strlen symbolic model. Algorithm: Walks from end of string not including NULL building ITE tree when current byte is symbolic. :param State state: current program state :param int s: Address of string :return: Symbolic strlen result :rtype: Expression or int "...
def strlen(state, s): """ strlen symbolic model. Algorithm: Walks from end of string not including NULL building ITE tree when current byte is symbolic. :param State state: current program state :param int s: Address of string :return: Symbolic strlen result :rtype: Expression or int "...
[ "strlen", "symbolic", "model", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/models.py#L117-L143
[ "def", "strlen", "(", "state", ",", "s", ")", ":", "cpu", "=", "state", ".", "cpu", "if", "issymbolic", "(", "s", ")", ":", "raise", "ConcretizeArgument", "(", "state", ".", "cpu", ",", "1", ")", "zero_idx", "=", "_find_zero", "(", "cpu", ",", "sta...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Eventful.all_events
Return all events that all subclasses have so far registered to publish.
manticore/utils/event.py
def all_events(cls): """ Return all events that all subclasses have so far registered to publish. """ all_evts = set() for cls, evts in cls.__all_events__.items(): all_evts.update(evts) return all_evts
def all_events(cls): """ Return all events that all subclasses have so far registered to publish. """ all_evts = set() for cls, evts in cls.__all_events__.items(): all_evts.update(evts) return all_evts
[ "Return", "all", "events", "that", "all", "subclasses", "have", "so", "far", "registered", "to", "publish", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/event.py#L65-L72
[ "def", "all_events", "(", "cls", ")", ":", "all_evts", "=", "set", "(", ")", "for", "cls", ",", "evts", "in", "cls", ".", "__all_events__", ".", "items", "(", ")", ":", "all_evts", ".", "update", "(", "evts", ")", "return", "all_evts" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Eventful.forward_events_to
This forwards signal to sink
manticore/utils/event.py
def forward_events_to(self, sink, include_source=False): """This forwards signal to sink""" assert isinstance(sink, Eventful), f'{sink.__class__.__name__} is not Eventful' self._forwards[sink] = include_source
def forward_events_to(self, sink, include_source=False): """This forwards signal to sink""" assert isinstance(sink, Eventful), f'{sink.__class__.__name__} is not Eventful' self._forwards[sink] = include_source
[ "This", "forwards", "signal", "to", "sink" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/event.py#L158-L161
[ "def", "forward_events_to", "(", "self", ",", "sink", ",", "include_source", "=", "False", ")", ":", "assert", "isinstance", "(", "sink", ",", "Eventful", ")", ",", "f'{sink.__class__.__name__} is not Eventful'", "self", ".", "_forwards", "[", "sink", "]", "=", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ManticoreBase.context
Convenient access to shared context
manticore/core/manticore.py
def context(self): """ Convenient access to shared context """ if self._context is not None: return self._context else: logger.warning("Using shared context without a lock") return self._executor._shared_context
def context(self): """ Convenient access to shared context """ if self._context is not None: return self._context else: logger.warning("Using shared context without a lock") return self._executor._shared_context
[ "Convenient", "access", "to", "shared", "context" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/manticore.py#L170-L176
[ "def", "context", "(", "self", ")", ":", "if", "self", ".", "_context", "is", "not", "None", ":", "return", "self", ".", "_context", "else", ":", "logger", ".", "warning", "(", "\"Using shared context without a lock\"", ")", "return", "self", ".", "_executor...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ManticoreBase.locked_context
A context manager that provides safe parallel access to the global Manticore context. This should be used to access the global Manticore context when parallel analysis is activated. Code within the `with` block is executed atomically, so access of shared variables should occur within. E...
manticore/core/manticore.py
def locked_context(self, key=None, value_type=list): """ A context manager that provides safe parallel access to the global Manticore context. This should be used to access the global Manticore context when parallel analysis is activated. Code within the `with` block is executed ...
def locked_context(self, key=None, value_type=list): """ A context manager that provides safe parallel access to the global Manticore context. This should be used to access the global Manticore context when parallel analysis is activated. Code within the `with` block is executed ...
[ "A", "context", "manager", "that", "provides", "safe", "parallel", "access", "to", "the", "global", "Manticore", "context", ".", "This", "should", "be", "used", "to", "access", "the", "global", "Manticore", "context", "when", "parallel", "analysis", "is", "act...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/manticore.py#L179-L218
[ "def", "locked_context", "(", "self", ",", "key", "=", "None", ",", "value_type", "=", "list", ")", ":", "@", "contextmanager", "def", "_real_context", "(", ")", ":", "if", "self", ".", "_context", "is", "not", "None", ":", "yield", "self", ".", "_cont...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ManticoreBase.get_profiling_stats
Returns a pstat.Stats instance with profiling results if `run` was called with `should_profile=True`. Otherwise, returns `None`.
manticore/core/manticore.py
def get_profiling_stats(self): """ Returns a pstat.Stats instance with profiling results if `run` was called with `should_profile=True`. Otherwise, returns `None`. """ profile_file_path = os.path.join(self.workspace, 'profiling.bin') try: return pstats.Stats(p...
def get_profiling_stats(self): """ Returns a pstat.Stats instance with profiling results if `run` was called with `should_profile=True`. Otherwise, returns `None`. """ profile_file_path = os.path.join(self.workspace, 'profiling.bin') try: return pstats.Stats(p...
[ "Returns", "a", "pstat", ".", "Stats", "instance", "with", "profiling", "results", "if", "run", "was", "called", "with", "should_profile", "=", "True", ".", "Otherwise", "returns", "None", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/manticore.py#L390-L400
[ "def", "get_profiling_stats", "(", "self", ")", ":", "profile_file_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "workspace", ",", "'profiling.bin'", ")", "try", ":", "return", "pstats", ".", "Stats", "(", "profile_file_path", ")", "except", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ManticoreBase.run
Runs analysis. :param int procs: Number of parallel worker processes :param timeout: Analysis timeout, in seconds
manticore/core/manticore.py
def run(self, procs=1, timeout=None, should_profile=False): """ Runs analysis. :param int procs: Number of parallel worker processes :param timeout: Analysis timeout, in seconds """ assert not self.running, "Manticore is already running." self._start_run() ...
def run(self, procs=1, timeout=None, should_profile=False): """ Runs analysis. :param int procs: Number of parallel worker processes :param timeout: Analysis timeout, in seconds """ assert not self.running, "Manticore is already running." self._start_run() ...
[ "Runs", "analysis", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/manticore.py#L424-L439
[ "def", "run", "(", "self", ",", "procs", "=", "1", ",", "timeout", "=", "None", ",", "should_profile", "=", "False", ")", ":", "assert", "not", "self", ".", "running", ",", "\"Manticore is already running.\"", "self", ".", "_start_run", "(", ")", "self", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
main
Dispatches execution into one of Manticore's engines: evm or native.
manticore/__main__.py
def main(): """ Dispatches execution into one of Manticore's engines: evm or native. """ args = parse_arguments() if args.no_colors: log.disable_colors() sys.setrecursionlimit(consts.recursionlimit) ManticoreBase.verbosity(args.v) if args.argv[0].endswith('.sol'): eth...
def main(): """ Dispatches execution into one of Manticore's engines: evm or native. """ args = parse_arguments() if args.no_colors: log.disable_colors() sys.setrecursionlimit(consts.recursionlimit) ManticoreBase.verbosity(args.v) if args.argv[0].endswith('.sol'): eth...
[ "Dispatches", "execution", "into", "one", "of", "Manticore", "s", "engines", ":", "evm", "or", "native", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/__main__.py#L27-L44
[ "def", "main", "(", ")", ":", "args", "=", "parse_arguments", "(", ")", "if", "args", ".", "no_colors", ":", "log", ".", "disable_colors", "(", ")", "sys", ".", "setrecursionlimit", "(", "consts", ".", "recursionlimit", ")", "ManticoreBase", ".", "verbosit...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
GetNBits
Get the first `nbits` from `value`. :param value: Source value from which to extract :type value: int or long or BitVec :param int nbits: How many bits to extract :return: Low `nbits` bits of `value`. :rtype int or long or BitVec
manticore/native/cpu/bitwise.py
def GetNBits(value, nbits): """ Get the first `nbits` from `value`. :param value: Source value from which to extract :type value: int or long or BitVec :param int nbits: How many bits to extract :return: Low `nbits` bits of `value`. :rtype int or long or BitVec """ # NOP if sizes ar...
def GetNBits(value, nbits): """ Get the first `nbits` from `value`. :param value: Source value from which to extract :type value: int or long or BitVec :param int nbits: How many bits to extract :return: Low `nbits` bits of `value`. :rtype int or long or BitVec """ # NOP if sizes ar...
[ "Get", "the", "first", "nbits", "from", "value", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/bitwise.py#L29-L46
[ "def", "GetNBits", "(", "value", ",", "nbits", ")", ":", "# NOP if sizes are the same", "if", "isinstance", "(", "value", ",", "int", ")", ":", "return", "Operators", ".", "EXTRACT", "(", "value", ",", "0", ",", "nbits", ")", "elif", "isinstance", "(", "...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SInt
Convert a bitstring `value` of `width` bits to a signed integer representation. :param value: The value to convert. :type value: int or long or BitVec :param int width: The width of the bitstring to consider :return: The converted value :rtype int or long or BitVec
manticore/native/cpu/bitwise.py
def SInt(value, width): """ Convert a bitstring `value` of `width` bits to a signed integer representation. :param value: The value to convert. :type value: int or long or BitVec :param int width: The width of the bitstring to consider :return: The converted value :rtype int or long or ...
def SInt(value, width): """ Convert a bitstring `value` of `width` bits to a signed integer representation. :param value: The value to convert. :type value: int or long or BitVec :param int width: The width of the bitstring to consider :return: The converted value :rtype int or long or ...
[ "Convert", "a", "bitstring", "value", "of", "width", "bits", "to", "a", "signed", "integer", "representation", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/bitwise.py#L49-L62
[ "def", "SInt", "(", "value", ",", "width", ")", ":", "return", "Operators", ".", "ITEBV", "(", "width", ",", "Bit", "(", "value", ",", "width", "-", "1", ")", "==", "1", ",", "GetNBits", "(", "value", ",", "width", ")", "-", "2", "**", "width", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
LSL_C
The ARM LSL_C (logical left shift with carry) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value and the carry result :rtype tuple
manticore/native/cpu/bitwise.py
def LSL_C(value, amount, width): """ The ARM LSL_C (logical left shift with carry) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value and the carry result ...
def LSL_C(value, amount, width): """ The ARM LSL_C (logical left shift with carry) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value and the carry result ...
[ "The", "ARM", "LSL_C", "(", "logical", "left", "shift", "with", "carry", ")", "operation", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/bitwise.py#L78-L94
[ "def", "LSL_C", "(", "value", ",", "amount", ",", "width", ")", ":", "assert", "amount", ">", "0", "value", "=", "Operators", ".", "ZEXTEND", "(", "value", ",", "width", "*", "2", ")", "shifted", "=", "value", "<<", "amount", "result", "=", "GetNBits...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
LSL
The ARM LSL (logical left shift) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value :rtype int or BitVec
manticore/native/cpu/bitwise.py
def LSL(value, amount, width): """ The ARM LSL (logical left shift) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value :rtype int or BitVec """ if ...
def LSL(value, amount, width): """ The ARM LSL (logical left shift) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value :rtype int or BitVec """ if ...
[ "The", "ARM", "LSL", "(", "logical", "left", "shift", ")", "operation", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/bitwise.py#L97-L112
[ "def", "LSL", "(", "value", ",", "amount", ",", "width", ")", ":", "if", "amount", "==", "0", ":", "return", "value", "result", ",", "_", "=", "LSL_C", "(", "value", ",", "amount", ",", "width", ")", "return", "result" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
LSR_C
The ARM LSR_C (logical shift right with carry) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value and carry result :rtype tuple
manticore/native/cpu/bitwise.py
def LSR_C(value, amount, width): """ The ARM LSR_C (logical shift right with carry) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value and carry result :rt...
def LSR_C(value, amount, width): """ The ARM LSR_C (logical shift right with carry) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value and carry result :rt...
[ "The", "ARM", "LSR_C", "(", "logical", "shift", "right", "with", "carry", ")", "operation", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/bitwise.py#L115-L129
[ "def", "LSR_C", "(", "value", ",", "amount", ",", "width", ")", ":", "assert", "amount", ">", "0", "result", "=", "GetNBits", "(", "value", ">>", "amount", ",", "width", ")", "carry", "=", "Bit", "(", "value", ">>", "(", "amount", "-", "1", ")", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
LSR
The ARM LSR (logical shift right) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value :rtype int or BitVec
manticore/native/cpu/bitwise.py
def LSR(value, amount, width): """ The ARM LSR (logical shift right) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value :rtype int or BitVec """ if...
def LSR(value, amount, width): """ The ARM LSR (logical shift right) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value :rtype int or BitVec """ if...
[ "The", "ARM", "LSR", "(", "logical", "shift", "right", ")", "operation", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/bitwise.py#L132-L146
[ "def", "LSR", "(", "value", ",", "amount", ",", "width", ")", ":", "if", "amount", "==", "0", ":", "return", "value", "result", ",", "_", "=", "LSR_C", "(", "value", ",", "amount", ",", "width", ")", "return", "result" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ASR_C
The ARM ASR_C (arithmetic shift right with carry) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value and carry result :rtype tuple
manticore/native/cpu/bitwise.py
def ASR_C(value, amount, width): """ The ARM ASR_C (arithmetic shift right with carry) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value and carry result ...
def ASR_C(value, amount, width): """ The ARM ASR_C (arithmetic shift right with carry) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value and carry result ...
[ "The", "ARM", "ASR_C", "(", "arithmetic", "shift", "right", "with", "carry", ")", "operation", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/bitwise.py#L149-L166
[ "def", "ASR_C", "(", "value", ",", "amount", ",", "width", ")", ":", "assert", "amount", "<=", "width", "assert", "amount", ">", "0", "assert", "amount", "+", "width", "<=", "width", "*", "2", "value", "=", "Operators", ".", "SEXTEND", "(", "value", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ASR
The ARM ASR (arithmetic shift right) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value :rtype int or BitVec
manticore/native/cpu/bitwise.py
def ASR(value, amount, width): """ The ARM ASR (arithmetic shift right) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value :rtype int or BitVec """ ...
def ASR(value, amount, width): """ The ARM ASR (arithmetic shift right) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to shift it. :param int width: Width of the value :return: Resultant value :rtype int or BitVec """ ...
[ "The", "ARM", "ASR", "(", "arithmetic", "shift", "right", ")", "operation", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/bitwise.py#L169-L184
[ "def", "ASR", "(", "value", ",", "amount", ",", "width", ")", ":", "if", "amount", "==", "0", ":", "return", "value", "result", ",", "_", "=", "ASR_C", "(", "value", ",", "amount", ",", "width", ")", "return", "result" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ROR_C
The ARM ROR_C (rotate right with carry) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to rotate it. :param int width: Width of the value :return: Resultant value and carry result :rtype tuple
manticore/native/cpu/bitwise.py
def ROR_C(value, amount, width): """ The ARM ROR_C (rotate right with carry) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to rotate it. :param int width: Width of the value :return: Resultant value and carry result :rtype tu...
def ROR_C(value, amount, width): """ The ARM ROR_C (rotate right with carry) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to rotate it. :param int width: Width of the value :return: Resultant value and carry result :rtype tu...
[ "The", "ARM", "ROR_C", "(", "rotate", "right", "with", "carry", ")", "operation", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/bitwise.py#L187-L205
[ "def", "ROR_C", "(", "value", ",", "amount", ",", "width", ")", ":", "assert", "amount", "<=", "width", "assert", "amount", ">", "0", "m", "=", "amount", "%", "width", "right", ",", "_", "=", "LSR_C", "(", "value", ",", "m", ",", "width", ")", "l...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ROR
The ARM ROR (rotate right) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to rotate it. :param int width: Width of the value :return: Resultant value :rtype int or BitVec
manticore/native/cpu/bitwise.py
def ROR(value, amount, width): """ The ARM ROR (rotate right) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to rotate it. :param int width: Width of the value :return: Resultant value :rtype int or BitVec """ if amoun...
def ROR(value, amount, width): """ The ARM ROR (rotate right) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to rotate it. :param int width: Width of the value :return: Resultant value :rtype int or BitVec """ if amoun...
[ "The", "ARM", "ROR", "(", "rotate", "right", ")", "operation", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/bitwise.py#L208-L222
[ "def", "ROR", "(", "value", ",", "amount", ",", "width", ")", ":", "if", "amount", "==", "0", ":", "return", "value", "result", ",", "_", "=", "ROR_C", "(", "value", ",", "amount", ",", "width", ")", "return", "result" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
RRX_C
The ARM RRX (rotate right with extend and with carry) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to rotate it. :param int width: Width of the value :return: Resultant value and carry result :rtype tuple
manticore/native/cpu/bitwise.py
def RRX_C(value, carry, width): """ The ARM RRX (rotate right with extend and with carry) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to rotate it. :param int width: Width of the value :return: Resultant value and carry result ...
def RRX_C(value, carry, width): """ The ARM RRX (rotate right with extend and with carry) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to rotate it. :param int width: Width of the value :return: Resultant value and carry result ...
[ "The", "ARM", "RRX", "(", "rotate", "right", "with", "extend", "and", "with", "carry", ")", "operation", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/bitwise.py#L225-L238
[ "def", "RRX_C", "(", "value", ",", "carry", ",", "width", ")", ":", "carry_out", "=", "Bit", "(", "value", ",", "0", ")", "result", "=", "(", "value", ">>", "1", ")", "|", "(", "carry", "<<", "(", "width", "-", "1", ")", ")", "return", "(", "...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
RRX
The ARM RRX (rotate right with extend) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to rotate it. :param int width: Width of the value :return: Resultant value :rtype int or BitVec
manticore/native/cpu/bitwise.py
def RRX(value, carry, width): """ The ARM RRX (rotate right with extend) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to rotate it. :param int width: Width of the value :return: Resultant value :rtype int or BitVec """ ...
def RRX(value, carry, width): """ The ARM RRX (rotate right with extend) operation. :param value: Value to shift :type value: int or long or BitVec :param int amount: How many bits to rotate it. :param int width: Width of the value :return: Resultant value :rtype int or BitVec """ ...
[ "The", "ARM", "RRX", "(", "rotate", "right", "with", "extend", ")", "operation", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/bitwise.py#L241-L253
[ "def", "RRX", "(", "value", ",", "carry", ",", "width", ")", ":", "result", ",", "_", "=", "RRX_C", "(", "value", ",", "carry", ",", "width", ")", "return", "result" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Policy.locked_context
Policy shared context dictionary
manticore/core/executor.py
def locked_context(self, key=None, default=dict): """ Policy shared context dictionary """ keys = ['policy'] if key is not None: keys.append(key) with self._executor.locked_context('.'.join(keys), default) as policy_context: yield policy_context
def locked_context(self, key=None, default=dict): """ Policy shared context dictionary """ keys = ['policy'] if key is not None: keys.append(key) with self._executor.locked_context('.'.join(keys), default) as policy_context: yield policy_context
[ "Policy", "shared", "context", "dictionary" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/executor.py#L52-L58
[ "def", "locked_context", "(", "self", ",", "key", "=", "None", ",", "default", "=", "dict", ")", ":", "keys", "=", "[", "'policy'", "]", "if", "key", "is", "not", "None", ":", "keys", ".", "append", "(", "key", ")", "with", "self", ".", "_executor"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Policy._add_state_callback
Save summarize(state) on policy shared context before the state is stored
manticore/core/executor.py
def _add_state_callback(self, state_id, state): """ Save summarize(state) on policy shared context before the state is stored """ summary = self.summarize(state) if summary is None: return with self.locked_context('summaries', dict) as ctx: ctx...
def _add_state_callback(self, state_id, state): """ Save summarize(state) on policy shared context before the state is stored """ summary = self.summarize(state) if summary is None: return with self.locked_context('summaries', dict) as ctx: ctx...
[ "Save", "summarize", "(", "state", ")", "on", "policy", "shared", "context", "before", "the", "state", "is", "stored" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/executor.py#L60-L68
[ "def", "_add_state_callback", "(", "self", ",", "state_id", ",", "state", ")", ":", "summary", "=", "self", ".", "summarize", "(", "state", ")", "if", "summary", "is", "None", ":", "return", "with", "self", ".", "locked_context", "(", "'summaries'", ",", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Uncovered._visited_callback
Maintain our own copy of the visited set
manticore/core/executor.py
def _visited_callback(self, state, pc, instr): """ Maintain our own copy of the visited set """ with self.locked_context('visited', set) as ctx: ctx.add(pc)
def _visited_callback(self, state, pc, instr): """ Maintain our own copy of the visited set """ with self.locked_context('visited', set) as ctx: ctx.add(pc)
[ "Maintain", "our", "own", "copy", "of", "the", "visited", "set" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/executor.py#L104-L108
[ "def", "_visited_callback", "(", "self", ",", "state", ",", "pc", ",", "instr", ")", ":", "with", "self", ".", "locked_context", "(", "'visited'", ",", "set", ")", "as", "ctx", ":", "ctx", ".", "add", "(", "pc", ")" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
BranchLimited._visited_callback
Maintain our own copy of the visited set
manticore/core/executor.py
def _visited_callback(self, state, pc, instr): """ Maintain our own copy of the visited set """ pc = state.platform.current.PC with self.locked_context('visited', dict) as ctx: ctx[pc] = ctx.get(pc, 0) + 1
def _visited_callback(self, state, pc, instr): """ Maintain our own copy of the visited set """ pc = state.platform.current.PC with self.locked_context('visited', dict) as ctx: ctx[pc] = ctx.get(pc, 0) + 1
[ "Maintain", "our", "own", "copy", "of", "the", "visited", "set" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/executor.py#L136-L141
[ "def", "_visited_callback", "(", "self", ",", "state", ",", "pc", ",", "instr", ")", ":", "pc", "=", "state", ".", "platform", ".", "current", ".", "PC", "with", "self", ".", "locked_context", "(", "'visited'", ",", "dict", ")", "as", "ctx", ":", "ct...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Executor.locked_context
Executor context is a shared memory object. All workers share this. It needs a lock. Its used like this: with executor.context() as context: visited = context['visited'] visited.append(state.cpu.PC) context['visited'] = visited
manticore/core/executor.py
def locked_context(self, key=None, default=dict): """ Executor context is a shared memory object. All workers share this. It needs a lock. Its used like this: with executor.context() as context: visited = context['visited'] visited.append(state.cpu.PC) ...
def locked_context(self, key=None, default=dict): """ Executor context is a shared memory object. All workers share this. It needs a lock. Its used like this: with executor.context() as context: visited = context['visited'] visited.append(state.cpu.PC) ...
[ "Executor", "context", "is", "a", "shared", "memory", "object", ".", "All", "workers", "share", "this", ".", "It", "needs", "a", "lock", ".", "Its", "used", "like", "this", ":" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/executor.py#L226-L244
[ "def", "locked_context", "(", "self", ",", "key", "=", "None", ",", "default", "=", "dict", ")", ":", "assert", "default", "in", "(", "list", ",", "dict", ",", "set", ")", "with", "self", ".", "_lock", ":", "if", "key", "is", "None", ":", "yield", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Executor.enqueue
Enqueue state. Save state on storage, assigns an id to it, then add it to the priority queue
manticore/core/executor.py
def enqueue(self, state): """ Enqueue state. Save state on storage, assigns an id to it, then add it to the priority queue """ # save the state to secondary storage state_id = self._workspace.save_state(state) self.put(state_id) self._p...
def enqueue(self, state): """ Enqueue state. Save state on storage, assigns an id to it, then add it to the priority queue """ # save the state to secondary storage state_id = self._workspace.save_state(state) self.put(state_id) self._p...
[ "Enqueue", "state", ".", "Save", "state", "on", "storage", "assigns", "an", "id", "to", "it", "then", "add", "it", "to", "the", "priority", "queue" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/executor.py#L254-L264
[ "def", "enqueue", "(", "self", ",", "state", ")", ":", "# save the state to secondary storage", "state_id", "=", "self", ".", "_workspace", ".", "save_state", "(", "state", ")", "self", ".", "put", "(", "state_id", ")", "self", ".", "_publish", "(", "'did_en...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Executor.put
Enqueue it for processing
manticore/core/executor.py
def put(self, state_id): """ Enqueue it for processing """ self._states.append(state_id) self._lock.notify_all() return state_id
def put(self, state_id): """ Enqueue it for processing """ self._states.append(state_id) self._lock.notify_all() return state_id
[ "Enqueue", "it", "for", "processing" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/executor.py#L311-L315
[ "def", "put", "(", "self", ",", "state_id", ")", ":", "self", ".", "_states", ".", "append", "(", "state_id", ")", "self", ".", "_lock", ".", "notify_all", "(", ")", "return", "state_id" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Executor.get
Dequeue a state with the max priority
manticore/core/executor.py
def get(self): """ Dequeue a state with the max priority """ # A shutdown has been requested if self.is_shutdown(): return None # if not more states in the queue, let's wait for some forks while len(self._states) == 0: # if no worker is running, bail out...
def get(self): """ Dequeue a state with the max priority """ # A shutdown has been requested if self.is_shutdown(): return None # if not more states in the queue, let's wait for some forks while len(self._states) == 0: # if no worker is running, bail out...
[ "Dequeue", "a", "state", "with", "the", "max", "priority" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/executor.py#L318-L341
[ "def", "get", "(", "self", ")", ":", "# A shutdown has been requested", "if", "self", ".", "is_shutdown", "(", ")", ":", "return", "None", "# if not more states in the queue, let's wait for some forks", "while", "len", "(", "self", ".", "_states", ")", "==", "0", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Executor.fork
Fork state on expression concretizations. Using policy build a list of solutions for expression. For the state on each solution setting the new state with setstate For example if expression is a Bool it may have 2 solutions. True or False. Parent ...
manticore/core/executor.py
def fork(self, state, expression, policy='ALL', setstate=None): """ Fork state on expression concretizations. Using policy build a list of solutions for expression. For the state on each solution setting the new state with setstate For example if expression is a Bool it may have...
def fork(self, state, expression, policy='ALL', setstate=None): """ Fork state on expression concretizations. Using policy build a list of solutions for expression. For the state on each solution setting the new state with setstate For example if expression is a Bool it may have...
[ "Fork", "state", "on", "expression", "concretizations", ".", "Using", "policy", "build", "a", "list", "of", "solutions", "for", "expression", ".", "For", "the", "state", "on", "each", "solution", "setting", "the", "new", "state", "with", "setstate" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/executor.py#L347-L405
[ "def", "fork", "(", "self", ",", "state", ",", "expression", ",", "policy", "=", "'ALL'", ",", "setstate", "=", "None", ")", ":", "assert", "isinstance", "(", "expression", ",", "Expression", ")", "if", "setstate", "is", "None", ":", "setstate", "=", "...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Executor.run
Entry point of the Executor; called by workers to start analysis.
manticore/core/executor.py
def run(self): """ Entry point of the Executor; called by workers to start analysis. """ # policy_order=self.policy_order # policy=self.policy current_state = None current_state_id = None with WithKeyboardInterruptAs(self.shutdown): # notify s...
def run(self): """ Entry point of the Executor; called by workers to start analysis. """ # policy_order=self.policy_order # policy=self.policy current_state = None current_state_id = None with WithKeyboardInterruptAs(self.shutdown): # notify s...
[ "Entry", "point", "of", "the", "Executor", ";", "called", "by", "workers", "to", "start", "analysis", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/executor.py#L407-L503
[ "def", "run", "(", "self", ")", ":", "# policy_order=self.policy_order", "# policy=self.policy", "current_state", "=", "None", "current_state_id", "=", "None", "with", "WithKeyboardInterruptAs", "(", "self", ".", "shutdown", ")", ":", "# notify siblings we are about to st...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Manticore.linux
Constructor for Linux binary analysis. :param str path: Path to binary to analyze :param argv: Arguments to provide to the binary :type argv: list[str] :param envp: Environment to provide to the binary :type envp: dict[str, str] :param entry_symbol: Entry symbol to resol...
manticore/native/manticore.py
def linux(cls, path, argv=None, envp=None, entry_symbol=None, symbolic_files=None, concrete_start='', pure_symbolic=False, stdin_size=None, **kwargs): """ Constructor for Linux binary analysis. :param str path: Path to binary to analyze :param argv: Arguments to provide to the binary ...
def linux(cls, path, argv=None, envp=None, entry_symbol=None, symbolic_files=None, concrete_start='', pure_symbolic=False, stdin_size=None, **kwargs): """ Constructor for Linux binary analysis. :param str path: Path to binary to analyze :param argv: Arguments to provide to the binary ...
[ "Constructor", "for", "Linux", "binary", "analysis", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/manticore.py#L42-L67
[ "def", "linux", "(", "cls", ",", "path", ",", "argv", "=", "None", ",", "envp", "=", "None", ",", "entry_symbol", "=", "None", ",", "symbolic_files", "=", "None", ",", "concrete_start", "=", "''", ",", "pure_symbolic", "=", "False", ",", "stdin_size", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Manticore.decree
Constructor for Decree binary analysis. :param str path: Path to binary to analyze :param str concrete_start: Concrete stdin to use before symbolic input :param kwargs: Forwarded to the Manticore constructor :return: Manticore instance, initialized with a Decree State :rtype: Ma...
manticore/native/manticore.py
def decree(cls, path, concrete_start='', **kwargs): """ Constructor for Decree binary analysis. :param str path: Path to binary to analyze :param str concrete_start: Concrete stdin to use before symbolic input :param kwargs: Forwarded to the Manticore constructor :return...
def decree(cls, path, concrete_start='', **kwargs): """ Constructor for Decree binary analysis. :param str path: Path to binary to analyze :param str concrete_start: Concrete stdin to use before symbolic input :param kwargs: Forwarded to the Manticore constructor :return...
[ "Constructor", "for", "Decree", "binary", "analysis", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/manticore.py#L70-L83
[ "def", "decree", "(", "cls", ",", "path", ",", "concrete_start", "=", "''", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "cls", "(", "_make_decree", "(", "path", ",", "concrete_start", ")", ",", "*", "*", "kwargs", ")", "except", "KeyErro...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Manticore.init
A decorator used to register a hook function to run before analysis begins. Hook function takes one :class:`~manticore.core.state.State` argument.
manticore/native/manticore.py
def init(self, f): """ A decorator used to register a hook function to run before analysis begins. Hook function takes one :class:`~manticore.core.state.State` argument. """ def callback(manticore_obj, state): f(state) self.subscribe('will_start_run', types.Me...
def init(self, f): """ A decorator used to register a hook function to run before analysis begins. Hook function takes one :class:`~manticore.core.state.State` argument. """ def callback(manticore_obj, state): f(state) self.subscribe('will_start_run', types.Me...
[ "A", "decorator", "used", "to", "register", "a", "hook", "function", "to", "run", "before", "analysis", "begins", ".", "Hook", "function", "takes", "one", ":", "class", ":", "~manticore", ".", "core", ".", "state", ".", "State", "argument", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/manticore.py#L98-L106
[ "def", "init", "(", "self", ",", "f", ")", ":", "def", "callback", "(", "manticore_obj", ",", "state", ")", ":", "f", "(", "state", ")", "self", ".", "subscribe", "(", "'will_start_run'", ",", "types", ".", "MethodType", "(", "callback", ",", "self", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Manticore.hook
A decorator used to register a hook function for a given instruction address. Equivalent to calling :func:`~add_hook`. :param pc: Address of instruction to hook :type pc: int or None
manticore/native/manticore.py
def hook(self, pc): """ A decorator used to register a hook function for a given instruction address. Equivalent to calling :func:`~add_hook`. :param pc: Address of instruction to hook :type pc: int or None """ def decorator(f): self.add_hook(pc, f) ...
def hook(self, pc): """ A decorator used to register a hook function for a given instruction address. Equivalent to calling :func:`~add_hook`. :param pc: Address of instruction to hook :type pc: int or None """ def decorator(f): self.add_hook(pc, f) ...
[ "A", "decorator", "used", "to", "register", "a", "hook", "function", "for", "a", "given", "instruction", "address", ".", "Equivalent", "to", "calling", ":", "func", ":", "~add_hook", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/manticore.py#L108-L119
[ "def", "hook", "(", "self", ",", "pc", ")", ":", "def", "decorator", "(", "f", ")", ":", "self", ".", "add_hook", "(", "pc", ",", "f", ")", "return", "f", "return", "decorator" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Manticore.add_hook
Add a callback to be invoked on executing a program counter. Pass `None` for pc to invoke callback on every instruction. `callback` should be a callable that takes one :class:`~manticore.core.state.State` argument. :param pc: Address of instruction to hook :type pc: int or None ...
manticore/native/manticore.py
def add_hook(self, pc, callback): """ Add a callback to be invoked on executing a program counter. Pass `None` for pc to invoke callback on every instruction. `callback` should be a callable that takes one :class:`~manticore.core.state.State` argument. :param pc: Address of inst...
def add_hook(self, pc, callback): """ Add a callback to be invoked on executing a program counter. Pass `None` for pc to invoke callback on every instruction. `callback` should be a callable that takes one :class:`~manticore.core.state.State` argument. :param pc: Address of inst...
[ "Add", "a", "callback", "to", "be", "invoked", "on", "executing", "a", "program", "counter", ".", "Pass", "None", "for", "pc", "to", "invoke", "callback", "on", "every", "instruction", ".", "callback", "should", "be", "a", "callable", "that", "takes", "one...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/manticore.py#L121-L136
[ "def", "add_hook", "(", "self", ",", "pc", ",", "callback", ")", ":", "if", "not", "(", "isinstance", "(", "pc", ",", "int", ")", "or", "pc", "is", "None", ")", ":", "raise", "TypeError", "(", "f\"pc must be either an int or None, not {pc.__class__.__name__}\"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Manticore._hook_callback
Invoke all registered generic hooks
manticore/native/manticore.py
def _hook_callback(self, state, pc, instruction): 'Invoke all registered generic hooks' # Ignore symbolic pc. # TODO(yan): Should we ask the solver if any of the hooks are possible, # and execute those that are? if issymbolic(pc): return # Invoke all pc-spe...
def _hook_callback(self, state, pc, instruction): 'Invoke all registered generic hooks' # Ignore symbolic pc. # TODO(yan): Should we ask the solver if any of the hooks are possible, # and execute those that are? if issymbolic(pc): return # Invoke all pc-spe...
[ "Invoke", "all", "registered", "generic", "hooks" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/manticore.py#L138-L154
[ "def", "_hook_callback", "(", "self", ",", "state", ",", "pc", ",", "instruction", ")", ":", "# Ignore symbolic pc.", "# TODO(yan): Should we ask the solver if any of the hooks are possible,", "# and execute those that are?", "if", "issymbolic", "(", "pc", ")", ":", "return...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Manticore.resolve
A helper method used to resolve a symbol name into a memory address when injecting hooks for analysis. :param symbol: function name to be resolved :type symbol: string :param line: if more functions present, optional line number can be included :type line: int or None
manticore/native/manticore.py
def resolve(self, symbol): """ A helper method used to resolve a symbol name into a memory address when injecting hooks for analysis. :param symbol: function name to be resolved :type symbol: string :param line: if more functions present, optional line number can be inc...
def resolve(self, symbol): """ A helper method used to resolve a symbol name into a memory address when injecting hooks for analysis. :param symbol: function name to be resolved :type symbol: string :param line: if more functions present, optional line number can be inc...
[ "A", "helper", "method", "used", "to", "resolve", "a", "symbol", "name", "into", "a", "memory", "address", "when", "injecting", "hooks", "for", "analysis", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/manticore.py#L160-L189
[ "def", "resolve", "(", "self", ",", "symbol", ")", ":", "with", "open", "(", "self", ".", "binary_path", ",", "'rb'", ")", "as", "f", ":", "elffile", "=", "ELFFile", "(", "f", ")", "# iterate over sections and identify symbol table section", "for", "section", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
binary_arch
helper method for determining binary architecture :param binary: str for binary to introspect. :rtype bool: True for x86_64, False otherwise
scripts/sandshrew/sandshrew.py
def binary_arch(binary): """ helper method for determining binary architecture :param binary: str for binary to introspect. :rtype bool: True for x86_64, False otherwise """ with open(binary, 'rb') as f: elffile = ELFFile(f) if elffile['e_machine'] == 'EM_X86_64': r...
def binary_arch(binary): """ helper method for determining binary architecture :param binary: str for binary to introspect. :rtype bool: True for x86_64, False otherwise """ with open(binary, 'rb') as f: elffile = ELFFile(f) if elffile['e_machine'] == 'EM_X86_64': r...
[ "helper", "method", "for", "determining", "binary", "architecture" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/scripts/sandshrew/sandshrew.py#L37-L50
[ "def", "binary_arch", "(", "binary", ")", ":", "with", "open", "(", "binary", ",", "'rb'", ")", "as", "f", ":", "elffile", "=", "ELFFile", "(", "f", ")", "if", "elffile", "[", "'e_machine'", "]", "==", "'EM_X86_64'", ":", "return", "True", "else", ":...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
binary_symbols
helper method for getting all binary symbols with SANDSHREW_ prepended. We do this in order to provide the symbols Manticore should hook on to perform main analysis. :param binary: str for binary to instrospect. :rtype list: list of symbols from binary
scripts/sandshrew/sandshrew.py
def binary_symbols(binary): """ helper method for getting all binary symbols with SANDSHREW_ prepended. We do this in order to provide the symbols Manticore should hook on to perform main analysis. :param binary: str for binary to instrospect. :rtype list: list of symbols from binary """ ...
def binary_symbols(binary): """ helper method for getting all binary symbols with SANDSHREW_ prepended. We do this in order to provide the symbols Manticore should hook on to perform main analysis. :param binary: str for binary to instrospect. :rtype list: list of symbols from binary """ ...
[ "helper", "method", "for", "getting", "all", "binary", "symbols", "with", "SANDSHREW_", "prepended", ".", "We", "do", "this", "in", "order", "to", "provide", "the", "symbols", "Manticore", "should", "hook", "on", "to", "perform", "main", "analysis", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/scripts/sandshrew/sandshrew.py#L53-L76
[ "def", "binary_symbols", "(", "binary", ")", ":", "def", "substr_after", "(", "string", ",", "delim", ")", ":", "return", "string", ".", "partition", "(", "delim", ")", "[", "2", "]", "with", "open", "(", "binary", ",", "'rb'", ")", "as", "f", ":", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
get_group
Get a configuration variable group named |name|
manticore/utils/config.py
def get_group(name: str) -> _Group: """ Get a configuration variable group named |name| """ global _groups if name in _groups: return _groups[name] group = _Group(name) _groups[name] = group return group
def get_group(name: str) -> _Group: """ Get a configuration variable group named |name| """ global _groups if name in _groups: return _groups[name] group = _Group(name) _groups[name] = group return group
[ "Get", "a", "configuration", "variable", "group", "named", "|name|" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/config.py#L179-L191
[ "def", "get_group", "(", "name", ":", "str", ")", "->", "_Group", ":", "global", "_groups", "if", "name", "in", "_groups", ":", "return", "_groups", "[", "name", "]", "group", "=", "_Group", "(", "name", ")", "_groups", "[", "name", "]", "=", "group"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
save
Save current config state to an yml file stream identified by |f| :param f: where to write the config file
manticore/utils/config.py
def save(f): """ Save current config state to an yml file stream identified by |f| :param f: where to write the config file """ global _groups c = {} for group_name, group in _groups.items(): section = {var.name: var.value for var in group.updated_vars()} if not section: ...
def save(f): """ Save current config state to an yml file stream identified by |f| :param f: where to write the config file """ global _groups c = {} for group_name, group in _groups.items(): section = {var.name: var.value for var in group.updated_vars()} if not section: ...
[ "Save", "current", "config", "state", "to", "an", "yml", "file", "stream", "identified", "by", "|f|" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/config.py#L194-L209
[ "def", "save", "(", "f", ")", ":", "global", "_groups", "c", "=", "{", "}", "for", "group_name", ",", "group", "in", "_groups", ".", "items", "(", ")", ":", "section", "=", "{", "var", ".", "name", ":", "var", ".", "value", "for", "var", "in", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
parse_config
Load an yml-formatted configuration from file stream |f| :param file f: Where to read the config.
manticore/utils/config.py
def parse_config(f): """ Load an yml-formatted configuration from file stream |f| :param file f: Where to read the config. """ try: c = yaml.safe_load(f) for section_name, section in c.items(): group = get_group(section_name) for key, val in section.items()...
def parse_config(f): """ Load an yml-formatted configuration from file stream |f| :param file f: Where to read the config. """ try: c = yaml.safe_load(f) for section_name, section in c.items(): group = get_group(section_name) for key, val in section.items()...
[ "Load", "an", "yml", "-", "formatted", "configuration", "from", "file", "stream", "|f|" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/config.py#L212-L230
[ "def", "parse_config", "(", "f", ")", ":", "try", ":", "c", "=", "yaml", ".", "safe_load", "(", "f", ")", "for", "section_name", ",", "section", "in", "c", ".", "items", "(", ")", ":", "group", "=", "get_group", "(", "section_name", ")", "for", "ke...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
load_overrides
Load config overrides from the yml file at |path|, or from default paths. If a path is provided and it does not exist, raise an exception Default paths: ./mcore.yml, ./.mcore.yml, ./manticore.yml, ./.manticore.yml.
manticore/utils/config.py
def load_overrides(path=None): """ Load config overrides from the yml file at |path|, or from default paths. If a path is provided and it does not exist, raise an exception Default paths: ./mcore.yml, ./.mcore.yml, ./manticore.yml, ./.manticore.yml. """ if path is not None: names = [pa...
def load_overrides(path=None): """ Load config overrides from the yml file at |path|, or from default paths. If a path is provided and it does not exist, raise an exception Default paths: ./mcore.yml, ./.mcore.yml, ./manticore.yml, ./.manticore.yml. """ if path is not None: names = [pa...
[ "Load", "config", "overrides", "from", "the", "yml", "file", "at", "|path|", "or", "from", "default", "paths", ".", "If", "a", "path", "is", "provided", "and", "it", "does", "not", "exist", "raise", "an", "exception" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/config.py#L233-L257
[ "def", "load_overrides", "(", "path", "=", "None", ")", ":", "if", "path", "is", "not", "None", ":", "names", "=", "[", "path", "]", "else", ":", "possible_names", "=", "[", "'mcore.yml'", ",", "'manticore.yml'", "]", "names", "=", "[", "os", ".", "p...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
add_config_vars_to_argparse
Import all defined config vars into |args|, for parsing command line. :param args: A container for argparse vars :type args: argparse.ArgumentParser or argparse._ArgumentGroup :return:
manticore/utils/config.py
def add_config_vars_to_argparse(args): """ Import all defined config vars into |args|, for parsing command line. :param args: A container for argparse vars :type args: argparse.ArgumentParser or argparse._ArgumentGroup :return: """ global _groups for group_name, group in _groups.items():...
def add_config_vars_to_argparse(args): """ Import all defined config vars into |args|, for parsing command line. :param args: A container for argparse vars :type args: argparse.ArgumentParser or argparse._ArgumentGroup :return: """ global _groups for group_name, group in _groups.items():...
[ "Import", "all", "defined", "config", "vars", "into", "|args|", "for", "parsing", "command", "line", ".", ":", "param", "args", ":", "A", "container", "for", "argparse", "vars", ":", "type", "args", ":", "argparse", ".", "ArgumentParser", "or", "argparse", ...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/config.py#L260-L272
[ "def", "add_config_vars_to_argparse", "(", "args", ")", ":", "global", "_groups", "for", "group_name", ",", "group", "in", "_groups", ".", "items", "(", ")", ":", "for", "key", "in", "group", ":", "obj", "=", "group", ".", "_var_object", "(", "key", ")",...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
process_config_values
Bring in provided config values to the args parser, and import entries to the config from all arguments that were actually passed on the command line :param parser: The arg parser :param args: The value that parser.parse_args returned
manticore/utils/config.py
def process_config_values(parser: argparse.ArgumentParser, args: argparse.Namespace): """ Bring in provided config values to the args parser, and import entries to the config from all arguments that were actually passed on the command line :param parser: The arg parser :param args: The value that p...
def process_config_values(parser: argparse.ArgumentParser, args: argparse.Namespace): """ Bring in provided config values to the args parser, and import entries to the config from all arguments that were actually passed on the command line :param parser: The arg parser :param args: The value that p...
[ "Bring", "in", "provided", "config", "values", "to", "the", "args", "parser", "and", "import", "entries", "to", "the", "config", "from", "all", "arguments", "that", "were", "actually", "passed", "on", "the", "command", "line" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/config.py#L275-L311
[ "def", "process_config_values", "(", "parser", ":", "argparse", ".", "ArgumentParser", ",", "args", ":", "argparse", ".", "Namespace", ")", ":", "# First, load a local config file, if passed or look for one in pwd if it wasn't.", "load_overrides", "(", "args", ".", "config"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
_Group.add
Add a variable named |name| to this value group, optionally giving it a default value and a description. Variables must be added with this method before they can be set or read. Reading a variable replaces the variable that was defined previously, but updates the description if a new on...
manticore/utils/config.py
def add(self, name: str, default=None, description: str=None): """ Add a variable named |name| to this value group, optionally giving it a default value and a description. Variables must be added with this method before they can be set or read. Reading a variable replaces the va...
def add(self, name: str, default=None, description: str=None): """ Add a variable named |name| to this value group, optionally giving it a default value and a description. Variables must be added with this method before they can be set or read. Reading a variable replaces the va...
[ "Add", "a", "variable", "named", "|name|", "to", "this", "value", "group", "optionally", "giving", "it", "a", "default", "value", "and", "a", "description", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/config.py#L70-L87
[ "def", "add", "(", "self", ",", "name", ":", "str", ",", "default", "=", "None", ",", "description", ":", "str", "=", "None", ")", ":", "if", "name", "in", "self", ".", "_vars", ":", "raise", "ConfigError", "(", "f\"{self.name}.{name} already defined.\"", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
_Group.update
Like add, but can tolerate existing values; also updates the value. Mostly used for setting fields from imported INI files and modified CLI flags.
manticore/utils/config.py
def update(self, name: str, value=None, default=None, description: str=None): """ Like add, but can tolerate existing values; also updates the value. Mostly used for setting fields from imported INI files and modified CLI flags. """ if name in self._vars: description...
def update(self, name: str, value=None, default=None, description: str=None): """ Like add, but can tolerate existing values; also updates the value. Mostly used for setting fields from imported INI files and modified CLI flags. """ if name in self._vars: description...
[ "Like", "add", "but", "can", "tolerate", "existing", "values", ";", "also", "updates", "the", "value", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/config.py#L89-L103
[ "def", "update", "(", "self", ",", "name", ":", "str", ",", "value", "=", "None", ",", "default", "=", "None", ",", "description", ":", "str", "=", "None", ")", ":", "if", "name", "in", "self", ".", "_vars", ":", "description", "=", "description", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
_Group.get_description
Return the description, or a help string of variable identified by |name|.
manticore/utils/config.py
def get_description(self, name: str) -> str: """ Return the description, or a help string of variable identified by |name|. """ if name not in self._vars: raise ConfigError(f"{self.name}.{name} not defined.") return self._vars[name].description
def get_description(self, name: str) -> str: """ Return the description, or a help string of variable identified by |name|. """ if name not in self._vars: raise ConfigError(f"{self.name}.{name} not defined.") return self._vars[name].description
[ "Return", "the", "description", "or", "a", "help", "string", "of", "variable", "identified", "by", "|name|", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/config.py#L105-L112
[ "def", "get_description", "(", "self", ",", "name", ":", "str", ")", "->", "str", ":", "if", "name", "not", "in", "self", ".", "_vars", ":", "raise", "ConfigError", "(", "f\"{self.name}.{name} not defined.\"", ")", "return", "self", ".", "_vars", "[", "nam...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
correspond
Communicate with the child process without closing stdin.
scripts/gdb.py
def correspond(text): """Communicate with the child process without closing stdin.""" subproc.stdin.write(text) subproc.stdin.flush() return drain()
def correspond(text): """Communicate with the child process without closing stdin.""" subproc.stdin.write(text) subproc.stdin.flush() return drain()
[ "Communicate", "with", "the", "child", "process", "without", "closing", "stdin", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/scripts/gdb.py#L38-L42
[ "def", "correspond", "(", "text", ")", ":", "subproc", ".", "stdin", ".", "write", "(", "text", ")", "subproc", ".", "stdin", ".", "flush", "(", ")", "return", "drain", "(", ")" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SolidityMetadata.function_signature_for_name_and_inputs
Returns the function signature for the specified name and Solidity JSON metadata inputs array. The ABI specification defines the function signature as the function name followed by the parenthesised list of parameter types separated by single commas and no spaces. See https://solidity.readthedo...
manticore/ethereum/solidity.py
def function_signature_for_name_and_inputs(name: str, inputs: Sequence[Mapping[str, Any]]) -> str: """Returns the function signature for the specified name and Solidity JSON metadata inputs array. The ABI specification defines the function signature as the function name followed by the parenthesised li...
def function_signature_for_name_and_inputs(name: str, inputs: Sequence[Mapping[str, Any]]) -> str: """Returns the function signature for the specified name and Solidity JSON metadata inputs array. The ABI specification defines the function signature as the function name followed by the parenthesised li...
[ "Returns", "the", "function", "signature", "for", "the", "specified", "name", "and", "Solidity", "JSON", "metadata", "inputs", "array", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/solidity.py#L12-L19
[ "def", "function_signature_for_name_and_inputs", "(", "name", ":", "str", ",", "inputs", ":", "Sequence", "[", "Mapping", "[", "str", ",", "Any", "]", "]", ")", "->", "str", ":", "return", "name", "+", "SolidityMetadata", ".", "tuple_signature_for_components", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SolidityMetadata.tuple_signature_for_components
Equivalent to ``function_signature_for_name_and_inputs('', components)``.
manticore/ethereum/solidity.py
def tuple_signature_for_components(components: Sequence[Mapping[str, Any]]) -> str: """Equivalent to ``function_signature_for_name_and_inputs('', components)``.""" ts = [] for c in components: t: str = c['type'] if t.startswith('tuple'): assert len(t) == 5...
def tuple_signature_for_components(components: Sequence[Mapping[str, Any]]) -> str: """Equivalent to ``function_signature_for_name_and_inputs('', components)``.""" ts = [] for c in components: t: str = c['type'] if t.startswith('tuple'): assert len(t) == 5...
[ "Equivalent", "to", "function_signature_for_name_and_inputs", "(", "components", ")", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/solidity.py#L22-L31
[ "def", "tuple_signature_for_components", "(", "components", ":", "Sequence", "[", "Mapping", "[", "str", ",", "Any", "]", "]", ")", "->", "str", ":", "ts", "=", "[", "]", "for", "c", "in", "components", ":", "t", ":", "str", "=", "c", "[", "'type'", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SolidityMetadata.get_constructor_arguments
Returns the tuple type signature for the arguments of the contract constructor.
manticore/ethereum/solidity.py
def get_constructor_arguments(self) -> str: """Returns the tuple type signature for the arguments of the contract constructor.""" item = self._constructor_abi_item return '()' if item is None else self.tuple_signature_for_components(item['inputs'])
def get_constructor_arguments(self) -> str: """Returns the tuple type signature for the arguments of the contract constructor.""" item = self._constructor_abi_item return '()' if item is None else self.tuple_signature_for_components(item['inputs'])
[ "Returns", "the", "tuple", "type", "signature", "for", "the", "arguments", "of", "the", "contract", "constructor", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/solidity.py#L74-L77
[ "def", "get_constructor_arguments", "(", "self", ")", "->", "str", ":", "item", "=", "self", ".", "_constructor_abi_item", "return", "'()'", "if", "item", "is", "None", "else", "self", ".", "tuple_signature_for_components", "(", "item", "[", "'inputs'", "]", "...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SolidityMetadata.get_source_for
Solidity source code snippet related to `asm_pos` evm bytecode offset. If runtime is False, initialization bytecode source map is used
manticore/ethereum/solidity.py
def get_source_for(self, asm_offset, runtime=True): """ Solidity source code snippet related to `asm_pos` evm bytecode offset. If runtime is False, initialization bytecode source map is used """ srcmap = self.get_srcmap(runtime) try: beg, size, _, _ = srcmap[asm_...
def get_source_for(self, asm_offset, runtime=True): """ Solidity source code snippet related to `asm_pos` evm bytecode offset. If runtime is False, initialization bytecode source map is used """ srcmap = self.get_srcmap(runtime) try: beg, size, _, _ = srcmap[asm_...
[ "Solidity", "source", "code", "snippet", "related", "to", "asm_pos", "evm", "bytecode", "offset", ".", "If", "runtime", "is", "False", "initialization", "bytecode", "source", "map", "is", "used" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/solidity.py#L130-L148
[ "def", "get_source_for", "(", "self", ",", "asm_offset", ",", "runtime", "=", "True", ")", ":", "srcmap", "=", "self", ".", "get_srcmap", "(", "runtime", ")", "try", ":", "beg", ",", "size", ",", "_", ",", "_", "=", "srcmap", "[", "asm_offset", "]", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SolidityMetadata.constructor_abi
Returns a copy of the Solidity JSON ABI item for the contract constructor. The content of the returned dict is described at https://solidity.readthedocs.io/en/latest/abi-spec.html#json_
manticore/ethereum/solidity.py
def constructor_abi(self) -> Dict[str, Any]: """Returns a copy of the Solidity JSON ABI item for the contract constructor. The content of the returned dict is described at https://solidity.readthedocs.io/en/latest/abi-spec.html#json_ """ item = self._constructor_abi_item if item...
def constructor_abi(self) -> Dict[str, Any]: """Returns a copy of the Solidity JSON ABI item for the contract constructor. The content of the returned dict is described at https://solidity.readthedocs.io/en/latest/abi-spec.html#json_ """ item = self._constructor_abi_item if item...
[ "Returns", "a", "copy", "of", "the", "Solidity", "JSON", "ABI", "item", "for", "the", "contract", "constructor", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/solidity.py#L167-L175
[ "def", "constructor_abi", "(", "self", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "item", "=", "self", ".", "_constructor_abi_item", "if", "item", ":", "return", "dict", "(", "item", ")", "return", "{", "'inputs'", ":", "[", "]", ",", "'pay...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SolidityMetadata.get_abi
Returns a copy of the Solidity JSON ABI item for the function associated with the selector ``hsh``. If no normal contract function has the specified selector, a dict describing the default or non-default fallback function is returned. The content of the returned dict is described at https://so...
manticore/ethereum/solidity.py
def get_abi(self, hsh: bytes) -> Dict[str, Any]: """Returns a copy of the Solidity JSON ABI item for the function associated with the selector ``hsh``. If no normal contract function has the specified selector, a dict describing the default or non-default fallback function is returned. ...
def get_abi(self, hsh: bytes) -> Dict[str, Any]: """Returns a copy of the Solidity JSON ABI item for the function associated with the selector ``hsh``. If no normal contract function has the specified selector, a dict describing the default or non-default fallback function is returned. ...
[ "Returns", "a", "copy", "of", "the", "Solidity", "JSON", "ABI", "item", "for", "the", "function", "associated", "with", "the", "selector", "hsh", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/solidity.py#L177-L194
[ "def", "get_abi", "(", "self", ",", "hsh", ":", "bytes", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "if", "not", "isinstance", "(", "hsh", ",", "(", "bytes", ",", "bytearray", ")", ")", ":", "raise", "TypeError", "(", "'The selector argumen...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SolidityMetadata.get_func_argument_types
Returns the tuple type signature for the arguments of the function associated with the selector ``hsh``. If no normal contract function has the specified selector, the empty tuple type signature ``'()'`` is returned.
manticore/ethereum/solidity.py
def get_func_argument_types(self, hsh: bytes): """Returns the tuple type signature for the arguments of the function associated with the selector ``hsh``. If no normal contract function has the specified selector, the empty tuple type signature ``'()'`` is returned. """ if not i...
def get_func_argument_types(self, hsh: bytes): """Returns the tuple type signature for the arguments of the function associated with the selector ``hsh``. If no normal contract function has the specified selector, the empty tuple type signature ``'()'`` is returned. """ if not i...
[ "Returns", "the", "tuple", "type", "signature", "for", "the", "arguments", "of", "the", "function", "associated", "with", "the", "selector", "hsh", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/solidity.py#L196-L205
[ "def", "get_func_argument_types", "(", "self", ",", "hsh", ":", "bytes", ")", ":", "if", "not", "isinstance", "(", "hsh", ",", "(", "bytes", ",", "bytearray", ")", ")", ":", "raise", "TypeError", "(", "'The selector argument must be a concrete byte array'", ")",...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SolidityMetadata.get_func_return_types
Returns the tuple type signature for the output values of the function associated with the selector ``hsh``. If no normal contract function has the specified selector, the empty tuple type signature ``'()'`` is returned.
manticore/ethereum/solidity.py
def get_func_return_types(self, hsh: bytes) -> str: """Returns the tuple type signature for the output values of the function associated with the selector ``hsh``. If no normal contract function has the specified selector, the empty tuple type signature ``'()'`` is returned. """...
def get_func_return_types(self, hsh: bytes) -> str: """Returns the tuple type signature for the output values of the function associated with the selector ``hsh``. If no normal contract function has the specified selector, the empty tuple type signature ``'()'`` is returned. """...
[ "Returns", "the", "tuple", "type", "signature", "for", "the", "output", "values", "of", "the", "function", "associated", "with", "the", "selector", "hsh", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/solidity.py#L207-L218
[ "def", "get_func_return_types", "(", "self", ",", "hsh", ":", "bytes", ")", "->", "str", ":", "if", "not", "isinstance", "(", "hsh", ",", "(", "bytes", ",", "bytearray", ")", ")", ":", "raise", "TypeError", "(", "'The selector argument must be a concrete byte ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SolidityMetadata.get_func_name
Returns the name of the normal function with the selector ``hsh``, or ``'{fallback}'`` if no such function exists.
manticore/ethereum/solidity.py
def get_func_name(self, hsh: bytes) -> str: """Returns the name of the normal function with the selector ``hsh``, or ``'{fallback}'`` if no such function exists. """ if not isinstance(hsh, (bytes, bytearray)): raise TypeError('The selector argument must be a concrete byte arr...
def get_func_name(self, hsh: bytes) -> str: """Returns the name of the normal function with the selector ``hsh``, or ``'{fallback}'`` if no such function exists. """ if not isinstance(hsh, (bytes, bytearray)): raise TypeError('The selector argument must be a concrete byte arr...
[ "Returns", "the", "name", "of", "the", "normal", "function", "with", "the", "selector", "hsh", "or", "{", "fallback", "}", "if", "no", "such", "function", "exists", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/solidity.py#L220-L227
[ "def", "get_func_name", "(", "self", ",", "hsh", ":", "bytes", ")", "->", "str", ":", "if", "not", "isinstance", "(", "hsh", ",", "(", "bytes", ",", "bytearray", ")", ")", ":", "raise", "TypeError", "(", "'The selector argument must be a concrete byte array'",...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SolidityMetadata.get_func_signature
Returns the signature of the normal function with the selector ``hsh``, or ``None`` if no such function exists. This function returns ``None`` for any selector that will be dispatched to a fallback function.
manticore/ethereum/solidity.py
def get_func_signature(self, hsh: bytes) -> Optional[str]: """Returns the signature of the normal function with the selector ``hsh``, or ``None`` if no such function exists. This function returns ``None`` for any selector that will be dispatched to a fallback function. """ if no...
def get_func_signature(self, hsh: bytes) -> Optional[str]: """Returns the signature of the normal function with the selector ``hsh``, or ``None`` if no such function exists. This function returns ``None`` for any selector that will be dispatched to a fallback function. """ if no...
[ "Returns", "the", "signature", "of", "the", "normal", "function", "with", "the", "selector", "hsh", "or", "None", "if", "no", "such", "function", "exists", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/solidity.py#L229-L237
[ "def", "get_func_signature", "(", "self", ",", "hsh", ":", "bytes", ")", "->", "Optional", "[", "str", "]", ":", "if", "not", "isinstance", "(", "hsh", ",", "(", "bytes", ",", "bytearray", ")", ")", ":", "raise", "TypeError", "(", "'The selector argument...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SolidityMetadata.function_selectors
The selectors of all normal contract functions, plus ``self.fallback_function_selector`` if the contract has a non-default fallback function.
manticore/ethereum/solidity.py
def function_selectors(self) -> Iterable[bytes]: """The selectors of all normal contract functions, plus ``self.fallback_function_selector`` if the contract has a non-default fallback function. """ selectors = self._function_signatures_by_selector.keys() if self._fallback_functio...
def function_selectors(self) -> Iterable[bytes]: """The selectors of all normal contract functions, plus ``self.fallback_function_selector`` if the contract has a non-default fallback function. """ selectors = self._function_signatures_by_selector.keys() if self._fallback_functio...
[ "The", "selectors", "of", "all", "normal", "contract", "functions", "plus", "self", ".", "fallback_function_selector", "if", "the", "contract", "has", "a", "non", "-", "default", "fallback", "function", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/solidity.py#L268-L275
[ "def", "function_selectors", "(", "self", ")", "->", "Iterable", "[", "bytes", "]", ":", "selectors", "=", "self", ".", "_function_signatures_by_selector", ".", "keys", "(", ")", "if", "self", ".", "_fallback_function_abi_item", "is", "None", ":", "return", "t...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SolidityMetadata.hashes
The selectors of all normal contract functions, plus ``self.fallback_function_selector``.
manticore/ethereum/solidity.py
def hashes(self) -> Tuple[bytes, ...]: """The selectors of all normal contract functions, plus ``self.fallback_function_selector``.""" selectors = self._function_signatures_by_selector.keys() return (*selectors, self.fallback_function_selector)
def hashes(self) -> Tuple[bytes, ...]: """The selectors of all normal contract functions, plus ``self.fallback_function_selector``.""" selectors = self._function_signatures_by_selector.keys() return (*selectors, self.fallback_function_selector)
[ "The", "selectors", "of", "all", "normal", "contract", "functions", "plus", "self", ".", "fallback_function_selector", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/ethereum/solidity.py#L280-L283
[ "def", "hashes", "(", "self", ")", "->", "Tuple", "[", "bytes", ",", "...", "]", ":", "selectors", "=", "self", ".", "_function_signatures_by_selector", ".", "keys", "(", ")", "return", "(", "*", "selectors", ",", "self", ".", "fallback_function_selector", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
convert_permissions
Converts a Manticore permission string into a Unicorn permission :param m_perms: Manticore perm string ('rwx') :return: Unicorn Permissions
manticore/utils/emulate.py
def convert_permissions(m_perms): """ Converts a Manticore permission string into a Unicorn permission :param m_perms: Manticore perm string ('rwx') :return: Unicorn Permissions """ permissions = UC_PROT_NONE if 'r' in m_perms: permissions |= UC_PROT_READ if 'w' in m_perms: ...
def convert_permissions(m_perms): """ Converts a Manticore permission string into a Unicorn permission :param m_perms: Manticore perm string ('rwx') :return: Unicorn Permissions """ permissions = UC_PROT_NONE if 'r' in m_perms: permissions |= UC_PROT_READ if 'w' in m_perms: ...
[ "Converts", "a", "Manticore", "permission", "string", "into", "a", "Unicorn", "permission", ":", "param", "m_perms", ":", "Manticore", "perm", "string", "(", "rwx", ")", ":", "return", ":", "Unicorn", "Permissions" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/emulate.py#L20-L33
[ "def", "convert_permissions", "(", "m_perms", ")", ":", "permissions", "=", "UC_PROT_NONE", "if", "'r'", "in", "m_perms", ":", "permissions", "|=", "UC_PROT_READ", "if", "'w'", "in", "m_perms", ":", "permissions", "|=", "UC_PROT_WRITE", "if", "'x'", "in", "m_p...
54c5a15b1119c523ae54c09972413e8b97f11629