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
hr_size
Human-readable data size From https://stackoverflow.com/a/1094933 :param num: number of bytes :param suffix: Optional size specifier :return: Formatted string
manticore/utils/emulate.py
def hr_size(num, suffix='B') -> str: """ Human-readable data size From https://stackoverflow.com/a/1094933 :param num: number of bytes :param suffix: Optional size specifier :return: Formatted string """ for unit in ' KMGTPEZ': if abs(num) < 1024.0: return "%3.1f%s%s"...
def hr_size(num, suffix='B') -> str: """ Human-readable data size From https://stackoverflow.com/a/1094933 :param num: number of bytes :param suffix: Optional size specifier :return: Formatted string """ for unit in ' KMGTPEZ': if abs(num) < 1024.0: return "%3.1f%s%s"...
[ "Human", "-", "readable", "data", "size", "From", "https", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "1094933", ":", "param", "num", ":", "number", "of", "bytes", ":", "param", "suffix", ":", "Optional", "size", "specifier", ":", "return", ...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/emulate.py#L36-L48
[ "def", "hr_size", "(", "num", ",", "suffix", "=", "'B'", ")", "->", "str", ":", "for", "unit", "in", "' KMGTPEZ'", ":", "if", "abs", "(", "num", ")", "<", "1024.0", ":", "return", "\"%3.1f%s%s\"", "%", "(", "num", ",", "unit", "if", "unit", "!=", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConcreteUnicornEmulator.copy_memory
Copy the bytes from address to address+size into Unicorn Used primarily for copying memory maps :param address: start of buffer to copy :param size: How many bytes to copy
manticore/utils/emulate.py
def copy_memory(self, address, size): """ Copy the bytes from address to address+size into Unicorn Used primarily for copying memory maps :param address: start of buffer to copy :param size: How many bytes to copy """ start_time = time.time() map_bytes = s...
def copy_memory(self, address, size): """ Copy the bytes from address to address+size into Unicorn Used primarily for copying memory maps :param address: start of buffer to copy :param size: How many bytes to copy """ start_time = time.time() map_bytes = s...
[ "Copy", "the", "bytes", "from", "address", "to", "address", "+", "size", "into", "Unicorn", "Used", "primarily", "for", "copying", "memory", "maps", ":", "param", "address", ":", "start", "of", "buffer", "to", "copy", ":", "param", "size", ":", "How", "m...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/emulate.py#L123-L134
[ "def", "copy_memory", "(", "self", ",", "address", ",", "size", ")", ":", "start_time", "=", "time", ".", "time", "(", ")", "map_bytes", "=", "self", ".", "_cpu", ".", "_raw_read", "(", "address", ",", "size", ")", "self", ".", "_emu", ".", "mem_writ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConcreteUnicornEmulator.map_memory_callback
Catches did_map_memory and copies the mapping into Manticore
manticore/utils/emulate.py
def map_memory_callback(self, address, size, perms, name, offset, result): """ Catches did_map_memory and copies the mapping into Manticore """ logger.info(' '.join(("Mapping Memory @", hex(address) if type(address) is int else "0x??", ...
def map_memory_callback(self, address, size, perms, name, offset, result): """ Catches did_map_memory and copies the mapping into Manticore """ logger.info(' '.join(("Mapping Memory @", hex(address) if type(address) is int else "0x??", ...
[ "Catches", "did_map_memory", "and", "copies", "the", "mapping", "into", "Manticore" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/emulate.py#L136-L147
[ "def", "map_memory_callback", "(", "self", ",", "address", ",", "size", ",", "perms", ",", "name", ",", "offset", ",", "result", ")", ":", "logger", ".", "info", "(", "' '", ".", "join", "(", "(", "\"Mapping Memory @\"", ",", "hex", "(", "address", ")"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConcreteUnicornEmulator.unmap_memory_callback
Unmap Unicorn maps when Manticore unmaps them
manticore/utils/emulate.py
def unmap_memory_callback(self, start, size): """Unmap Unicorn maps when Manticore unmaps them""" logger.info(f"Unmapping memory from {hex(start)} to {hex(start + size)}") mask = (1 << 12) - 1 if (start & mask) != 0: logger.error("Memory to be unmapped is not aligned to a pa...
def unmap_memory_callback(self, start, size): """Unmap Unicorn maps when Manticore unmaps them""" logger.info(f"Unmapping memory from {hex(start)} to {hex(start + size)}") mask = (1 << 12) - 1 if (start & mask) != 0: logger.error("Memory to be unmapped is not aligned to a pa...
[ "Unmap", "Unicorn", "maps", "when", "Manticore", "unmaps", "them" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/emulate.py#L149-L161
[ "def", "unmap_memory_callback", "(", "self", ",", "start", ",", "size", ")", ":", "logger", ".", "info", "(", "f\"Unmapping memory from {hex(start)} to {hex(start + size)}\"", ")", "mask", "=", "(", "1", "<<", "12", ")", "-", "1", "if", "(", "start", "&", "m...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConcreteUnicornEmulator.protect_memory_callback
Set memory protections in Unicorn correctly
manticore/utils/emulate.py
def protect_memory_callback(self, start, size, perms): """ Set memory protections in Unicorn correctly """ logger.info(f"Changing permissions on {hex(start)}:{hex(start + size)} to {perms}") self._emu.mem_protect(start, size, convert_permissions(perms))
def protect_memory_callback(self, start, size, perms): """ Set memory protections in Unicorn correctly """ logger.info(f"Changing permissions on {hex(start)}:{hex(start + size)} to {perms}") self._emu.mem_protect(start, size, convert_permissions(perms))
[ "Set", "memory", "protections", "in", "Unicorn", "correctly" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/emulate.py#L163-L166
[ "def", "protect_memory_callback", "(", "self", ",", "start", ",", "size", ",", "perms", ")", ":", "logger", ".", "info", "(", "f\"Changing permissions on {hex(start)}:{hex(start + size)} to {perms}\"", ")", "self", ".", "_emu", ".", "mem_protect", "(", "start", ",",...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConcreteUnicornEmulator._hook_syscall
Unicorn hook that transfers control to Manticore so it can execute the syscall
manticore/utils/emulate.py
def _hook_syscall(self, uc, data): """ Unicorn hook that transfers control to Manticore so it can execute the syscall """ logger.debug(f"Stopping emulation at {hex(uc.reg_read(self._to_unicorn_id('RIP')))} to perform syscall") self.sync_unicorn_to_manticore() from ..nativ...
def _hook_syscall(self, uc, data): """ Unicorn hook that transfers control to Manticore so it can execute the syscall """ logger.debug(f"Stopping emulation at {hex(uc.reg_read(self._to_unicorn_id('RIP')))} to perform syscall") self.sync_unicorn_to_manticore() from ..nativ...
[ "Unicorn", "hook", "that", "transfers", "control", "to", "Manticore", "so", "it", "can", "execute", "the", "syscall" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/emulate.py#L179-L187
[ "def", "_hook_syscall", "(", "self", ",", "uc", ",", "data", ")", ":", "logger", ".", "debug", "(", "f\"Stopping emulation at {hex(uc.reg_read(self._to_unicorn_id('RIP')))} to perform syscall\"", ")", "self", ".", "sync_unicorn_to_manticore", "(", ")", "from", ".", ".",...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConcreteUnicornEmulator._hook_write_mem
Captures memory written by Unicorn
manticore/utils/emulate.py
def _hook_write_mem(self, uc, access, address, size, value, data): """ Captures memory written by Unicorn """ self._mem_delta[address] = (value, size) return True
def _hook_write_mem(self, uc, access, address, size, value, data): """ Captures memory written by Unicorn """ self._mem_delta[address] = (value, size) return True
[ "Captures", "memory", "written", "by", "Unicorn" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/emulate.py#L189-L194
[ "def", "_hook_write_mem", "(", "self", ",", "uc", ",", "access", ",", "address", ",", "size", ",", "value", ",", "data", ")", ":", "self", ".", "_mem_delta", "[", "address", "]", "=", "(", "value", ",", "size", ")", "return", "True" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConcreteUnicornEmulator._hook_unmapped
We hit an unmapped region; map it into unicorn.
manticore/utils/emulate.py
def _hook_unmapped(self, uc, access, address, size, value, data): """ We hit an unmapped region; map it into unicorn. """ try: self.sync_unicorn_to_manticore() logger.warning(f"Encountered an operation on unmapped memory at {hex(address)}") m = self._c...
def _hook_unmapped(self, uc, access, address, size, value, data): """ We hit an unmapped region; map it into unicorn. """ try: self.sync_unicorn_to_manticore() logger.warning(f"Encountered an operation on unmapped memory at {hex(address)}") m = self._c...
[ "We", "hit", "an", "unmapped", "region", ";", "map", "it", "into", "unicorn", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/emulate.py#L196-L212
[ "def", "_hook_unmapped", "(", "self", ",", "uc", ",", "access", ",", "address", ",", "size", ",", "value", ",", "data", ")", ":", "try", ":", "self", ".", "sync_unicorn_to_manticore", "(", ")", "logger", ".", "warning", "(", "f\"Encountered an operation on u...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConcreteUnicornEmulator.emulate
Wrapper that runs the _step function in a loop while handling exceptions
manticore/utils/emulate.py
def emulate(self, instruction): """ Wrapper that runs the _step function in a loop while handling exceptions """ # The emulation might restart if Unicorn needs to bring in a memory map # or bring a value from Manticore state. while True: # Try emulation ...
def emulate(self, instruction): """ Wrapper that runs the _step function in a loop while handling exceptions """ # The emulation might restart if Unicorn needs to bring in a memory map # or bring a value from Manticore state. while True: # Try emulation ...
[ "Wrapper", "that", "runs", "the", "_step", "function", "in", "a", "loop", "while", "handling", "exceptions" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/emulate.py#L239-L255
[ "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", ":", "# Try emulation", "self", ".", "_should_try_again", "=", "False", "self", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConcreteUnicornEmulator._step
Execute a chunk fo instructions starting from instruction :param instruction: Where to start :param chunksize: max number of instructions to execute. Defaults to infinite.
manticore/utils/emulate.py
def _step(self, instruction, chunksize=0): """ Execute a chunk fo instructions starting from instruction :param instruction: Where to start :param chunksize: max number of instructions to execute. Defaults to infinite. """ try: pc = self._cpu.PC m...
def _step(self, instruction, chunksize=0): """ Execute a chunk fo instructions starting from instruction :param instruction: Where to start :param chunksize: max number of instructions to execute. Defaults to infinite. """ try: pc = self._cpu.PC m...
[ "Execute", "a", "chunk", "fo", "instructions", "starting", "from", "instruction", ":", "param", "instruction", ":", "Where", "to", "start", ":", "param", "chunksize", ":", "max", "number", "of", "instructions", "to", "execute", ".", "Defaults", "to", "infinite...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/emulate.py#L257-L294
[ "def", "_step", "(", "self", ",", "instruction", ",", "chunksize", "=", "0", ")", ":", "try", ":", "pc", "=", "self", ".", "_cpu", ".", "PC", "m", "=", "self", ".", "_cpu", ".", "memory", ".", "map_containing", "(", "pc", ")", "if", "self", ".", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConcreteUnicornEmulator.sync_unicorn_to_manticore
Copy registers and written memory back into Manticore
manticore/utils/emulate.py
def sync_unicorn_to_manticore(self): """ Copy registers and written memory back into Manticore """ self.write_backs_disabled = True for reg in self.registers: val = self._emu.reg_read(self._to_unicorn_id(reg)) self._cpu.write_register(reg, val) if ...
def sync_unicorn_to_manticore(self): """ Copy registers and written memory back into Manticore """ self.write_backs_disabled = True for reg in self.registers: val = self._emu.reg_read(self._to_unicorn_id(reg)) self._cpu.write_register(reg, val) if ...
[ "Copy", "registers", "and", "written", "memory", "back", "into", "Manticore" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/emulate.py#L296-L310
[ "def", "sync_unicorn_to_manticore", "(", "self", ")", ":", "self", ".", "write_backs_disabled", "=", "True", "for", "reg", "in", "self", ".", "registers", ":", "val", "=", "self", ".", "_emu", ".", "reg_read", "(", "self", ".", "_to_unicorn_id", "(", "reg"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConcreteUnicornEmulator.write_back_memory
Copy memory writes from Manticore back into Unicorn in real-time
manticore/utils/emulate.py
def write_back_memory(self, where, expr, size): """ Copy memory writes from Manticore back into Unicorn in real-time """ if self.write_backs_disabled: return if type(expr) is bytes: self._emu.mem_write(where, expr) else: if issymbolic(expr): ...
def write_back_memory(self, where, expr, size): """ Copy memory writes from Manticore back into Unicorn in real-time """ if self.write_backs_disabled: return if type(expr) is bytes: self._emu.mem_write(where, expr) else: if issymbolic(expr): ...
[ "Copy", "memory", "writes", "from", "Manticore", "back", "into", "Unicorn", "in", "real", "-", "time" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/emulate.py#L312-L331
[ "def", "write_back_memory", "(", "self", ",", "where", ",", "expr", ",", "size", ")", ":", "if", "self", ".", "write_backs_disabled", ":", "return", "if", "type", "(", "expr", ")", "is", "bytes", ":", "self", ".", "_emu", ".", "mem_write", "(", "where"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConcreteUnicornEmulator.write_back_register
Sync register state from Manticore -> Unicorn
manticore/utils/emulate.py
def write_back_register(self, reg, val): """ Sync register state from Manticore -> Unicorn""" if self.write_backs_disabled: return if issymbolic(val): logger.warning("Skipping Symbolic write-back") return if reg in self.flag_registers: self...
def write_back_register(self, reg, val): """ Sync register state from Manticore -> Unicorn""" if self.write_backs_disabled: return if issymbolic(val): logger.warning("Skipping Symbolic write-back") return if reg in self.flag_registers: self...
[ "Sync", "register", "state", "from", "Manticore", "-", ">", "Unicorn" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/emulate.py#L333-L343
[ "def", "write_back_register", "(", "self", ",", "reg", ",", "val", ")", ":", "if", "self", ".", "write_backs_disabled", ":", "return", "if", "issymbolic", "(", "val", ")", ":", "logger", ".", "warning", "(", "\"Skipping Symbolic write-back\"", ")", "return", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
ConcreteUnicornEmulator.update_segment
Only useful for setting FS right now.
manticore/utils/emulate.py
def update_segment(self, selector, base, size, perms): """ Only useful for setting FS right now. """ logger.info("Updating selector %s to 0x%02x (%s bytes) (%s)", selector, base, size, perms) if selector == 99: self.set_fs(base) else: logger.error("No way to write...
def update_segment(self, selector, base, size, perms): """ Only useful for setting FS right now. """ logger.info("Updating selector %s to 0x%02x (%s bytes) (%s)", selector, base, size, perms) if selector == 99: self.set_fs(base) else: logger.error("No way to write...
[ "Only", "useful", "for", "setting", "FS", "right", "now", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/emulate.py#L345-L351
[ "def", "update_segment", "(", "self", ",", "selector", ",", "base", ",", "size", ",", "perms", ")", ":", "logger", ".", "info", "(", "\"Updating selector %s to 0x%02x (%s bytes) (%s)\"", ",", "selector", ",", "base", ",", "size", ",", "perms", ")", "if", "se...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
deprecated
A decorator for marking functions as deprecated.
manticore/utils/deprecated.py
def deprecated(message: str): """A decorator for marking functions as deprecated. """ assert isinstance(message, str), "The deprecated decorator requires a message string argument." def decorator(func): @wraps(func) def wrapper(*args, **kwargs): warnings.warn(f"`{func.__qualname...
def deprecated(message: str): """A decorator for marking functions as deprecated. """ assert isinstance(message, str), "The deprecated decorator requires a message string argument." def decorator(func): @wraps(func) def wrapper(*args, **kwargs): warnings.warn(f"`{func.__qualname...
[ "A", "decorator", "for", "marking", "functions", "as", "deprecated", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/deprecated.py#L17-L30
[ "def", "deprecated", "(", "message", ":", "str", ")", ":", "assert", "isinstance", "(", "message", ",", "str", ")", ",", "\"The deprecated decorator requires a message string argument.\"", "def", "decorator", "(", "func", ")", ":", "@", "wraps", "(", "func", ")"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
flip
flips a constraint (Equal) (Equal (BitVecITE Cond IfC ElseC) IfC) -> (Equal (BitVecITE Cond IfC ElseC) ElseC)
examples/script/concolic.py
def flip(constraint): ''' flips a constraint (Equal) (Equal (BitVecITE Cond IfC ElseC) IfC) -> (Equal (BitVecITE Cond IfC ElseC) ElseC) ''' equal = copy.copy(constraint) assert len(equal.operands) == 2 # assume they are the equal -> ite form that we produce on standard branches...
def flip(constraint): ''' flips a constraint (Equal) (Equal (BitVecITE Cond IfC ElseC) IfC) -> (Equal (BitVecITE Cond IfC ElseC) ElseC) ''' equal = copy.copy(constraint) assert len(equal.operands) == 2 # assume they are the equal -> ite form that we produce on standard branches...
[ "flips", "a", "constraint", "(", "Equal", ")" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/examples/script/concolic.py#L55-L75
[ "def", "flip", "(", "constraint", ")", ":", "equal", "=", "copy", ".", "copy", "(", "constraint", ")", "assert", "len", "(", "equal", ".", "operands", ")", "==", "2", "# assume they are the equal -> ite form that we produce on standard branches", "ite", ",", "forc...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
perm
Produce permutations of `lst`, where permutations are mutated by `func`. Used for flipping constraints. highly possible that returned constraints can be unsat this does it blindly, without any attention to the constraints themselves Considering lst as a list of constraints, e.g. [ C1, C2, C3 ] ...
examples/script/concolic.py
def perm(lst, func): ''' Produce permutations of `lst`, where permutations are mutated by `func`. Used for flipping constraints. highly possible that returned constraints can be unsat this does it blindly, without any attention to the constraints themselves Considering lst as a list of constraints, e.g...
def perm(lst, func): ''' Produce permutations of `lst`, where permutations are mutated by `func`. Used for flipping constraints. highly possible that returned constraints can be unsat this does it blindly, without any attention to the constraints themselves Considering lst as a list of constraints, e.g...
[ "Produce", "permutations", "of", "lst", "where", "permutations", "are", "mutated", "by", "func", ".", "Used", "for", "flipping", "constraints", ".", "highly", "possible", "that", "returned", "constraints", "can", "be", "unsat", "this", "does", "it", "blindly", ...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/examples/script/concolic.py#L97-L123
[ "def", "perm", "(", "lst", ",", "func", ")", ":", "for", "i", "in", "range", "(", "1", ",", "2", "**", "len", "(", "lst", ")", ")", ":", "yield", "[", "func", "(", "item", ")", "if", "(", "1", "<<", "j", ")", "&", "i", "else", "item", "fo...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
input_from_cons
solve bytes in |datas| based on
examples/script/concolic.py
def input_from_cons(constupl, datas): ' solve bytes in |datas| based on ' def make_chr(c): try: return chr(c) except Exception: return c newset = constraints_to_constraintset(constupl) ret = '' for data in datas: for c in data: ret += make...
def input_from_cons(constupl, datas): ' solve bytes in |datas| based on ' def make_chr(c): try: return chr(c) except Exception: return c newset = constraints_to_constraintset(constupl) ret = '' for data in datas: for c in data: ret += make...
[ "solve", "bytes", "in", "|datas|", "based", "on" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/examples/script/concolic.py#L130-L143
[ "def", "input_from_cons", "(", "constupl", ",", "datas", ")", ":", "def", "make_chr", "(", "c", ")", ":", "try", ":", "return", "chr", "(", "c", ")", "except", "Exception", ":", "return", "c", "newset", "=", "constraints_to_constraintset", "(", "constupl",...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
symbolic_run_get_cons
Execute a symbolic run that follows a concrete run; return constraints generated and the stdin data produced
examples/script/concolic.py
def symbolic_run_get_cons(trace): ''' Execute a symbolic run that follows a concrete run; return constraints generated and the stdin data produced ''' m2 = Manticore.linux(prog, workspace_url='mem:') f = Follower(trace) m2.verbosity(VERBOSITY) m2.register_plugin(f) def on_term_test...
def symbolic_run_get_cons(trace): ''' Execute a symbolic run that follows a concrete run; return constraints generated and the stdin data produced ''' m2 = Manticore.linux(prog, workspace_url='mem:') f = Follower(trace) m2.verbosity(VERBOSITY) m2.register_plugin(f) def on_term_test...
[ "Execute", "a", "symbolic", "run", "that", "follows", "a", "concrete", "run", ";", "return", "constraints", "generated", "and", "the", "stdin", "data", "produced" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/examples/script/concolic.py#L157-L184
[ "def", "symbolic_run_get_cons", "(", "trace", ")", ":", "m2", "=", "Manticore", ".", "linux", "(", "prog", ",", "workspace_url", "=", "'mem:'", ")", "f", "=", "Follower", "(", "trace", ")", "m2", ".", "verbosity", "(", "VERBOSITY", ")", "m2", ".", "reg...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SymbolicFile.seek
Repositions the file C{offset} according to C{whence}. Returns the resulting offset or -1 in case of error. :rtype: int :return: the file offset.
manticore/platforms/linux.py
def seek(self, offset, whence=os.SEEK_SET): """ Repositions the file C{offset} according to C{whence}. Returns the resulting offset or -1 in case of error. :rtype: int :return: the file offset. """ assert isinstance(offset, int) assert whence in (os.SEEK_S...
def seek(self, offset, whence=os.SEEK_SET): """ Repositions the file C{offset} according to C{whence}. Returns the resulting offset or -1 in case of error. :rtype: int :return: the file offset. """ assert isinstance(offset, int) assert whence in (os.SEEK_S...
[ "Repositions", "the", "file", "C", "{", "offset", "}", "according", "to", "C", "{", "whence", "}", ".", "Returns", "the", "resulting", "offset", "or", "-", "1", "in", "case", "of", "error", ".", ":", "rtype", ":", "int", ":", "return", ":", "the", ...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L265-L288
[ "def", "seek", "(", "self", ",", "offset", ",", "whence", "=", "os", ".", "SEEK_SET", ")", ":", "assert", "isinstance", "(", "offset", ",", "int", ")", "assert", "whence", "in", "(", "os", ".", "SEEK_SET", ",", "os", ".", "SEEK_CUR", ",", "os", "."...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SymbolicFile.read
Reads up to C{count} bytes from the file. :rtype: list :return: the list of symbolic bytes read
manticore/platforms/linux.py
def read(self, count): """ Reads up to C{count} bytes from the file. :rtype: list :return: the list of symbolic bytes read """ if self.pos > self.max_size: return [] else: size = min(count, self.max_size - self.pos) ret = [self....
def read(self, count): """ Reads up to C{count} bytes from the file. :rtype: list :return: the list of symbolic bytes read """ if self.pos > self.max_size: return [] else: size = min(count, self.max_size - self.pos) ret = [self....
[ "Reads", "up", "to", "C", "{", "count", "}", "bytes", "from", "the", "file", ".", ":", "rtype", ":", "list", ":", "return", ":", "the", "list", "of", "symbolic", "bytes", "read" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L290-L302
[ "def", "read", "(", "self", ",", "count", ")", ":", "if", "self", ".", "pos", ">", "self", ".", "max_size", ":", "return", "[", "]", "else", ":", "size", "=", "min", "(", "count", ",", "self", ".", "max_size", "-", "self", ".", "pos", ")", "ret...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SymbolicFile.write
Writes the symbolic bytes in C{data} onto the file.
manticore/platforms/linux.py
def write(self, data): """ Writes the symbolic bytes in C{data} onto the file. """ size = min(len(data), self.max_size - self.pos) for i in range(self.pos, self.pos + size): self.array[i] = data[i - self.pos]
def write(self, data): """ Writes the symbolic bytes in C{data} onto the file. """ size = min(len(data), self.max_size - self.pos) for i in range(self.pos, self.pos + size): self.array[i] = data[i - self.pos]
[ "Writes", "the", "symbolic", "bytes", "in", "C", "{", "data", "}", "onto", "the", "file", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L304-L310
[ "def", "write", "(", "self", ",", "data", ")", ":", "size", "=", "min", "(", "len", "(", "data", ")", ",", "self", ".", "max_size", "-", "self", ".", "pos", ")", "for", "i", "in", "range", "(", "self", ".", "pos", ",", "self", ".", "pos", "+"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.empty_platform
Create a platform without an ELF loaded. :param str arch: The architecture of the new platform :rtype: Linux
manticore/platforms/linux.py
def empty_platform(cls, arch): """ Create a platform without an ELF loaded. :param str arch: The architecture of the new platform :rtype: Linux """ platform = cls(None) platform._init_cpu(arch) platform._init_std_fds() return platform
def empty_platform(cls, arch): """ Create a platform without an ELF loaded. :param str arch: The architecture of the new platform :rtype: Linux """ platform = cls(None) platform._init_cpu(arch) platform._init_std_fds() return platform
[ "Create", "a", "platform", "without", "an", "ELF", "loaded", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L452-L462
[ "def", "empty_platform", "(", "cls", ",", "arch", ")", ":", "platform", "=", "cls", "(", "None", ")", "platform", ".", "_init_cpu", "(", "arch", ")", "platform", ".", "_init_std_fds", "(", ")", "return", "platform" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux._execve
Load `program` and establish program state, such as stack and arguments. :param program str: The ELF binary to load :param argv list: argv array :param envp list: envp array
manticore/platforms/linux.py
def _execve(self, program, argv, envp): """ Load `program` and establish program state, such as stack and arguments. :param program str: The ELF binary to load :param argv list: argv array :param envp list: envp array """ argv = [] if argv is None else argv ...
def _execve(self, program, argv, envp): """ Load `program` and establish program state, such as stack and arguments. :param program str: The ELF binary to load :param argv list: argv array :param envp list: envp array """ argv = [] if argv is None else argv ...
[ "Load", "program", "and", "establish", "program", "state", "such", "as", "stack", "and", "arguments", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L511-L543
[ "def", "_execve", "(", "self", ",", "program", ",", "argv", ",", "envp", ")", ":", "argv", "=", "[", "]", "if", "argv", "is", "None", "else", "argv", "envp", "=", "[", "]", "if", "envp", "is", "None", "else", "envp", "logger", ".", "debug", "(", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux._init_arm_kernel_helpers
ARM kernel helpers https://www.kernel.org/doc/Documentation/arm/kernel_user_helpers.txt
manticore/platforms/linux.py
def _init_arm_kernel_helpers(self): """ ARM kernel helpers https://www.kernel.org/doc/Documentation/arm/kernel_user_helpers.txt """ page_data = bytearray(b'\xf1\xde\xfd\xe7' * 1024) # Extracted from a RPi2 preamble = binascii.unhexlify( 'ff0300ea' +...
def _init_arm_kernel_helpers(self): """ ARM kernel helpers https://www.kernel.org/doc/Documentation/arm/kernel_user_helpers.txt """ page_data = bytearray(b'\xf1\xde\xfd\xe7' * 1024) # Extracted from a RPi2 preamble = binascii.unhexlify( 'ff0300ea' +...
[ "ARM", "kernel", "helpers" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L654-L731
[ "def", "_init_arm_kernel_helpers", "(", "self", ")", ":", "page_data", "=", "bytearray", "(", "b'\\xf1\\xde\\xfd\\xe7'", "*", "1024", ")", "# Extracted from a RPi2", "preamble", "=", "binascii", ".", "unhexlify", "(", "'ff0300ea'", "+", "'650400ea'", "+", "'f0ff9fe5...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.setup_stack
:param Cpu cpu: The cpu instance :param argv: list of parameters for the program to execute. :param envp: list of environment variables for the program to execute. http://www.phrack.org/issues.html?issue=58&id=5#article position content size (bytes) + com...
manticore/platforms/linux.py
def setup_stack(self, argv, envp): """ :param Cpu cpu: The cpu instance :param argv: list of parameters for the program to execute. :param envp: list of environment variables for the program to execute. http://www.phrack.org/issues.html?issue=58&id=5#article position ...
def setup_stack(self, argv, envp): """ :param Cpu cpu: The cpu instance :param argv: list of parameters for the program to execute. :param envp: list of environment variables for the program to execute. http://www.phrack.org/issues.html?issue=58&id=5#article position ...
[ ":", "param", "Cpu", "cpu", ":", "The", "cpu", "instance", ":", "param", "argv", ":", "list", "of", "parameters", "for", "the", "program", "to", "execute", ".", ":", "param", "envp", ":", "list", "of", "environment", "variables", "for", "the", "program",...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L745-L869
[ "def", "setup_stack", "(", "self", ",", "argv", ",", "envp", ")", ":", "cpu", "=", "self", ".", "current", "# In case setup_stack() is called again, we make sure we're growing the", "# stack from the original top", "cpu", ".", "STACK", "=", "self", ".", "_stack_top", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.load
Loads and an ELF program in memory and prepares the initial CPU state. Creates the stack and loads the environment variables and the arguments in it. :param filename: pathname of the file to be executed. (used for auxv) :param list env: A list of env variables. (used for extracting vars that co...
manticore/platforms/linux.py
def load(self, filename, env): """ Loads and an ELF program in memory and prepares the initial CPU state. Creates the stack and loads the environment variables and the arguments in it. :param filename: pathname of the file to be executed. (used for auxv) :param list env: A list ...
def load(self, filename, env): """ Loads and an ELF program in memory and prepares the initial CPU state. Creates the stack and loads the environment variables and the arguments in it. :param filename: pathname of the file to be executed. (used for auxv) :param list env: A list ...
[ "Loads", "and", "an", "ELF", "program", "in", "memory", "and", "prepares", "the", "initial", "CPU", "state", ".", "Creates", "the", "stack", "and", "loads", "the", "environment", "variables", "and", "the", "arguments", "in", "it", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L878-L1115
[ "def", "load", "(", "self", ",", "filename", ",", "env", ")", ":", "# load elf See binfmt_elf.c", "# read the ELF object file", "cpu", "=", "self", ".", "current", "elf", "=", "self", ".", "elf", "arch", "=", "self", ".", "arch", "env", "=", "dict", "(", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux._open
Adds a file descriptor to the current file descriptor list :rtype: int :param f: the file descriptor to add. :return: the index of the file descriptor in the file descr. list
manticore/platforms/linux.py
def _open(self, f): """ Adds a file descriptor to the current file descriptor list :rtype: int :param f: the file descriptor to add. :return: the index of the file descriptor in the file descr. list """ if None in self.files: fd = self.files.index(Non...
def _open(self, f): """ Adds a file descriptor to the current file descriptor list :rtype: int :param f: the file descriptor to add. :return: the index of the file descriptor in the file descr. list """ if None in self.files: fd = self.files.index(Non...
[ "Adds", "a", "file", "descriptor", "to", "the", "current", "file", "descriptor", "list" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1127-L1141
[ "def", "_open", "(", "self", ",", "f", ")", ":", "if", "None", "in", "self", ".", "files", ":", "fd", "=", "self", ".", "files", ".", "index", "(", "None", ")", "self", ".", "files", "[", "fd", "]", "=", "f", "else", ":", "fd", "=", "len", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux._close
Removes a file descriptor from the file descriptor list :rtype: int :param fd: the file descriptor to close. :return: C{0} on success.
manticore/platforms/linux.py
def _close(self, fd): """ Removes a file descriptor from the file descriptor list :rtype: int :param fd: the file descriptor to close. :return: C{0} on success. """ try: self.files[fd].close() self._closed_files.append(self.files[fd]) # Ke...
def _close(self, fd): """ Removes a file descriptor from the file descriptor list :rtype: int :param fd: the file descriptor to close. :return: C{0} on success. """ try: self.files[fd].close() self._closed_files.append(self.files[fd]) # Ke...
[ "Removes", "a", "file", "descriptor", "from", "the", "file", "descriptor", "list", ":", "rtype", ":", "int", ":", "param", "fd", ":", "the", "file", "descriptor", "to", "close", ".", ":", "return", ":", "C", "{", "0", "}", "on", "success", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1143-L1155
[ "def", "_close", "(", "self", ",", "fd", ")", ":", "try", ":", "self", ".", "files", "[", "fd", "]", ".", "close", "(", ")", "self", ".", "_closed_files", ".", "append", "(", "self", ".", "files", "[", "fd", "]", ")", "# Keep track for SymbolicFile t...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux._is_fd_open
Determines if the fd is within range and in the file descr. list :param fd: the file descriptor to check.
manticore/platforms/linux.py
def _is_fd_open(self, fd): """ Determines if the fd is within range and in the file descr. list :param fd: the file descriptor to check. """ return fd >= 0 and fd < len(self.files) and self.files[fd] is not None
def _is_fd_open(self, fd): """ Determines if the fd is within range and in the file descr. list :param fd: the file descriptor to check. """ return fd >= 0 and fd < len(self.files) and self.files[fd] is not None
[ "Determines", "if", "the", "fd", "is", "within", "range", "and", "in", "the", "file", "descr", ".", "list", ":", "param", "fd", ":", "the", "file", "descriptor", "to", "check", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1166-L1171
[ "def", "_is_fd_open", "(", "self", ",", "fd", ")", ":", "return", "fd", ">=", "0", "and", "fd", "<", "len", "(", "self", ".", "files", ")", "and", "self", ".", "files", "[", "fd", "]", "is", "not", "None" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_chdir
chdir - Change current working directory :param int path: Pointer to path
manticore/platforms/linux.py
def sys_chdir(self, path): """ chdir - Change current working directory :param int path: Pointer to path """ path_str = self.current.read_string(path) logger.debug(f"chdir({path_str})") try: os.chdir(path_str) return 0 except OSErro...
def sys_chdir(self, path): """ chdir - Change current working directory :param int path: Pointer to path """ path_str = self.current.read_string(path) logger.debug(f"chdir({path_str})") try: os.chdir(path_str) return 0 except OSErro...
[ "chdir", "-", "Change", "current", "working", "directory", ":", "param", "int", "path", ":", "Pointer", "to", "path" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1201-L1212
[ "def", "sys_chdir", "(", "self", ",", "path", ")", ":", "path_str", "=", "self", ".", "current", ".", "read_string", "(", "path", ")", "logger", ".", "debug", "(", "f\"chdir({path_str})\"", ")", "try", ":", "os", ".", "chdir", "(", "path_str", ")", "re...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_getcwd
getcwd - Get the current working directory :param int buf: Pointer to dest array :param size: size in bytes of the array pointed to by the buf :return: buf (Success), or 0
manticore/platforms/linux.py
def sys_getcwd(self, buf, size): """ getcwd - Get the current working directory :param int buf: Pointer to dest array :param size: size in bytes of the array pointed to by the buf :return: buf (Success), or 0 """ try: current_dir = os.getcwd() ...
def sys_getcwd(self, buf, size): """ getcwd - Get the current working directory :param int buf: Pointer to dest array :param size: size in bytes of the array pointed to by the buf :return: buf (Success), or 0 """ try: current_dir = os.getcwd() ...
[ "getcwd", "-", "Get", "the", "current", "working", "directory", ":", "param", "int", "buf", ":", "Pointer", "to", "dest", "array", ":", "param", "size", ":", "size", "in", "bytes", "of", "the", "array", "pointed", "to", "by", "the", "buf", ":", "return...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1214-L1240
[ "def", "sys_getcwd", "(", "self", ",", "buf", ",", "size", ")", ":", "try", ":", "current_dir", "=", "os", ".", "getcwd", "(", ")", "length", "=", "len", "(", "current_dir", ")", "+", "1", "if", "size", ">", "0", "and", "size", "<", "length", ":"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_lseek
lseek - reposition read/write file offset The lseek() function repositions the file offset of the open file description associated with the file descriptor fd to the argument offset according to the directive whence :param fd: a valid file descriptor :param offset: the offset in bytes...
manticore/platforms/linux.py
def sys_lseek(self, fd, offset, whence): """ lseek - reposition read/write file offset The lseek() function repositions the file offset of the open file description associated with the file descriptor fd to the argument offset according to the directive whence :param fd: a val...
def sys_lseek(self, fd, offset, whence): """ lseek - reposition read/write file offset The lseek() function repositions the file offset of the open file description associated with the file descriptor fd to the argument offset according to the directive whence :param fd: a val...
[ "lseek", "-", "reposition", "read", "/", "write", "file", "offset" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1242-L1265
[ "def", "sys_lseek", "(", "self", ",", "fd", ",", "offset", ",", "whence", ")", ":", "signed_offset", "=", "self", ".", "_to_signed_dword", "(", "offset", ")", "try", ":", "return", "self", ".", "_get_fd", "(", "fd", ")", ".", "seek", "(", "signed_offse...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_write
write - send bytes through a file descriptor The write system call writes up to count bytes from the buffer pointed to by buf to the file descriptor fd. If count is zero, write returns 0 and optionally sets *tx_bytes to zero. :param fd a valid file descriptor ...
manticore/platforms/linux.py
def sys_write(self, fd, buf, count): """ write - send bytes through a file descriptor The write system call writes up to count bytes from the buffer pointed to by buf to the file descriptor fd. If count is zero, write returns 0 and optionally sets *tx_bytes to zero. :par...
def sys_write(self, fd, buf, count): """ write - send bytes through a file descriptor The write system call writes up to count bytes from the buffer pointed to by buf to the file descriptor fd. If count is zero, write returns 0 and optionally sets *tx_bytes to zero. :par...
[ "write", "-", "send", "bytes", "through", "a", "file", "descriptor", "The", "write", "system", "call", "writes", "up", "to", "count", "bytes", "from", "the", "buffer", "pointed", "to", "by", "buf", "to", "the", "file", "descriptor", "fd", ".", "If", "cou...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1287-L1329
[ "def", "sys_write", "(", "self", ",", "fd", ",", "buf", ",", "count", ")", ":", "data", ":", "bytes", "=", "bytes", "(", ")", "cpu", "=", "self", ".", "current", "if", "count", "!=", "0", ":", "try", ":", "write_fd", "=", "self", ".", "_get_fd", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_access
Checks real user's permissions for a file :rtype: int :param buf: a buffer containing the pathname to the file to check its permissions. :param mode: the access permissions to check. :return: - C{0} if the calling process can access the file in the desired mode. ...
manticore/platforms/linux.py
def sys_access(self, buf, mode): """ Checks real user's permissions for a file :rtype: int :param buf: a buffer containing the pathname to the file to check its permissions. :param mode: the access permissions to check. :return: - C{0} if the calling process...
def sys_access(self, buf, mode): """ Checks real user's permissions for a file :rtype: int :param buf: a buffer containing the pathname to the file to check its permissions. :param mode: the access permissions to check. :return: - C{0} if the calling process...
[ "Checks", "real", "user", "s", "permissions", "for", "a", "file", ":", "rtype", ":", "int" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1337-L1358
[ "def", "sys_access", "(", "self", ",", "buf", ",", "mode", ")", ":", "filename", "=", "b''", "for", "i", "in", "range", "(", "0", ",", "255", ")", ":", "c", "=", "Operators", ".", "CHR", "(", "self", ".", "current", ".", "read_int", "(", "buf", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_newuname
Writes system information in the variable C{old_utsname}. :rtype: int :param old_utsname: the buffer to write the system info. :return: C{0} on success
manticore/platforms/linux.py
def sys_newuname(self, old_utsname): """ Writes system information in the variable C{old_utsname}. :rtype: int :param old_utsname: the buffer to write the system info. :return: C{0} on success """ from datetime import datetime def pad(s): retu...
def sys_newuname(self, old_utsname): """ Writes system information in the variable C{old_utsname}. :rtype: int :param old_utsname: the buffer to write the system info. :return: C{0} on success """ from datetime import datetime def pad(s): retu...
[ "Writes", "system", "information", "in", "the", "variable", "C", "{", "old_utsname", "}", ".", ":", "rtype", ":", "int", ":", "param", "old_utsname", ":", "the", "buffer", "to", "write", "the", "system", "info", ".", ":", "return", ":", "C", "{", "0", ...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1360-L1382
[ "def", "sys_newuname", "(", "self", ",", "old_utsname", ")", ":", "from", "datetime", "import", "datetime", "def", "pad", "(", "s", ")", ":", "return", "s", "+", "'\\x00'", "*", "(", "65", "-", "len", "(", "s", ")", ")", "now", "=", "datetime", "("...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_brk
Changes data segment size (moves the C{brk} to the new address) :rtype: int :param brk: the new address for C{brk}. :return: the value of the new C{brk}. :raises error: - "Error in brk!" if there is any error allocating the memory
manticore/platforms/linux.py
def sys_brk(self, brk): """ Changes data segment size (moves the C{brk} to the new address) :rtype: int :param brk: the new address for C{brk}. :return: the value of the new C{brk}. :raises error: - "Error in brk!" if there is any error allocating the ...
def sys_brk(self, brk): """ Changes data segment size (moves the C{brk} to the new address) :rtype: int :param brk: the new address for C{brk}. :return: the value of the new C{brk}. :raises error: - "Error in brk!" if there is any error allocating the ...
[ "Changes", "data", "segment", "size", "(", "moves", "the", "C", "{", "brk", "}", "to", "the", "new", "address", ")", ":", "rtype", ":", "int", ":", "param", "brk", ":", "the", "new", "address", "for", "C", "{", "brk", "}", ".", ":", "return", ":"...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1384-L1403
[ "def", "sys_brk", "(", "self", ",", "brk", ")", ":", "if", "brk", "!=", "0", "and", "brk", ">", "self", ".", "elf_brk", ":", "mem", "=", "self", ".", "current", ".", "memory", "size", "=", "brk", "-", "self", ".", "brk", "if", "brk", ">", "mem"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_arch_prctl
Sets architecture-specific thread state :rtype: int :param code: must be C{ARCH_SET_FS}. :param addr: the base address of the FS segment. :return: C{0} on success :raises error: - if C{code} is different to C{ARCH_SET_FS}
manticore/platforms/linux.py
def sys_arch_prctl(self, code, addr): """ Sets architecture-specific thread state :rtype: int :param code: must be C{ARCH_SET_FS}. :param addr: the base address of the FS segment. :return: C{0} on success :raises error: - if C{code} is different to C{...
def sys_arch_prctl(self, code, addr): """ Sets architecture-specific thread state :rtype: int :param code: must be C{ARCH_SET_FS}. :param addr: the base address of the FS segment. :return: C{0} on success :raises error: - if C{code} is different to C{...
[ "Sets", "architecture", "-", "specific", "thread", "state", ":", "rtype", ":", "int" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1405-L1427
[ "def", "sys_arch_prctl", "(", "self", ",", "code", ",", "addr", ")", ":", "ARCH_SET_GS", "=", "0x1001", "ARCH_SET_FS", "=", "0x1002", "ARCH_GET_FS", "=", "0x1003", "ARCH_GET_GS", "=", "0x1004", "if", "code", "not", "in", "{", "ARCH_SET_GS", ",", "ARCH_SET_FS...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_open
:param buf: address of zero-terminated pathname :param flags: file access bits :param mode: file permission mode
manticore/platforms/linux.py
def sys_open(self, buf, flags, mode): """ :param buf: address of zero-terminated pathname :param flags: file access bits :param mode: file permission mode """ filename = self.current.read_string(buf) try: f = self._sys_open_get_file(filename, flags) ...
def sys_open(self, buf, flags, mode): """ :param buf: address of zero-terminated pathname :param flags: file access bits :param mode: file permission mode """ filename = self.current.read_string(buf) try: f = self._sys_open_get_file(filename, flags) ...
[ ":", "param", "buf", ":", "address", "of", "zero", "-", "terminated", "pathname", ":", "param", "flags", ":", "file", "access", "bits", ":", "param", "mode", ":", "file", "permission", "mode" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1450-L1464
[ "def", "sys_open", "(", "self", ",", "buf", ",", "flags", ",", "mode", ")", ":", "filename", "=", "self", ".", "current", ".", "read_string", "(", "buf", ")", "try", ":", "f", "=", "self", ".", "_sys_open_get_file", "(", "filename", ",", "flags", ")"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_openat
Openat SystemCall - Similar to open system call except dirfd argument when path contained in buf is relative, dirfd is referred to set the relative path Special value AT_FDCWD set for dirfd to set path relative to current directory :param dirfd: directory file descriptor to refer in case of rel...
manticore/platforms/linux.py
def sys_openat(self, dirfd, buf, flags, mode): """ Openat SystemCall - Similar to open system call except dirfd argument when path contained in buf is relative, dirfd is referred to set the relative path Special value AT_FDCWD set for dirfd to set path relative to current directory ...
def sys_openat(self, dirfd, buf, flags, mode): """ Openat SystemCall - Similar to open system call except dirfd argument when path contained in buf is relative, dirfd is referred to set the relative path Special value AT_FDCWD set for dirfd to set path relative to current directory ...
[ "Openat", "SystemCall", "-", "Similar", "to", "open", "system", "call", "except", "dirfd", "argument", "when", "path", "contained", "in", "buf", "is", "relative", "dirfd", "is", "referred", "to", "set", "the", "relative", "path", "Special", "value", "AT_FDCWD"...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1466-L1504
[ "def", "sys_openat", "(", "self", ",", "dirfd", ",", "buf", ",", "flags", ",", "mode", ")", ":", "filename", "=", "self", ".", "current", ".", "read_string", "(", "buf", ")", "dirfd", "=", "ctypes", ".", "c_int32", "(", "dirfd", ")", ".", "value", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_rename
Rename filename `oldnamep` to `newnamep`. :param int oldnamep: pointer to oldname :param int newnamep: pointer to newname
manticore/platforms/linux.py
def sys_rename(self, oldnamep, newnamep): """ Rename filename `oldnamep` to `newnamep`. :param int oldnamep: pointer to oldname :param int newnamep: pointer to newname """ oldname = self.current.read_string(oldnamep) newname = self.current.read_string(newnamep) ...
def sys_rename(self, oldnamep, newnamep): """ Rename filename `oldnamep` to `newnamep`. :param int oldnamep: pointer to oldname :param int newnamep: pointer to newname """ oldname = self.current.read_string(oldnamep) newname = self.current.read_string(newnamep) ...
[ "Rename", "filename", "oldnamep", "to", "newnamep", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1506-L1522
[ "def", "sys_rename", "(", "self", ",", "oldnamep", ",", "newnamep", ")", ":", "oldname", "=", "self", ".", "current", ".", "read_string", "(", "oldnamep", ")", "newname", "=", "self", ".", "current", ".", "read_string", "(", "newnamep", ")", "ret", "=", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_fsync
Synchronize a file's in-core state with that on disk.
manticore/platforms/linux.py
def sys_fsync(self, fd): """ Synchronize a file's in-core state with that on disk. """ ret = 0 try: self.files[fd].sync() except IndexError: ret = -errno.EBADF except FdError: ret = -errno.EINVAL return ret
def sys_fsync(self, fd): """ Synchronize a file's in-core state with that on disk. """ ret = 0 try: self.files[fd].sync() except IndexError: ret = -errno.EBADF except FdError: ret = -errno.EINVAL return ret
[ "Synchronize", "a", "file", "s", "in", "-", "core", "state", "with", "that", "on", "disk", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1524-L1537
[ "def", "sys_fsync", "(", "self", ",", "fd", ")", ":", "ret", "=", "0", "try", ":", "self", ".", "files", "[", "fd", "]", ".", "sync", "(", ")", "except", "IndexError", ":", "ret", "=", "-", "errno", ".", "EBADF", "except", "FdError", ":", "ret", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_rt_sigaction
Wrapper for sys_sigaction
manticore/platforms/linux.py
def sys_rt_sigaction(self, signum, act, oldact): """Wrapper for sys_sigaction""" return self.sys_sigaction(signum, act, oldact)
def sys_rt_sigaction(self, signum, act, oldact): """Wrapper for sys_sigaction""" return self.sys_sigaction(signum, act, oldact)
[ "Wrapper", "for", "sys_sigaction" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1558-L1560
[ "def", "sys_rt_sigaction", "(", "self", ",", "signum", ",", "act", ",", "oldact", ")", ":", "return", "self", ".", "sys_sigaction", "(", "signum", ",", "act", ",", "oldact", ")" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_rt_sigprocmask
Wrapper for sys_sigprocmask
manticore/platforms/linux.py
def sys_rt_sigprocmask(self, cpu, how, newset, oldset): """Wrapper for sys_sigprocmask""" return self.sys_sigprocmask(cpu, how, newset, oldset)
def sys_rt_sigprocmask(self, cpu, how, newset, oldset): """Wrapper for sys_sigprocmask""" return self.sys_sigprocmask(cpu, how, newset, oldset)
[ "Wrapper", "for", "sys_sigprocmask" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1566-L1568
[ "def", "sys_rt_sigprocmask", "(", "self", ",", "cpu", ",", "how", ",", "newset", ",", "oldset", ")", ":", "return", "self", ".", "sys_sigprocmask", "(", "cpu", ",", "how", ",", "newset", ",", "oldset", ")" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_dup
Duplicates an open file descriptor :rtype: int :param fd: the open file descriptor to duplicate. :return: the new file descriptor.
manticore/platforms/linux.py
def sys_dup(self, fd): """ Duplicates an open file descriptor :rtype: int :param fd: the open file descriptor to duplicate. :return: the new file descriptor. """ if not self._is_fd_open(fd): logger.info("DUP: Passed fd is not open. Returning EBADF") ...
def sys_dup(self, fd): """ Duplicates an open file descriptor :rtype: int :param fd: the open file descriptor to duplicate. :return: the new file descriptor. """ if not self._is_fd_open(fd): logger.info("DUP: Passed fd is not open. Returning EBADF") ...
[ "Duplicates", "an", "open", "file", "descriptor", ":", "rtype", ":", "int", ":", "param", "fd", ":", "the", "open", "file", "descriptor", "to", "duplicate", ".", ":", "return", ":", "the", "new", "file", "descriptor", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1574-L1587
[ "def", "sys_dup", "(", "self", ",", "fd", ")", ":", "if", "not", "self", ".", "_is_fd_open", "(", "fd", ")", ":", "logger", ".", "info", "(", "\"DUP: Passed fd is not open. Returning EBADF\"", ")", "return", "-", "errno", ".", "EBADF", "newfd", "=", "self"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_dup2
Duplicates an open fd to newfd. If newfd is open, it is first closed :rtype: int :param fd: the open file descriptor to duplicate. :param newfd: the file descriptor to alias the file described by fd. :return: newfd.
manticore/platforms/linux.py
def sys_dup2(self, fd, newfd): """ Duplicates an open fd to newfd. If newfd is open, it is first closed :rtype: int :param fd: the open file descriptor to duplicate. :param newfd: the file descriptor to alias the file described by fd. :return: newfd. """ t...
def sys_dup2(self, fd, newfd): """ Duplicates an open fd to newfd. If newfd is open, it is first closed :rtype: int :param fd: the open file descriptor to duplicate. :param newfd: the file descriptor to alias the file described by fd. :return: newfd. """ t...
[ "Duplicates", "an", "open", "fd", "to", "newfd", ".", "If", "newfd", "is", "open", "it", "is", "first", "closed", ":", "rtype", ":", "int", ":", "param", "fd", ":", "the", "open", "file", "descriptor", "to", "duplicate", ".", ":", "param", "newfd", "...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1589-L1617
[ "def", "sys_dup2", "(", "self", ",", "fd", ",", "newfd", ")", ":", "try", ":", "file", "=", "self", ".", "_get_fd", "(", "fd", ")", "except", "FdError", "as", "e", ":", "logger", ".", "info", "(", "\"DUP2: Passed fd is not open. Returning EBADF\"", ")", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_chroot
An implementation of chroot that does perform some basic error checking, but does not actually chroot. :param path: Path to chroot
manticore/platforms/linux.py
def sys_chroot(self, path): """ An implementation of chroot that does perform some basic error checking, but does not actually chroot. :param path: Path to chroot """ if path not in self.current.memory: return -errno.EFAULT path_s = self.current.read...
def sys_chroot(self, path): """ An implementation of chroot that does perform some basic error checking, but does not actually chroot. :param path: Path to chroot """ if path not in self.current.memory: return -errno.EFAULT path_s = self.current.read...
[ "An", "implementation", "of", "chroot", "that", "does", "perform", "some", "basic", "error", "checking", "but", "does", "not", "actually", "chroot", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1619-L1636
[ "def", "sys_chroot", "(", "self", ",", "path", ")", ":", "if", "path", "not", "in", "self", ".", "current", ".", "memory", ":", "return", "-", "errno", ".", "EFAULT", "path_s", "=", "self", ".", "current", ".", "read_string", "(", "path", ")", "if", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_close
Closes a file descriptor :rtype: int :param fd: the file descriptor to close. :return: C{0} on success.
manticore/platforms/linux.py
def sys_close(self, fd): """ Closes a file descriptor :rtype: int :param fd: the file descriptor to close. :return: C{0} on success. """ if self._is_fd_open(fd): self._close(fd) else: return -errno.EBADF logger.debug(f'sys_c...
def sys_close(self, fd): """ Closes a file descriptor :rtype: int :param fd: the file descriptor to close. :return: C{0} on success. """ if self._is_fd_open(fd): self._close(fd) else: return -errno.EBADF logger.debug(f'sys_c...
[ "Closes", "a", "file", "descriptor", ":", "rtype", ":", "int", ":", "param", "fd", ":", "the", "file", "descriptor", "to", "close", ".", ":", "return", ":", "C", "{", "0", "}", "on", "success", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1638-L1650
[ "def", "sys_close", "(", "self", ",", "fd", ")", ":", "if", "self", ".", "_is_fd_open", "(", "fd", ")", ":", "self", ".", "_close", "(", "fd", ")", "else", ":", "return", "-", "errno", ".", "EBADF", "logger", ".", "debug", "(", "f'sys_close({fd})'", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_readlink
Read :rtype: int :param path: the "link path id" :param buf: the buffer where the bytes will be putted. :param bufsize: the max size for read the link. :todo: Out eax number of bytes actually sent | EAGAIN | EBADF | EFAULT | EINTR | errno.EINVAL | EIO | ENOSPC | EPIPE
manticore/platforms/linux.py
def sys_readlink(self, path, buf, bufsize): """ Read :rtype: int :param path: the "link path id" :param buf: the buffer where the bytes will be putted. :param bufsize: the max size for read the link. :todo: Out eax number of bytes actually sent | EAGAIN | EBADF |...
def sys_readlink(self, path, buf, bufsize): """ Read :rtype: int :param path: the "link path id" :param buf: the buffer where the bytes will be putted. :param bufsize: the max size for read the link. :todo: Out eax number of bytes actually sent | EAGAIN | EBADF |...
[ "Read", ":", "rtype", ":", "int" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1652-L1670
[ "def", "sys_readlink", "(", "self", ",", "path", ",", "buf", ",", "bufsize", ")", ":", "if", "bufsize", "<=", "0", ":", "return", "-", "errno", ".", "EINVAL", "filename", "=", "self", ".", "current", ".", "read_string", "(", "path", ")", "if", "filen...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_mmap_pgoff
Wrapper for mmap2
manticore/platforms/linux.py
def sys_mmap_pgoff(self, address, size, prot, flags, fd, offset): """Wrapper for mmap2""" return self.sys_mmap2(address, size, prot, flags, fd, offset)
def sys_mmap_pgoff(self, address, size, prot, flags, fd, offset): """Wrapper for mmap2""" return self.sys_mmap2(address, size, prot, flags, fd, offset)
[ "Wrapper", "for", "mmap2" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1672-L1674
[ "def", "sys_mmap_pgoff", "(", "self", ",", "address", ",", "size", ",", "prot", ",", "flags", ",", "fd", ",", "offset", ")", ":", "return", "self", ".", "sys_mmap2", "(", "address", ",", "size", ",", "prot", ",", "flags", ",", "fd", ",", "offset", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_mmap
Creates a new mapping in the virtual address space of the calling process. :rtype: int :param address: the starting address for the new mapping. This address is used as hint unless the flag contains C{MAP_FIXED}. :param size: the length of the mapping. :param pro...
manticore/platforms/linux.py
def sys_mmap(self, address, size, prot, flags, fd, offset): """ Creates a new mapping in the virtual address space of the calling process. :rtype: int :param address: the starting address for the new mapping. This address is used as hint unless the flag contains ...
def sys_mmap(self, address, size, prot, flags, fd, offset): """ Creates a new mapping in the virtual address space of the calling process. :rtype: int :param address: the starting address for the new mapping. This address is used as hint unless the flag contains ...
[ "Creates", "a", "new", "mapping", "in", "the", "virtual", "address", "space", "of", "the", "calling", "process", ".", ":", "rtype", ":", "int" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1697-L1748
[ "def", "sys_mmap", "(", "self", ",", "address", ",", "size", ",", "prot", ",", "flags", ",", "fd", ",", "offset", ")", ":", "if", "address", "==", "0", ":", "address", "=", "None", "cpu", "=", "self", ".", "current", "if", "flags", "&", "0x10", "...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_mprotect
Sets protection on a region of memory. Changes protection for the calling process's memory page(s) containing any part of the address range in the interval [C{start}, C{start}+C{size}-1]. :rtype: int :param start: the starting address to change the permissions. :param size: the size of ...
manticore/platforms/linux.py
def sys_mprotect(self, start, size, prot): """ Sets protection on a region of memory. Changes protection for the calling process's memory page(s) containing any part of the address range in the interval [C{start}, C{start}+C{size}-1]. :rtype: int :param start: the starting addre...
def sys_mprotect(self, start, size, prot): """ Sets protection on a region of memory. Changes protection for the calling process's memory page(s) containing any part of the address range in the interval [C{start}, C{start}+C{size}-1]. :rtype: int :param start: the starting addre...
[ "Sets", "protection", "on", "a", "region", "of", "memory", ".", "Changes", "protection", "for", "the", "calling", "process", "s", "memory", "page", "(", "s", ")", "containing", "any", "part", "of", "the", "address", "range", "in", "the", "interval", "[", ...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1750-L1763
[ "def", "sys_mprotect", "(", "self", ",", "start", ",", "size", ",", "prot", ")", ":", "perms", "=", "perms_from_protflags", "(", "prot", ")", "ret", "=", "self", ".", "current", ".", "memory", ".", "mprotect", "(", "start", ",", "size", ",", "perms", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_munmap
Unmaps a file from memory. It deletes the mappings for the specified address range :rtype: int :param addr: the starting address to unmap. :param size: the size of the portion to unmap. :return: C{0} on success.
manticore/platforms/linux.py
def sys_munmap(self, addr, size): """ Unmaps a file from memory. It deletes the mappings for the specified address range :rtype: int :param addr: the starting address to unmap. :param size: the size of the portion to unmap. :return: C{0} on success. """ s...
def sys_munmap(self, addr, size): """ Unmaps a file from memory. It deletes the mappings for the specified address range :rtype: int :param addr: the starting address to unmap. :param size: the size of the portion to unmap. :return: C{0} on success. """ s...
[ "Unmaps", "a", "file", "from", "memory", ".", "It", "deletes", "the", "mappings", "for", "the", "specified", "address", "range", ":", "rtype", ":", "int" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1765-L1775
[ "def", "sys_munmap", "(", "self", ",", "addr", ",", "size", ")", ":", "self", ".", "current", ".", "memory", ".", "munmap", "(", "addr", ",", "size", ")", "return", "0" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_readv
Works just like C{sys_read} except that data is read into multiple buffers. :rtype: int :param fd: the file descriptor of the file to read. :param iov: the buffer where the the bytes to read are stored. :param count: amount of C{iov} buffers to read from the file. :return: the a...
manticore/platforms/linux.py
def sys_readv(self, fd, iov, count): """ Works just like C{sys_read} except that data is read into multiple buffers. :rtype: int :param fd: the file descriptor of the file to read. :param iov: the buffer where the the bytes to read are stored. :param count: amount of C{i...
def sys_readv(self, fd, iov, count): """ Works just like C{sys_read} except that data is read into multiple buffers. :rtype: int :param fd: the file descriptor of the file to read. :param iov: the buffer where the the bytes to read are stored. :param count: amount of C{i...
[ "Works", "just", "like", "C", "{", "sys_read", "}", "except", "that", "data", "is", "read", "into", "multiple", "buffers", ".", ":", "rtype", ":", "int" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1813-L1836
[ "def", "sys_readv", "(", "self", ",", "fd", ",", "iov", ",", "count", ")", ":", "cpu", "=", "self", ".", "current", "ptrsize", "=", "cpu", ".", "address_bit_size", "sizeof_iovec", "=", "2", "*", "(", "ptrsize", "//", "8", ")", "total", "=", "0", "f...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_writev
Works just like C{sys_write} except that multiple buffers are written out. :rtype: int :param fd: the file descriptor of the file to write. :param iov: the buffer where the the bytes to write are taken. :param count: amount of C{iov} buffers to write into the file. :return: the ...
manticore/platforms/linux.py
def sys_writev(self, fd, iov, count): """ Works just like C{sys_write} except that multiple buffers are written out. :rtype: int :param fd: the file descriptor of the file to write. :param iov: the buffer where the the bytes to write are taken. :param count: amount of C{...
def sys_writev(self, fd, iov, count): """ Works just like C{sys_write} except that multiple buffers are written out. :rtype: int :param fd: the file descriptor of the file to write. :param iov: the buffer where the the bytes to write are taken. :param count: amount of C{...
[ "Works", "just", "like", "C", "{", "sys_write", "}", "except", "that", "multiple", "buffers", "are", "written", "out", ".", ":", "rtype", ":", "int" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1838-L1867
[ "def", "sys_writev", "(", "self", ",", "fd", ",", "iov", ",", "count", ")", ":", "cpu", "=", "self", ".", "current", "ptrsize", "=", "cpu", ".", "address_bit_size", "sizeof_iovec", "=", "2", "*", "(", "ptrsize", "//", "8", ")", "total", "=", "0", "...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_set_thread_area
Sets a thread local storage (TLS) area. Sets the base address of the GS segment. :rtype: int :param user_info: the TLS array entry set corresponds to the value of C{u_info->entry_number}. :return: C{0} on success.
manticore/platforms/linux.py
def sys_set_thread_area(self, user_info): """ Sets a thread local storage (TLS) area. Sets the base address of the GS segment. :rtype: int :param user_info: the TLS array entry set corresponds to the value of C{u_info->entry_number}. :return: C{0} on success. """ ...
def sys_set_thread_area(self, user_info): """ Sets a thread local storage (TLS) area. Sets the base address of the GS segment. :rtype: int :param user_info: the TLS array entry set corresponds to the value of C{u_info->entry_number}. :return: C{0} on success. """ ...
[ "Sets", "a", "thread", "local", "storage", "(", "TLS", ")", "area", ".", "Sets", "the", "base", "address", "of", "the", "GS", "segment", ".", ":", "rtype", ":", "int" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1869-L1886
[ "def", "sys_set_thread_area", "(", "self", ",", "user_info", ")", ":", "n", "=", "self", ".", "current", ".", "read_int", "(", "user_info", ",", "32", ")", "pointer", "=", "self", ".", "current", ".", "read_int", "(", "user_info", "+", "4", ",", "32", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_getrandom
The getrandom system call fills the buffer with random bytes of buflen. The source of random (/dev/random or /dev/urandom) is decided based on the flags value. Manticore's implementation simply fills a buffer with zeroes -- choosing determinism over true randomness. :param buf:...
manticore/platforms/linux.py
def sys_getrandom(self, buf, size, flags): """ The getrandom system call fills the buffer with random bytes of buflen. The source of random (/dev/random or /dev/urandom) is decided based on the flags value. Manticore's implementation simply fills a buffer with zeroes -- choosing...
def sys_getrandom(self, buf, size, flags): """ The getrandom system call fills the buffer with random bytes of buflen. The source of random (/dev/random or /dev/urandom) is decided based on the flags value. Manticore's implementation simply fills a buffer with zeroes -- choosing...
[ "The", "getrandom", "system", "call", "fills", "the", "buffer", "with", "random", "bytes", "of", "buflen", ".", "The", "source", "of", "random", "(", "/", "dev", "/", "random", "or", "/", "dev", "/", "urandom", ")", "is", "decided", "based", "on", "the...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L2090-L2120
[ "def", "sys_getrandom", "(", "self", ",", "buf", ",", "size", ",", "flags", ")", ":", "GRND_NONBLOCK", "=", "0x0001", "GRND_RANDOM", "=", "0x0002", "if", "size", "==", "0", ":", "return", "0", "if", "buf", "not", "in", "self", ".", "current", ".", "m...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.syscall
Syscall dispatcher.
manticore/platforms/linux.py
def syscall(self): """ Syscall dispatcher. """ index = self._syscall_abi.syscall_number() try: table = getattr(linux_syscalls, self.current.machine) name = table.get(index, None) implementation = getattr(self, name) except (AttributeE...
def syscall(self): """ Syscall dispatcher. """ index = self._syscall_abi.syscall_number() try: table = getattr(linux_syscalls, self.current.machine) name = table.get(index, None) implementation = getattr(self, name) except (AttributeE...
[ "Syscall", "dispatcher", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L2123-L2140
[ "def", "syscall", "(", "self", ")", ":", "index", "=", "self", ".", "_syscall_abi", ".", "syscall_number", "(", ")", "try", ":", "table", "=", "getattr", "(", "linux_syscalls", ",", "self", ".", "current", ".", "machine", ")", "name", "=", "table", "."...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sched
Yield CPU. This will choose another process from the running list and change current running process. May give the same cpu if only one running process.
manticore/platforms/linux.py
def sched(self): """ Yield CPU. This will choose another process from the running list and change current running process. May give the same cpu if only one running process. """ if len(self.procs) > 1: logger.debug("SCHED:") logger.debu...
def sched(self): """ Yield CPU. This will choose another process from the running list and change current running process. May give the same cpu if only one running process. """ if len(self.procs) > 1: logger.debug("SCHED:") logger.debu...
[ "Yield", "CPU", ".", "This", "will", "choose", "another", "process", "from", "the", "running", "list", "and", "change", "current", "running", "process", ".", "May", "give", "the", "same", "cpu", "if", "only", "one", "running", "process", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L2156-L2185
[ "def", "sched", "(", "self", ")", ":", "if", "len", "(", "self", ".", "procs", ")", ">", "1", ":", "logger", ".", "debug", "(", "\"SCHED:\"", ")", "logger", ".", "debug", "(", "f\"\\tProcess: {self.procs!r}\"", ")", "logger", ".", "debug", "(", "f\"\\t...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.wait
Wait for file descriptors or timeout. Adds the current process in the correspondent waiting list and yield the cpu to another running process.
manticore/platforms/linux.py
def wait(self, readfds, writefds, timeout): """ Wait for file descriptors or timeout. Adds the current process in the correspondent waiting list and yield the cpu to another running process. """ logger.debug("WAIT:") logger.debug(f"\tProcess {self._current} is goi...
def wait(self, readfds, writefds, timeout): """ Wait for file descriptors or timeout. Adds the current process in the correspondent waiting list and yield the cpu to another running process. """ logger.debug("WAIT:") logger.debug(f"\tProcess {self._current} is goi...
[ "Wait", "for", "file", "descriptors", "or", "timeout", ".", "Adds", "the", "current", "process", "in", "the", "correspondent", "waiting", "list", "and", "yield", "the", "cpu", "to", "another", "running", "process", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L2187-L2216
[ "def", "wait", "(", "self", ",", "readfds", ",", "writefds", ",", "timeout", ")", ":", "logger", ".", "debug", "(", "\"WAIT:\"", ")", "logger", ".", "debug", "(", "f\"\\tProcess {self._current} is going to wait for [ {readfds!r} {writefds!r} {timeout!r} ]\"", ")", "lo...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.awake
Remove procid from waitlists and reestablish it in the running list
manticore/platforms/linux.py
def awake(self, procid): """ Remove procid from waitlists and reestablish it in the running list """ logger.debug(f"Remove procid:{procid} from waitlists and reestablish it in the running list") for wait_list in self.rwait: if procid in wait_list: wait_list.remove(pro...
def awake(self, procid): """ Remove procid from waitlists and reestablish it in the running list """ logger.debug(f"Remove procid:{procid} from waitlists and reestablish it in the running list") for wait_list in self.rwait: if procid in wait_list: wait_list.remove(pro...
[ "Remove", "procid", "from", "waitlists", "and", "reestablish", "it", "in", "the", "running", "list" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L2218-L2230
[ "def", "awake", "(", "self", ",", "procid", ")", ":", "logger", ".", "debug", "(", "f\"Remove procid:{procid} from waitlists and reestablish it in the running list\"", ")", "for", "wait_list", "in", "self", ".", "rwait", ":", "if", "procid", "in", "wait_list", ":", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.signal_receive
Awake one process waiting to receive data on fd
manticore/platforms/linux.py
def signal_receive(self, fd): """ Awake one process waiting to receive data on fd """ connections = self.connections if connections(fd) and self.twait[connections(fd)]: procid = random.sample(self.twait[connections(fd)], 1)[0] self.awake(procid)
def signal_receive(self, fd): """ Awake one process waiting to receive data on fd """ connections = self.connections if connections(fd) and self.twait[connections(fd)]: procid = random.sample(self.twait[connections(fd)], 1)[0] self.awake(procid)
[ "Awake", "one", "process", "waiting", "to", "receive", "data", "on", "fd" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L2244-L2249
[ "def", "signal_receive", "(", "self", ",", "fd", ")", ":", "connections", "=", "self", ".", "connections", "if", "connections", "(", "fd", ")", "and", "self", ".", "twait", "[", "connections", "(", "fd", ")", "]", ":", "procid", "=", "random", ".", "...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.signal_transmit
Awake one process waiting to transmit data on fd
manticore/platforms/linux.py
def signal_transmit(self, fd): """ Awake one process waiting to transmit data on fd """ connection = self.connections(fd) if connection is None or connection >= len(self.rwait): return procs = self.rwait[connection] if procs: procid = random.sample(procs,...
def signal_transmit(self, fd): """ Awake one process waiting to transmit data on fd """ connection = self.connections(fd) if connection is None or connection >= len(self.rwait): return procs = self.rwait[connection] if procs: procid = random.sample(procs,...
[ "Awake", "one", "process", "waiting", "to", "transmit", "data", "on", "fd" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L2251-L2260
[ "def", "signal_transmit", "(", "self", ",", "fd", ")", ":", "connection", "=", "self", ".", "connections", "(", "fd", ")", "if", "connection", "is", "None", "or", "connection", ">=", "len", "(", "self", ".", "rwait", ")", ":", "return", "procs", "=", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.check_timers
Awake process if timer has expired
manticore/platforms/linux.py
def check_timers(self): """ Awake process if timer has expired """ if self._current is None: # Advance the clocks. Go to future!! advance = min([self.clocks] + [x for x in self.timers if x is not None]) + 1 logger.debug(f"Advancing the clock from {self.clocks} to {adv...
def check_timers(self): """ Awake process if timer has expired """ if self._current is None: # Advance the clocks. Go to future!! advance = min([self.clocks] + [x for x in self.timers if x is not None]) + 1 logger.debug(f"Advancing the clock from {self.clocks} to {adv...
[ "Awake", "process", "if", "timer", "has", "expired" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L2262-L2273
[ "def", "check_timers", "(", "self", ")", ":", "if", "self", ".", "_current", "is", "None", ":", "# Advance the clocks. Go to future!!", "advance", "=", "min", "(", "[", "self", ".", "clocks", "]", "+", "[", "x", "for", "x", "in", "self", ".", "timers", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.execute
Execute one cpu instruction in the current thread (only one supported). :rtype: bool :return: C{True} :todo: This is where we could implement a simple schedule.
manticore/platforms/linux.py
def execute(self): """ Execute one cpu instruction in the current thread (only one supported). :rtype: bool :return: C{True} :todo: This is where we could implement a simple schedule. """ try: self.current.execute() self.clocks += 1 ...
def execute(self): """ Execute one cpu instruction in the current thread (only one supported). :rtype: bool :return: C{True} :todo: This is where we could implement a simple schedule. """ try: self.current.execute() self.clocks += 1 ...
[ "Execute", "one", "cpu", "instruction", "in", "the", "current", "thread", "(", "only", "one", "supported", ")", ".", ":", "rtype", ":", "bool", ":", "return", ":", "C", "{", "True", "}" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L2275-L2297
[ "def", "execute", "(", "self", ")", ":", "try", ":", "self", ".", "current", ".", "execute", "(", ")", "self", ".", "clocks", "+=", "1", "if", "self", ".", "clocks", "%", "10000", "==", "0", ":", "self", ".", "check_timers", "(", ")", "self", "."...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux.sys_fstat64
Determines information about a file based on its file descriptor (for Linux 64 bits). :rtype: int :param fd: the file descriptor of the file that is being inquired. :param buf: a buffer where data about the file will be stored. :return: C{0} on success, EBADF when called with bad fd ...
manticore/platforms/linux.py
def sys_fstat64(self, fd, buf): """ Determines information about a file based on its file descriptor (for Linux 64 bits). :rtype: int :param fd: the file descriptor of the file that is being inquired. :param buf: a buffer where data about the file will be stored. :return:...
def sys_fstat64(self, fd, buf): """ Determines information about a file based on its file descriptor (for Linux 64 bits). :rtype: int :param fd: the file descriptor of the file that is being inquired. :param buf: a buffer where data about the file will be stored. :return:...
[ "Determines", "information", "about", "a", "file", "based", "on", "its", "file", "descriptor", "(", "for", "Linux", "64", "bits", ")", ".", ":", "rtype", ":", "int", ":", "param", "fd", ":", "the", "file", "descriptor", "of", "the", "file", "that", "is...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L2388-L2430
[ "def", "sys_fstat64", "(", "self", ",", "fd", ",", "buf", ")", ":", "try", ":", "stat", "=", "self", ".", "_get_fd", "(", "fd", ")", ".", "stat", "(", ")", "except", "FdError", "as", "e", ":", "logger", ".", "info", "(", "\"Calling fstat with invalid...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Linux._interp_total_size
Compute total load size of interpreter. :param ELFFile interp: interpreter ELF .so :return: total load size of interpreter, not aligned :rtype: int
manticore/platforms/linux.py
def _interp_total_size(interp): """ Compute total load size of interpreter. :param ELFFile interp: interpreter ELF .so :return: total load size of interpreter, not aligned :rtype: int """ load_segs = [x for x in interp.iter_segments() if x.header.p_type == 'PT_LO...
def _interp_total_size(interp): """ Compute total load size of interpreter. :param ELFFile interp: interpreter ELF .so :return: total load size of interpreter, not aligned :rtype: int """ load_segs = [x for x in interp.iter_segments() if x.header.p_type == 'PT_LO...
[ "Compute", "total", "load", "size", "of", "interpreter", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L2480-L2490
[ "def", "_interp_total_size", "(", "interp", ")", ":", "load_segs", "=", "[", "x", "for", "x", "in", "interp", ".", "iter_segments", "(", ")", "if", "x", ".", "header", ".", "p_type", "==", "'PT_LOAD'", "]", "last", "=", "load_segs", "[", "-", "1", "]...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SLinux.sys_open
A version of open(2) that includes a special case for a symbolic path. When given a symbolic path, it will create a temporary file with 64 bytes of symbolic bytes as contents and return that instead. :param buf: address of zero-terminated pathname :param flags: file access bits ...
manticore/platforms/linux.py
def sys_open(self, buf, flags, mode): """ A version of open(2) that includes a special case for a symbolic path. When given a symbolic path, it will create a temporary file with 64 bytes of symbolic bytes as contents and return that instead. :param buf: address of zero-terminate...
def sys_open(self, buf, flags, mode): """ A version of open(2) that includes a special case for a symbolic path. When given a symbolic path, it will create a temporary file with 64 bytes of symbolic bytes as contents and return that instead. :param buf: address of zero-terminate...
[ "A", "version", "of", "open", "(", "2", ")", "that", "includes", "a", "special", "case", "for", "a", "symbolic", "path", ".", "When", "given", "a", "symbolic", "path", "it", "will", "create", "a", "temporary", "file", "with", "64", "bytes", "of", "symb...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L2663-L2688
[ "def", "sys_open", "(", "self", ",", "buf", ",", "flags", ",", "mode", ")", ":", "offset", "=", "0", "symbolic_path", "=", "issymbolic", "(", "self", ".", "current", ".", "read_int", "(", "buf", ",", "8", ")", ")", "if", "symbolic_path", ":", "import...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SLinux.sys_openat
A version of openat that includes a symbolic path and symbolic directory file descriptor :param dirfd: directory file descriptor :param buf: address of zero-terminated pathname :param flags: file access bits :param mode: file permission mode
manticore/platforms/linux.py
def sys_openat(self, dirfd, buf, flags, mode): """ A version of openat that includes a symbolic path and symbolic directory file descriptor :param dirfd: directory file descriptor :param buf: address of zero-terminated pathname :param flags: file access bits :param mode:...
def sys_openat(self, dirfd, buf, flags, mode): """ A version of openat that includes a symbolic path and symbolic directory file descriptor :param dirfd: directory file descriptor :param buf: address of zero-terminated pathname :param flags: file access bits :param mode:...
[ "A", "version", "of", "openat", "that", "includes", "a", "symbolic", "path", "and", "symbolic", "directory", "file", "descriptor" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L2690-L2711
[ "def", "sys_openat", "(", "self", ",", "dirfd", ",", "buf", ",", "flags", ",", "mode", ")", ":", "if", "issymbolic", "(", "dirfd", ")", ":", "logger", ".", "debug", "(", "\"Ask to read from a symbolic directory file descriptor!!\"", ")", "# Constrain to a valid fd...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SLinux.sys_getrandom
The getrandom system call fills the buffer with random bytes of buflen. The source of random (/dev/random or /dev/urandom) is decided based on the flags value. :param buf: address of buffer to be filled with random bytes :param size: number of random bytes :param flags: source of random...
manticore/platforms/linux.py
def sys_getrandom(self, buf, size, flags): """ The getrandom system call fills the buffer with random bytes of buflen. The source of random (/dev/random or /dev/urandom) is decided based on the flags value. :param buf: address of buffer to be filled with random bytes :param size...
def sys_getrandom(self, buf, size, flags): """ The getrandom system call fills the buffer with random bytes of buflen. The source of random (/dev/random or /dev/urandom) is decided based on the flags value. :param buf: address of buffer to be filled with random bytes :param size...
[ "The", "getrandom", "system", "call", "fills", "the", "buffer", "with", "random", "bytes", "of", "buflen", ".", "The", "source", "of", "random", "(", "/", "dev", "/", "random", "or", "/", "dev", "/", "urandom", ")", "is", "decided", "based", "on", "the...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L2713-L2736
[ "def", "sys_getrandom", "(", "self", ",", "buf", ",", "size", ",", "flags", ")", ":", "if", "issymbolic", "(", "buf", ")", ":", "logger", ".", "debug", "(", "\"sys_getrandom: Asked to generate random to a symbolic buffer address\"", ")", "raise", "ConcretizeArgument...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Decree._read_string
Reads a null terminated concrete buffer form memory :todo: FIX. move to cpu or memory
manticore/platforms/decree.py
def _read_string(self, cpu, buf): """ Reads a null terminated concrete buffer form memory :todo: FIX. move to cpu or memory """ filename = "" for i in range(0, 1024): c = Operators.CHR(cpu.read_int(buf + i, 8)) if c == '\x00': break...
def _read_string(self, cpu, buf): """ Reads a null terminated concrete buffer form memory :todo: FIX. move to cpu or memory """ filename = "" for i in range(0, 1024): c = Operators.CHR(cpu.read_int(buf + i, 8)) if c == '\x00': break...
[ "Reads", "a", "null", "terminated", "concrete", "buffer", "form", "memory", ":", "todo", ":", "FIX", ".", "move", "to", "cpu", "or", "memory" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/decree.py#L224-L235
[ "def", "_read_string", "(", "self", ",", "cpu", ",", "buf", ")", ":", "filename", "=", "\"\"", "for", "i", "in", "range", "(", "0", ",", "1024", ")", ":", "c", "=", "Operators", ".", "CHR", "(", "cpu", ".", "read_int", "(", "buf", "+", "i", ","...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Decree.load
Loads a CGC-ELF program in memory and prepares the initial CPU state and the stack. :param filename: pathname of the file to be executed.
manticore/platforms/decree.py
def load(self, filename): """ Loads a CGC-ELF program in memory and prepares the initial CPU state and the stack. :param filename: pathname of the file to be executed. """ CGC_MIN_PAGE_SIZE = 4096 CGC_MIN_ALIGN = CGC_MIN_PAGE_SIZE TASK_SIZE = 0x80000000 ...
def load(self, filename): """ Loads a CGC-ELF program in memory and prepares the initial CPU state and the stack. :param filename: pathname of the file to be executed. """ CGC_MIN_PAGE_SIZE = 4096 CGC_MIN_ALIGN = CGC_MIN_PAGE_SIZE TASK_SIZE = 0x80000000 ...
[ "Loads", "a", "CGC", "-", "ELF", "program", "in", "memory", "and", "prepares", "the", "initial", "CPU", "state", "and", "the", "stack", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/decree.py#L237-L369
[ "def", "load", "(", "self", ",", "filename", ")", ":", "CGC_MIN_PAGE_SIZE", "=", "4096", "CGC_MIN_ALIGN", "=", "CGC_MIN_PAGE_SIZE", "TASK_SIZE", "=", "0x80000000", "def", "CGC_PAGESTART", "(", "_v", ")", ":", "return", "(", "(", "_v", ")", "&", "~", "(", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Decree.sys_allocate
allocate - allocate virtual memory The allocate system call creates a new allocation in the virtual address space of the calling process. The length argument specifies the length of the allocation in bytes which will be rounded up to the hardware page size. The kernel ch...
manticore/platforms/decree.py
def sys_allocate(self, cpu, length, isX, addr): """ allocate - allocate virtual memory The allocate system call creates a new allocation in the virtual address space of the calling process. The length argument specifies the length of the allocation in bytes which will be rou...
def sys_allocate(self, cpu, length, isX, addr): """ allocate - allocate virtual memory The allocate system call creates a new allocation in the virtual address space of the calling process. The length argument specifies the length of the allocation in bytes which will be rou...
[ "allocate", "-", "allocate", "virtual", "memory" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/decree.py#L401-L445
[ "def", "sys_allocate", "(", "self", ",", "cpu", ",", "length", ",", "isX", ",", "addr", ")", ":", "# TODO: check 4 bytes from addr", "if", "addr", "not", "in", "cpu", ".", "memory", ":", "logger", ".", "info", "(", "\"ALLOCATE: addr points to invalid address. Re...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Decree.sys_random
random - fill a buffer with random data The random system call populates the buffer referenced by buf with up to count bytes of random data. If count is zero, random returns 0 and optionally sets *rx_bytes to zero. If count is greater than SSIZE_MAX, the result is unspecified. ...
manticore/platforms/decree.py
def sys_random(self, cpu, buf, count, rnd_bytes): """ random - fill a buffer with random data The random system call populates the buffer referenced by buf with up to count bytes of random data. If count is zero, random returns 0 and optionally sets *rx_bytes to zero. If coun...
def sys_random(self, cpu, buf, count, rnd_bytes): """ random - fill a buffer with random data The random system call populates the buffer referenced by buf with up to count bytes of random data. If count is zero, random returns 0 and optionally sets *rx_bytes to zero. If coun...
[ "random", "-", "fill", "a", "buffer", "with", "random", "data" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/decree.py#L447-L488
[ "def", "sys_random", "(", "self", ",", "cpu", ",", "buf", ",", "count", ",", "rnd_bytes", ")", ":", "ret", "=", "0", "if", "count", "!=", "0", ":", "if", "count", ">", "Decree", ".", "CGC_SSIZE_MAX", "or", "count", "<", "0", ":", "ret", "=", "Dec...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Decree.sys_receive
receive - receive bytes from a file descriptor The receive system call reads up to count bytes from file descriptor fd to the buffer pointed to by buf. If count is zero, receive returns 0 and optionally sets *rx_bytes to zero. :param cpu: current CPU. :param...
manticore/platforms/decree.py
def sys_receive(self, cpu, fd, buf, count, rx_bytes): """ receive - receive bytes from a file descriptor The receive system call reads up to count bytes from file descriptor fd to the buffer pointed to by buf. If count is zero, receive returns 0 and optionally sets *rx_bytes...
def sys_receive(self, cpu, fd, buf, count, rx_bytes): """ receive - receive bytes from a file descriptor The receive system call reads up to count bytes from file descriptor fd to the buffer pointed to by buf. If count is zero, receive returns 0 and optionally sets *rx_bytes...
[ "receive", "-", "receive", "bytes", "from", "a", "file", "descriptor" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/decree.py#L490-L543
[ "def", "sys_receive", "(", "self", ",", "cpu", ",", "fd", ",", "buf", ",", "count", ",", "rx_bytes", ")", ":", "data", "=", "''", "if", "count", "!=", "0", ":", "if", "not", "self", ".", "_is_open", "(", "fd", ")", ":", "logger", ".", "info", "...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Decree.sys_transmit
transmit - send bytes through a file descriptor The transmit system call writes up to count bytes from the buffer pointed to by buf to the file descriptor fd. If count is zero, transmit returns 0 and optionally sets *tx_bytes to zero. :param cpu current CPU ...
manticore/platforms/decree.py
def sys_transmit(self, cpu, fd, buf, count, tx_bytes): """ transmit - send bytes through a file descriptor The transmit system call writes up to count bytes from the buffer pointed to by buf to the file descriptor fd. If count is zero, transmit returns 0 and optionally sets *tx_by...
def sys_transmit(self, cpu, fd, buf, count, tx_bytes): """ transmit - send bytes through a file descriptor The transmit system call writes up to count bytes from the buffer pointed to by buf to the file descriptor fd. If count is zero, transmit returns 0 and optionally sets *tx_by...
[ "transmit", "-", "send", "bytes", "through", "a", "file", "descriptor", "The", "transmit", "system", "call", "writes", "up", "to", "count", "bytes", "from", "the", "buffer", "pointed", "to", "by", "buf", "to", "the", "file", "descriptor", "fd", ".", "If", ...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/decree.py#L545-L596
[ "def", "sys_transmit", "(", "self", ",", "cpu", ",", "fd", ",", "buf", ",", "count", ",", "tx_bytes", ")", ":", "data", "=", "[", "]", "if", "count", "!=", "0", ":", "if", "not", "self", ".", "_is_open", "(", "fd", ")", ":", "logger", ".", "err...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Decree.sys_terminate
Exits all threads in a process :param cpu: current CPU. :raises Exception: 'Finished'
manticore/platforms/decree.py
def sys_terminate(self, cpu, error_code): """ Exits all threads in a process :param cpu: current CPU. :raises Exception: 'Finished' """ procid = self.procs.index(cpu) self.sched() self.running.remove(procid) # self.procs[procid] = None #let it ther...
def sys_terminate(self, cpu, error_code): """ Exits all threads in a process :param cpu: current CPU. :raises Exception: 'Finished' """ procid = self.procs.index(cpu) self.sched() self.running.remove(procid) # self.procs[procid] = None #let it ther...
[ "Exits", "all", "threads", "in", "a", "process", ":", "param", "cpu", ":", "current", "CPU", ".", ":", "raises", "Exception", ":", "Finished" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/decree.py#L598-L614
[ "def", "sys_terminate", "(", "self", ",", "cpu", ",", "error_code", ")", ":", "procid", "=", "self", ".", "procs", ".", "index", "(", "cpu", ")", "self", ".", "sched", "(", ")", "self", ".", "running", ".", "remove", "(", "procid", ")", "# self.procs...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Decree.sys_deallocate
deallocate - remove allocations The deallocate system call deletes the allocations for the specified address range, and causes further references to the addresses within the range to generate invalid memory accesses. The region is also automatically deallocated when the process is term...
manticore/platforms/decree.py
def sys_deallocate(self, cpu, addr, size): """ deallocate - remove allocations The deallocate system call deletes the allocations for the specified address range, and causes further references to the addresses within the range to generate invalid memory accesses. The region is also ...
def sys_deallocate(self, cpu, addr, size): """ deallocate - remove allocations The deallocate system call deletes the allocations for the specified address range, and causes further references to the addresses within the range to generate invalid memory accesses. The region is also ...
[ "deallocate", "-", "remove", "allocations", "The", "deallocate", "system", "call", "deletes", "the", "allocations", "for", "the", "specified", "address", "range", "and", "causes", "further", "references", "to", "the", "addresses", "within", "the", "range", "to", ...
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/decree.py#L616-L658
[ "def", "sys_deallocate", "(", "self", ",", "cpu", ",", "addr", ",", "size", ")", ":", "logger", ".", "info", "(", "\"DEALLOCATE(0x%08x, %d)\"", "%", "(", "addr", ",", "size", ")", ")", "if", "addr", "&", "0xfff", "!=", "0", ":", "logger", ".", "info"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Decree.sys_fdwait
fdwait - wait for file descriptors to become ready
manticore/platforms/decree.py
def sys_fdwait(self, cpu, nfds, readfds, writefds, timeout, readyfds): """ fdwait - wait for file descriptors to become ready """ logger.debug("FDWAIT(%d, 0x%08x, 0x%08x, 0x%08x, 0x%08x)" % (nfds, readfds, writefds, timeout, readyfds)) if timeout: if timeout not in cpu.memor...
def sys_fdwait(self, cpu, nfds, readfds, writefds, timeout, readyfds): """ fdwait - wait for file descriptors to become ready """ logger.debug("FDWAIT(%d, 0x%08x, 0x%08x, 0x%08x, 0x%08x)" % (nfds, readfds, writefds, timeout, readyfds)) if timeout: if timeout not in cpu.memor...
[ "fdwait", "-", "wait", "for", "file", "descriptors", "to", "become", "ready" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/decree.py#L660-L743
[ "def", "sys_fdwait", "(", "self", ",", "cpu", ",", "nfds", ",", "readfds", ",", "writefds", ",", "timeout", ",", "readyfds", ")", ":", "logger", ".", "debug", "(", "\"FDWAIT(%d, 0x%08x, 0x%08x, 0x%08x, 0x%08x)\"", "%", "(", "nfds", ",", "readfds", ",", "writ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Decree.int80
32 bit dispatcher. :param cpu: current CPU. _terminate, transmit, receive, fdwait, allocate, deallocate and random
manticore/platforms/decree.py
def int80(self, cpu): """ 32 bit dispatcher. :param cpu: current CPU. _terminate, transmit, receive, fdwait, allocate, deallocate and random """ syscalls = {0x00000001: self.sys_terminate, 0x00000002: self.sys_transmit, 0x00000003: ...
def int80(self, cpu): """ 32 bit dispatcher. :param cpu: current CPU. _terminate, transmit, receive, fdwait, allocate, deallocate and random """ syscalls = {0x00000001: self.sys_terminate, 0x00000002: self.sys_transmit, 0x00000003: ...
[ "32", "bit", "dispatcher", ".", ":", "param", "cpu", ":", "current", "CPU", ".", "_terminate", "transmit", "receive", "fdwait", "allocate", "deallocate", "and", "random" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/decree.py#L745-L765
[ "def", "int80", "(", "self", ",", "cpu", ")", ":", "syscalls", "=", "{", "0x00000001", ":", "self", ".", "sys_terminate", ",", "0x00000002", ":", "self", ".", "sys_transmit", ",", "0x00000003", ":", "self", ".", "sys_receive", ",", "0x00000004", ":", "se...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Decree.sched
Yield CPU. This will choose another process from the RUNNNIG list and change current running process. May give the same cpu if only one running process.
manticore/platforms/decree.py
def sched(self): """ Yield CPU. This will choose another process from the RUNNNIG list and change current running process. May give the same cpu if only one running process. """ if len(self.procs) > 1: logger.info("SCHED:") logger.info(...
def sched(self): """ Yield CPU. This will choose another process from the RUNNNIG list and change current running process. May give the same cpu if only one running process. """ if len(self.procs) > 1: logger.info("SCHED:") logger.info(...
[ "Yield", "CPU", ".", "This", "will", "choose", "another", "process", "from", "the", "RUNNNIG", "list", "and", "change", "current", "running", "process", ".", "May", "give", "the", "same", "cpu", "if", "only", "one", "running", "process", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/decree.py#L767-L796
[ "def", "sched", "(", "self", ")", ":", "if", "len", "(", "self", ".", "procs", ")", ">", "1", ":", "logger", ".", "info", "(", "\"SCHED:\"", ")", "logger", ".", "info", "(", "\"\\tProcess: %r\"", ",", "self", ".", "procs", ")", "logger", ".", "info...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Decree.wait
Wait for filedescriptors or timeout. Adds the current process to the corresponding waiting list and yields the cpu to another running process.
manticore/platforms/decree.py
def wait(self, readfds, writefds, timeout): """ Wait for filedescriptors or timeout. Adds the current process to the corresponding waiting list and yields the cpu to another running process. """ logger.info("WAIT:") logger.info("\tProcess %d is going to wait for [...
def wait(self, readfds, writefds, timeout): """ Wait for filedescriptors or timeout. Adds the current process to the corresponding waiting list and yields the cpu to another running process. """ logger.info("WAIT:") logger.info("\tProcess %d is going to wait for [...
[ "Wait", "for", "filedescriptors", "or", "timeout", ".", "Adds", "the", "current", "process", "to", "the", "corresponding", "waiting", "list", "and", "yields", "the", "cpu", "to", "another", "running", "process", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/decree.py#L798-L831
[ "def", "wait", "(", "self", ",", "readfds", ",", "writefds", ",", "timeout", ")", ":", "logger", ".", "info", "(", "\"WAIT:\"", ")", "logger", ".", "info", "(", "\"\\tProcess %d is going to wait for [ %r %r %r ]\"", ",", "self", ".", "_current", ",", "readfds"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Decree.signal_transmit
Awake one process waiting to transmit data on fd
manticore/platforms/decree.py
def signal_transmit(self, fd): """ Awake one process waiting to transmit data on fd """ connections = self.connections if connections(fd) and self.rwait[connections(fd)]: procid = random.sample(self.rwait[connections(fd)], 1)[0] self.awake(procid)
def signal_transmit(self, fd): """ Awake one process waiting to transmit data on fd """ connections = self.connections if connections(fd) and self.rwait[connections(fd)]: procid = random.sample(self.rwait[connections(fd)], 1)[0] self.awake(procid)
[ "Awake", "one", "process", "waiting", "to", "transmit", "data", "on", "fd" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/decree.py#L862-L867
[ "def", "signal_transmit", "(", "self", ",", "fd", ")", ":", "connections", "=", "self", ".", "connections", "if", "connections", "(", "fd", ")", "and", "self", ".", "rwait", "[", "connections", "(", "fd", ")", "]", ":", "procid", "=", "random", ".", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Decree.execute
Execute one cpu instruction in the current thread (only one supported). :rtype: bool :return: C{True} :todo: This is where we could implement a simple schedule.
manticore/platforms/decree.py
def execute(self): """ Execute one cpu instruction in the current thread (only one supported). :rtype: bool :return: C{True} :todo: This is where we could implement a simple schedule. """ try: self.current.execute() self.clocks += 1 ...
def execute(self): """ Execute one cpu instruction in the current thread (only one supported). :rtype: bool :return: C{True} :todo: This is where we could implement a simple schedule. """ try: self.current.execute() self.clocks += 1 ...
[ "Execute", "one", "cpu", "instruction", "in", "the", "current", "thread", "(", "only", "one", "supported", ")", ".", ":", "rtype", ":", "bool", ":", "return", ":", "C", "{", "True", "}" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/decree.py#L882-L904
[ "def", "execute", "(", "self", ")", ":", "try", ":", "self", ".", "current", ".", "execute", "(", ")", "self", ".", "clocks", "+=", "1", "if", "self", ".", "clocks", "%", "10000", "==", "0", ":", "self", ".", "check_timers", "(", ")", "self", "."...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SDecree.sys_receive
Symbolic version of Decree.sys_receive
manticore/platforms/decree.py
def sys_receive(self, cpu, fd, buf, count, rx_bytes): """ Symbolic version of Decree.sys_receive """ if issymbolic(fd): logger.info("Ask to read from a symbolic file descriptor!!") cpu.PC = cpu.PC - cpu.instruction.size raise SymbolicSyscallArgument(cp...
def sys_receive(self, cpu, fd, buf, count, rx_bytes): """ Symbolic version of Decree.sys_receive """ if issymbolic(fd): logger.info("Ask to read from a symbolic file descriptor!!") cpu.PC = cpu.PC - cpu.instruction.size raise SymbolicSyscallArgument(cp...
[ "Symbolic", "version", "of", "Decree", ".", "sys_receive" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/decree.py#L951-L975
[ "def", "sys_receive", "(", "self", ",", "cpu", ",", "fd", ",", "buf", ",", "count", ",", "rx_bytes", ")", ":", "if", "issymbolic", "(", "fd", ")", ":", "logger", ".", "info", "(", "\"Ask to read from a symbolic file descriptor!!\"", ")", "cpu", ".", "PC", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
SDecree.sys_transmit
Symbolic version of Decree.sys_transmit
manticore/platforms/decree.py
def sys_transmit(self, cpu, fd, buf, count, tx_bytes): """ Symbolic version of Decree.sys_transmit """ if issymbolic(fd): logger.info("Ask to write to a symbolic file descriptor!!") cpu.PC = cpu.PC - cpu.instruction.size raise SymbolicSyscallArgument(c...
def sys_transmit(self, cpu, fd, buf, count, tx_bytes): """ Symbolic version of Decree.sys_transmit """ if issymbolic(fd): logger.info("Ask to write to a symbolic file descriptor!!") cpu.PC = cpu.PC - cpu.instruction.size raise SymbolicSyscallArgument(c...
[ "Symbolic", "version", "of", "Decree", ".", "sys_transmit" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/decree.py#L977-L1001
[ "def", "sys_transmit", "(", "self", ",", "cpu", ",", "fd", ",", "buf", ",", "count", ",", "tx_bytes", ")", ":", "if", "issymbolic", "(", "fd", ")", ":", "logger", ".", "info", "(", "\"Ask to write to a symbolic file descriptor!!\"", ")", "cpu", ".", "PC", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
sync
Synchronization decorator.
manticore/core/workspace.py
def sync(f): """ Synchronization decorator. """ def new_function(self, *args, **kw): self._lock.acquire() try: return f(self, *args, **kw) finally: self._lock.release() return new_function
def sync(f): """ Synchronization decorator. """ def new_function(self, *args, **kw): self._lock.acquire() try: return f(self, *args, **kw) finally: self._lock.release() return new_function
[ "Synchronization", "decorator", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L322-L331
[ "def", "sync", "(", "f", ")", ":", "def", "new_function", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "self", ".", "_lock", ".", "acquire", "(", ")", "try", ":", "return", "f", "(", "self", ",", "*", "args", ",", "*", "*", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Store.fromdescriptor
Create a :class:`~manticore.core.workspace.Store` instance depending on the descriptor. Valid descriptors: * fs:<path> * redis:<hostname>:<port> * mem: :param str desc: Store descriptor :return: Store instance
manticore/core/workspace.py
def fromdescriptor(cls, desc): """ Create a :class:`~manticore.core.workspace.Store` instance depending on the descriptor. Valid descriptors: * fs:<path> * redis:<hostname>:<port> * mem: :param str desc: Store descriptor :return: Store instance ...
def fromdescriptor(cls, desc): """ Create a :class:`~manticore.core.workspace.Store` instance depending on the descriptor. Valid descriptors: * fs:<path> * redis:<hostname>:<port> * mem: :param str desc: Store descriptor :return: Store instance ...
[ "Create", "a", ":", "class", ":", "~manticore", ".", "core", ".", "workspace", ".", "Store", "instance", "depending", "on", "the", "descriptor", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L66-L82
[ "def", "fromdescriptor", "(", "cls", ",", "desc", ")", ":", "type_", ",", "uri", "=", "(", "'fs'", ",", "None", ")", "if", "desc", "is", "None", "else", "desc", ".", "split", "(", "':'", ",", "1", ")", "for", "subclass", "in", "cls", ".", "__subc...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Store.save_value
Save an arbitrary, serializable `value` under `key`. :param str key: A string identifier under which to store the value. :param value: A serializable value :return:
manticore/core/workspace.py
def save_value(self, key, value): """ Save an arbitrary, serializable `value` under `key`. :param str key: A string identifier under which to store the value. :param value: A serializable value :return: """ with self.save_stream(key) as s: s.write(val...
def save_value(self, key, value): """ Save an arbitrary, serializable `value` under `key`. :param str key: A string identifier under which to store the value. :param value: A serializable value :return: """ with self.save_stream(key) as s: s.write(val...
[ "Save", "an", "arbitrary", "serializable", "value", "under", "key", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L97-L106
[ "def", "save_value", "(", "self", ",", "key", ",", "value", ")", ":", "with", "self", ".", "save_stream", "(", "key", ")", "as", "s", ":", "s", ".", "write", "(", "value", ")" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Store.load_value
Load an arbitrary value identified by `key`. :param str key: The key that identifies the value :return: The loaded value
manticore/core/workspace.py
def load_value(self, key, binary=False): """ Load an arbitrary value identified by `key`. :param str key: The key that identifies the value :return: The loaded value """ with self.load_stream(key, binary=binary) as s: return s.read()
def load_value(self, key, binary=False): """ Load an arbitrary value identified by `key`. :param str key: The key that identifies the value :return: The loaded value """ with self.load_stream(key, binary=binary) as s: return s.read()
[ "Load", "an", "arbitrary", "value", "identified", "by", "key", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L108-L116
[ "def", "load_value", "(", "self", ",", "key", ",", "binary", "=", "False", ")", ":", "with", "self", ".", "load_stream", "(", "key", ",", "binary", "=", "binary", ")", "as", "s", ":", "return", "s", ".", "read", "(", ")" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Store.save_stream
Return a managed file-like object into which the calling code can write arbitrary data. :param key: :return: A managed stream-like object
manticore/core/workspace.py
def save_stream(self, key, binary=False): """ Return a managed file-like object into which the calling code can write arbitrary data. :param key: :return: A managed stream-like object """ s = io.BytesIO() if binary else io.StringIO() yield s self....
def save_stream(self, key, binary=False): """ Return a managed file-like object into which the calling code can write arbitrary data. :param key: :return: A managed stream-like object """ s = io.BytesIO() if binary else io.StringIO() yield s self....
[ "Return", "a", "managed", "file", "-", "like", "object", "into", "which", "the", "calling", "code", "can", "write", "arbitrary", "data", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L119-L129
[ "def", "save_stream", "(", "self", ",", "key", ",", "binary", "=", "False", ")", ":", "s", "=", "io", ".", "BytesIO", "(", ")", "if", "binary", "else", "io", ".", "StringIO", "(", ")", "yield", "s", "self", ".", "save_value", "(", "key", ",", "s"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Store.load_stream
Return a managed file-like object from which the calling code can read previously-serialized data. :param key: :return: A managed stream-like object
manticore/core/workspace.py
def load_stream(self, key, binary=False): """ Return a managed file-like object from which the calling code can read previously-serialized data. :param key: :return: A managed stream-like object """ value = self.load_value(key, binary=binary) yield io.Byt...
def load_stream(self, key, binary=False): """ Return a managed file-like object from which the calling code can read previously-serialized data. :param key: :return: A managed stream-like object """ value = self.load_value(key, binary=binary) yield io.Byt...
[ "Return", "a", "managed", "file", "-", "like", "object", "from", "which", "the", "calling", "code", "can", "read", "previously", "-", "serialized", "data", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L132-L141
[ "def", "load_stream", "(", "self", ",", "key", ",", "binary", "=", "False", ")", ":", "value", "=", "self", ".", "load_value", "(", "key", ",", "binary", "=", "binary", ")", "yield", "io", ".", "BytesIO", "(", "value", ")", "if", "binary", "else", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Store.save_state
Save a state to storage. :param manticore.core.StateBase state: :param str key: :return:
manticore/core/workspace.py
def save_state(self, state, key): """ Save a state to storage. :param manticore.core.StateBase state: :param str key: :return: """ with self.save_stream(key, binary=True) as f: self._serializer.serialize(state, f)
def save_state(self, state, key): """ Save a state to storage. :param manticore.core.StateBase state: :param str key: :return: """ with self.save_stream(key, binary=True) as f: self._serializer.serialize(state, f)
[ "Save", "a", "state", "to", "storage", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L143-L152
[ "def", "save_state", "(", "self", ",", "state", ",", "key", ")", ":", "with", "self", ".", "save_stream", "(", "key", ",", "binary", "=", "True", ")", "as", "f", ":", "self", ".", "_serializer", ".", "serialize", "(", "state", ",", "f", ")" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Store.load_state
Load a state from storage. :param key: key that identifies state :rtype: manticore.core.StateBase
manticore/core/workspace.py
def load_state(self, key, delete=True): """ Load a state from storage. :param key: key that identifies state :rtype: manticore.core.StateBase """ with self.load_stream(key, binary=True) as f: state = self._serializer.deserialize(f) if delete: ...
def load_state(self, key, delete=True): """ Load a state from storage. :param key: key that identifies state :rtype: manticore.core.StateBase """ with self.load_stream(key, binary=True) as f: state = self._serializer.deserialize(f) if delete: ...
[ "Load", "a", "state", "from", "storage", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L154-L165
[ "def", "load_state", "(", "self", ",", "key", ",", "delete", "=", "True", ")", ":", "with", "self", ".", "load_stream", "(", "key", ",", "binary", "=", "True", ")", "as", "f", ":", "state", "=", "self", ".", "_serializer", ".", "deserialize", "(", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
FilesystemStore.save_stream
Yield a file object representing `key` :param str key: The file to save to :param bool binary: Whether we should treat it as binary :return:
manticore/core/workspace.py
def save_stream(self, key, binary=False): """ Yield a file object representing `key` :param str key: The file to save to :param bool binary: Whether we should treat it as binary :return: """ mode = 'wb' if binary else 'w' with open(os.path.join(self.uri, ...
def save_stream(self, key, binary=False): """ Yield a file object representing `key` :param str key: The file to save to :param bool binary: Whether we should treat it as binary :return: """ mode = 'wb' if binary else 'w' with open(os.path.join(self.uri, ...
[ "Yield", "a", "file", "object", "representing", "key" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L205-L215
[ "def", "save_stream", "(", "self", ",", "key", ",", "binary", "=", "False", ")", ":", "mode", "=", "'wb'", "if", "binary", "else", "'w'", "with", "open", "(", "os", ".", "path", ".", "join", "(", "self", ".", "uri", ",", "key", ")", ",", "mode", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
FilesystemStore.load_stream
:param str key: name of stream to load :param bool binary: Whether we should treat it as binary :return:
manticore/core/workspace.py
def load_stream(self, key, binary=False): """ :param str key: name of stream to load :param bool binary: Whether we should treat it as binary :return: """ with open(os.path.join(self.uri, key), 'rb' if binary else 'r') as f: yield f
def load_stream(self, key, binary=False): """ :param str key: name of stream to load :param bool binary: Whether we should treat it as binary :return: """ with open(os.path.join(self.uri, key), 'rb' if binary else 'r') as f: yield f
[ ":", "param", "str", "key", ":", "name", "of", "stream", "to", "load", ":", "param", "bool", "binary", ":", "Whether", "we", "should", "treat", "it", "as", "binary", ":", "return", ":" ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L218-L225
[ "def", "load_stream", "(", "self", ",", "key", ",", "binary", "=", "False", ")", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "self", ".", "uri", ",", "key", ")", ",", "'rb'", "if", "binary", "else", "'r'", ")", "as", "f", ":"...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
FilesystemStore.rm
Remove file identified by `key`. :param str key: The file to delete
manticore/core/workspace.py
def rm(self, key): """ Remove file identified by `key`. :param str key: The file to delete """ path = os.path.join(self.uri, key) os.remove(path)
def rm(self, key): """ Remove file identified by `key`. :param str key: The file to delete """ path = os.path.join(self.uri, key) os.remove(path)
[ "Remove", "file", "identified", "by", "key", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L227-L234
[ "def", "rm", "(", "self", ",", "key", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "uri", ",", "key", ")", "os", ".", "remove", "(", "path", ")" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
FilesystemStore.ls
Return just the filenames that match `glob_str` inside the store directory. :param str glob_str: A glob string, i.e. 'state_*' :return: list of matched keys
manticore/core/workspace.py
def ls(self, glob_str): """ Return just the filenames that match `glob_str` inside the store directory. :param str glob_str: A glob string, i.e. 'state_*' :return: list of matched keys """ path = os.path.join(self.uri, glob_str) return [os.path.split(s)[1] for s ...
def ls(self, glob_str): """ Return just the filenames that match `glob_str` inside the store directory. :param str glob_str: A glob string, i.e. 'state_*' :return: list of matched keys """ path = os.path.join(self.uri, glob_str) return [os.path.split(s)[1] for s ...
[ "Return", "just", "the", "filenames", "that", "match", "glob_str", "inside", "the", "store", "directory", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L236-L244
[ "def", "ls", "(", "self", ",", "glob_str", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "uri", ",", "glob_str", ")", "return", "[", "os", ".", "path", ".", "split", "(", "s", ")", "[", "1", "]", "for", "s", "in", ...
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Workspace._get_id
Get a unique state id. :rtype: int
manticore/core/workspace.py
def _get_id(self): """ Get a unique state id. :rtype: int """ id_ = self._last_id.value self._last_id.value += 1 return id_
def _get_id(self): """ Get a unique state id. :rtype: int """ id_ = self._last_id.value self._last_id.value += 1 return id_
[ "Get", "a", "unique", "state", "id", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L366-L374
[ "def", "_get_id", "(", "self", ")", ":", "id_", "=", "self", ".", "_last_id", ".", "value", "self", ".", "_last_id", ".", "value", "+=", "1", "return", "id_" ]
54c5a15b1119c523ae54c09972413e8b97f11629
valid
Workspace.load_state
Load a state from storage identified by `state_id`. :param state_id: The state reference of what to load :return: The deserialized state :rtype: State
manticore/core/workspace.py
def load_state(self, state_id, delete=True): """ Load a state from storage identified by `state_id`. :param state_id: The state reference of what to load :return: The deserialized state :rtype: State """ return self._store.load_state(f'{self._prefix}{state_id:08x...
def load_state(self, state_id, delete=True): """ Load a state from storage identified by `state_id`. :param state_id: The state reference of what to load :return: The deserialized state :rtype: State """ return self._store.load_state(f'{self._prefix}{state_id:08x...
[ "Load", "a", "state", "from", "storage", "identified", "by", "state_id", "." ]
trailofbits/manticore
python
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/workspace.py#L376-L384
[ "def", "load_state", "(", "self", ",", "state_id", ",", "delete", "=", "True", ")", ":", "return", "self", ".", "_store", ".", "load_state", "(", "f'{self._prefix}{state_id:08x}{self._suffix}'", ",", "delete", "=", "delete", ")" ]
54c5a15b1119c523ae54c09972413e8b97f11629