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
train
Provider.image_url
Returns URL to placeholder image Example: http://placehold.it/640x480
faker/providers/internet/__init__.py
def image_url(self, width=None, height=None): """ Returns URL to placeholder image Example: http://placehold.it/640x480 """ width_ = width or self.random_int(max=1024) height_ = height or self.random_int(max=1024) placeholder_url = self.random_element(self.image_p...
def image_url(self, width=None, height=None): """ Returns URL to placeholder image Example: http://placehold.it/640x480 """ width_ = width or self.random_int(max=1024) height_ = height or self.random_int(max=1024) placeholder_url = self.random_element(self.image_p...
[ "Returns", "URL", "to", "placeholder", "image", "Example", ":", "http", ":", "//", "placehold", ".", "it", "/", "640x480" ]
joke2k/faker
python
https://github.com/joke2k/faker/blob/965824b61132e52d92d1a6ce470396dbbe01c96c/faker/providers/internet/__init__.py#L453-L461
[ "def", "image_url", "(", "self", ",", "width", "=", "None", ",", "height", "=", "None", ")", ":", "width_", "=", "width", "or", "self", ".", "random_int", "(", "max", "=", "1024", ")", "height_", "=", "height", "or", "self", ".", "random_int", "(", ...
965824b61132e52d92d1a6ce470396dbbe01c96c
train
Generator.seed_instance
Calls random.seed
faker/generator.py
def seed_instance(self, seed=None): """Calls random.seed""" if self.__random == random: # create per-instance random obj when first time seed_instance() is # called self.__random = random_module.Random() self.__random.seed(seed) return self
def seed_instance(self, seed=None): """Calls random.seed""" if self.__random == random: # create per-instance random obj when first time seed_instance() is # called self.__random = random_module.Random() self.__random.seed(seed) return self
[ "Calls", "random", ".", "seed" ]
joke2k/faker
python
https://github.com/joke2k/faker/blob/965824b61132e52d92d1a6ce470396dbbe01c96c/faker/generator.py#L61-L68
[ "def", "seed_instance", "(", "self", ",", "seed", "=", "None", ")", ":", "if", "self", ".", "__random", "==", "random", ":", "# create per-instance random obj when first time seed_instance() is", "# called", "self", ".", "__random", "=", "random_module", ".", "Rando...
965824b61132e52d92d1a6ce470396dbbe01c96c
train
Generator.format
This is a secure way to make a fake from another Provider.
faker/generator.py
def format(self, formatter, *args, **kwargs): """ This is a secure way to make a fake from another Provider. """ # TODO: data export? return self.get_formatter(formatter)(*args, **kwargs)
def format(self, formatter, *args, **kwargs): """ This is a secure way to make a fake from another Provider. """ # TODO: data export? return self.get_formatter(formatter)(*args, **kwargs)
[ "This", "is", "a", "secure", "way", "to", "make", "a", "fake", "from", "another", "Provider", "." ]
joke2k/faker
python
https://github.com/joke2k/faker/blob/965824b61132e52d92d1a6ce470396dbbe01c96c/faker/generator.py#L74-L79
[ "def", "format", "(", "self", ",", "formatter", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# TODO: data export?", "return", "self", ".", "get_formatter", "(", "formatter", ")", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
965824b61132e52d92d1a6ce470396dbbe01c96c
train
SimSlicer._alias_analysis
Perform a forward execution and perform alias analysis. Note that this analysis is fast, light-weight, and by no means complete. For instance, most arithmetic operations are not supported. - Depending on user settings, stack pointer and stack base pointer will be mocked and propagated to individual ...
angr/slicer.py
def _alias_analysis(self, mock_sp=True, mock_bp=True): """ Perform a forward execution and perform alias analysis. Note that this analysis is fast, light-weight, and by no means complete. For instance, most arithmetic operations are not supported. - Depending on user settings, stack poi...
def _alias_analysis(self, mock_sp=True, mock_bp=True): """ Perform a forward execution and perform alias analysis. Note that this analysis is fast, light-weight, and by no means complete. For instance, most arithmetic operations are not supported. - Depending on user settings, stack poi...
[ "Perform", "a", "forward", "execution", "and", "perform", "alias", "analysis", ".", "Note", "that", "this", "analysis", "is", "fast", "light", "-", "weight", "and", "by", "no", "means", "complete", ".", "For", "instance", "most", "arithmetic", "operations", ...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/slicer.py#L56-L82
[ "def", "_alias_analysis", "(", "self", ",", "mock_sp", "=", "True", ",", "mock_bp", "=", "True", ")", ":", "state", "=", "SimLightState", "(", "regs", "=", "{", "self", ".", "_arch", ".", "sp_offset", ":", "self", ".", "_arch", ".", "initial_sp", ",", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSlicer._slice
Slice it!
angr/slicer.py
def _slice(self): """ Slice it! """ regs = set(self._target_regs) tmps = set(self._target_tmps) stack_offsets = set(self._target_stack_offsets) state = SimLightState(regs=regs, temps=tmps, stack_offsets=stack_offsets) for stmt_idx, stmt in reversed(list...
def _slice(self): """ Slice it! """ regs = set(self._target_regs) tmps = set(self._target_tmps) stack_offsets = set(self._target_stack_offsets) state = SimLightState(regs=regs, temps=tmps, stack_offsets=stack_offsets) for stmt_idx, stmt in reversed(list...
[ "Slice", "it!" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/slicer.py#L176-L199
[ "def", "_slice", "(", "self", ")", ":", "regs", "=", "set", "(", "self", ".", "_target_regs", ")", "tmps", "=", "set", "(", "self", ".", "_target_tmps", ")", "stack_offsets", "=", "set", "(", "self", ".", "_target_stack_offsets", ")", "state", "=", "Si...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimLinux.prepare_function_symbol
Prepare the address space with the data necessary to perform relocations pointing to the given symbol. Returns a 2-tuple. The first item is the address of the function code, the second is the address of the relocation target.
angr/simos/linux.py
def prepare_function_symbol(self, symbol_name, basic_addr=None): """ Prepare the address space with the data necessary to perform relocations pointing to the given symbol. Returns a 2-tuple. The first item is the address of the function code, the second is the address of the relocation ...
def prepare_function_symbol(self, symbol_name, basic_addr=None): """ Prepare the address space with the data necessary to perform relocations pointing to the given symbol. Returns a 2-tuple. The first item is the address of the function code, the second is the address of the relocation ...
[ "Prepare", "the", "address", "space", "with", "the", "data", "necessary", "to", "perform", "relocations", "pointing", "to", "the", "given", "symbol", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/linux.py#L326-L346
[ "def", "prepare_function_symbol", "(", "self", ",", "symbol_name", ",", "basic_addr", "=", "None", ")", ":", "if", "self", ".", "project", ".", "loader", ".", "main_object", ".", "is_ppc64_abiv1", ":", "if", "basic_addr", "is", "not", "None", ":", "pointer",...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimLinux.initialize_segment_register_x64
Set the fs register in the angr to the value of the fs register in the concrete process :param state: state which will be modified :param concrete_target: concrete target that will be used to read the fs register :return: None
angr/simos/linux.py
def initialize_segment_register_x64(self, state, concrete_target): """ Set the fs register in the angr to the value of the fs register in the concrete process :param state: state which will be modified :param concrete_target: concrete target that will be used to read t...
def initialize_segment_register_x64(self, state, concrete_target): """ Set the fs register in the angr to the value of the fs register in the concrete process :param state: state which will be modified :param concrete_target: concrete target that will be used to read t...
[ "Set", "the", "fs", "register", "in", "the", "angr", "to", "the", "value", "of", "the", "fs", "register", "in", "the", "concrete", "process" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/linux.py#L348-L357
[ "def", "initialize_segment_register_x64", "(", "self", ",", "state", ",", "concrete_target", ")", ":", "_l", ".", "debug", "(", "\"Synchronizing fs segment register\"", ")", "state", ".", "regs", ".", "fs", "=", "self", ".", "_read_fs_register_x64", "(", "concrete...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimLinux.initialize_gdt_x86
Create a GDT in the state memory and populate the segment registers. Rehook the vsyscall address using the real value in the concrete process memory :param state: state which will be modified :param concrete_target: concrete target that will be used to read the fs register ...
angr/simos/linux.py
def initialize_gdt_x86(self,state,concrete_target): """ Create a GDT in the state memory and populate the segment registers. Rehook the vsyscall address using the real value in the concrete process memory :param state: state which will be modified :param concrete_t...
def initialize_gdt_x86(self,state,concrete_target): """ Create a GDT in the state memory and populate the segment registers. Rehook the vsyscall address using the real value in the concrete process memory :param state: state which will be modified :param concrete_t...
[ "Create", "a", "GDT", "in", "the", "state", "memory", "and", "populate", "the", "segment", "registers", ".", "Rehook", "the", "vsyscall", "address", "using", "the", "real", "value", "in", "the", "concrete", "process", "memory" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/linux.py#L359-L378
[ "def", "initialize_gdt_x86", "(", "self", ",", "state", ",", "concrete_target", ")", ":", "_l", ".", "debug", "(", "\"Creating fake Global Descriptor Table and synchronizing gs segment register\"", ")", "gs", "=", "self", ".", "_read_gs_register_x86", "(", "concrete_targe...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
CFGNode.merge
Merges this node with the other, returning a new node that spans the both.
angr/knowledge_plugins/cfg/cfg_node.py
def merge(self, other): """ Merges this node with the other, returning a new node that spans the both. """ new_node = self.copy() new_node.size += other.size new_node.instruction_addrs += other.instruction_addrs # FIXME: byte_string should never be none, but it is...
def merge(self, other): """ Merges this node with the other, returning a new node that spans the both. """ new_node = self.copy() new_node.size += other.size new_node.instruction_addrs += other.instruction_addrs # FIXME: byte_string should never be none, but it is...
[ "Merges", "this", "node", "with", "the", "other", "returning", "a", "new", "node", "that", "spans", "the", "both", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/cfg/cfg_node.py#L246-L259
[ "def", "merge", "(", "self", ",", "other", ")", ":", "new_node", "=", "self", ".", "copy", "(", ")", "new_node", ".", "size", "+=", "other", ".", "size", "new_node", ".", "instruction_addrs", "+=", "other", ".", "instruction_addrs", "# FIXME: byte_string sho...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSootExpr_NewArray.new_array
Allocates a new array in memory and returns the reference to the base.
angr/engines/soot/expressions/newArray.py
def new_array(state, element_type, size): """ Allocates a new array in memory and returns the reference to the base. """ size_bounded = SimSootExpr_NewArray._bound_array_size(state, size) # return the reference of the array base # => elements getting lazy initialized in t...
def new_array(state, element_type, size): """ Allocates a new array in memory and returns the reference to the base. """ size_bounded = SimSootExpr_NewArray._bound_array_size(state, size) # return the reference of the array base # => elements getting lazy initialized in t...
[ "Allocates", "a", "new", "array", "in", "memory", "and", "returns", "the", "reference", "to", "the", "base", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/soot/expressions/newArray.py#L17-L26
[ "def", "new_array", "(", "state", ",", "element_type", ",", "size", ")", ":", "size_bounded", "=", "SimSootExpr_NewArray", ".", "_bound_array_size", "(", "state", ",", "size", ")", "# return the reference of the array base", "# => elements getting lazy initialized in the ja...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Structurer._convert_claripy_bool_ast
Convert recovered reaching conditions from claripy ASTs to ailment Expressions :return: None
angr/analyses/decompiler/structurer.py
def _convert_claripy_bool_ast(self, cond): """ Convert recovered reaching conditions from claripy ASTs to ailment Expressions :return: None """ if isinstance(cond, ailment.Expr.Expression): return cond if cond.op == "BoolS" and claripy.is_true(cond): ...
def _convert_claripy_bool_ast(self, cond): """ Convert recovered reaching conditions from claripy ASTs to ailment Expressions :return: None """ if isinstance(cond, ailment.Expr.Expression): return cond if cond.op == "BoolS" and claripy.is_true(cond): ...
[ "Convert", "recovered", "reaching", "conditions", "from", "claripy", "ASTs", "to", "ailment", "Expressions" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/decompiler/structurer.py#L552-L606
[ "def", "_convert_claripy_bool_ast", "(", "self", ",", "cond", ")", ":", "if", "isinstance", "(", "cond", ",", "ailment", ".", "Expr", ".", "Expression", ")", ":", "return", "cond", "if", "cond", ".", "op", "==", "\"BoolS\"", "and", "claripy", ".", "is_tr...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Structurer._extract_jump_targets
Extract goto targets from a Jump or a ConditionalJump statement. :param stmt: The statement to analyze. :return: A list of known concrete jump targets. :rtype: list
angr/analyses/decompiler/structurer.py
def _extract_jump_targets(stmt): """ Extract goto targets from a Jump or a ConditionalJump statement. :param stmt: The statement to analyze. :return: A list of known concrete jump targets. :rtype: list """ targets = [ ] # FIXME: We are...
def _extract_jump_targets(stmt): """ Extract goto targets from a Jump or a ConditionalJump statement. :param stmt: The statement to analyze. :return: A list of known concrete jump targets. :rtype: list """ targets = [ ] # FIXME: We are...
[ "Extract", "goto", "targets", "from", "a", "Jump", "or", "a", "ConditionalJump", "statement", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/decompiler/structurer.py#L838-L857
[ "def", "_extract_jump_targets", "(", "stmt", ")", ":", "targets", "=", "[", "]", "# FIXME: We are assuming all jump targets are concrete targets. They may not be.", "if", "isinstance", "(", "stmt", ",", "ailment", ".", "Stmt", ".", "Jump", ")", ":", "targets", ".", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimHeapLibc.malloc
A somewhat faithful implementation of libc `malloc`. :param sim_size: the amount of memory (in bytes) to be allocated :returns: the address of the allocation, or a NULL pointer if the allocation failed
angr/state_plugins/heap/heap_libc.py
def malloc(self, sim_size): """ A somewhat faithful implementation of libc `malloc`. :param sim_size: the amount of memory (in bytes) to be allocated :returns: the address of the allocation, or a NULL pointer if the allocation failed """ raise NotImplementedError(...
def malloc(self, sim_size): """ A somewhat faithful implementation of libc `malloc`. :param sim_size: the amount of memory (in bytes) to be allocated :returns: the address of the allocation, or a NULL pointer if the allocation failed """ raise NotImplementedError(...
[ "A", "somewhat", "faithful", "implementation", "of", "libc", "malloc", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_libc.py#L8-L16
[ "def", "malloc", "(", "self", ",", "sim_size", ")", ":", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "malloc", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__name__", ")", ")" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimHeapLibc.free
A somewhat faithful implementation of libc `free`. :param ptr: the location in memory to be freed
angr/state_plugins/heap/heap_libc.py
def free(self, ptr): #pylint:disable=unused-argument """ A somewhat faithful implementation of libc `free`. :param ptr: the location in memory to be freed """ raise NotImplementedError("%s not implemented for %s" % (self.free.__func__.__name__, ...
def free(self, ptr): #pylint:disable=unused-argument """ A somewhat faithful implementation of libc `free`. :param ptr: the location in memory to be freed """ raise NotImplementedError("%s not implemented for %s" % (self.free.__func__.__name__, ...
[ "A", "somewhat", "faithful", "implementation", "of", "libc", "free", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_libc.py#L18-L25
[ "def", "free", "(", "self", ",", "ptr", ")", ":", "#pylint:disable=unused-argument", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "free", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__nam...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimHeapLibc.calloc
A somewhat faithful implementation of libc `calloc`. :param sim_nmemb: the number of elements to allocated :param sim_size: the size of each element (in bytes) :returns: the address of the allocation, or a NULL pointer if the allocation failed
angr/state_plugins/heap/heap_libc.py
def calloc(self, sim_nmemb, sim_size): """ A somewhat faithful implementation of libc `calloc`. :param sim_nmemb: the number of elements to allocated :param sim_size: the size of each element (in bytes) :returns: the address of the allocation, or a NULL pointer if the a...
def calloc(self, sim_nmemb, sim_size): """ A somewhat faithful implementation of libc `calloc`. :param sim_nmemb: the number of elements to allocated :param sim_size: the size of each element (in bytes) :returns: the address of the allocation, or a NULL pointer if the a...
[ "A", "somewhat", "faithful", "implementation", "of", "libc", "calloc", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_libc.py#L27-L36
[ "def", "calloc", "(", "self", ",", "sim_nmemb", ",", "sim_size", ")", ":", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "calloc", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__name__", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimHeapLibc.realloc
A somewhat faithful implementation of libc `realloc`. :param ptr: the location in memory to be reallocated :param size: the new size desired for the allocation :returns: the address of the allocation, or a NULL pointer if the allocation was freed or if no new allocation ...
angr/state_plugins/heap/heap_libc.py
def realloc(self, ptr, size): """ A somewhat faithful implementation of libc `realloc`. :param ptr: the location in memory to be reallocated :param size: the new size desired for the allocation :returns: the address of the allocation, or a NULL pointer if the allocation was ...
def realloc(self, ptr, size): """ A somewhat faithful implementation of libc `realloc`. :param ptr: the location in memory to be reallocated :param size: the new size desired for the allocation :returns: the address of the allocation, or a NULL pointer if the allocation was ...
[ "A", "somewhat", "faithful", "implementation", "of", "libc", "realloc", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_libc.py#L38-L48
[ "def", "realloc", "(", "self", ",", "ptr", ",", "size", ")", ":", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "realloc", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__name__", ")", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
GDB.set_stack
Stack dump is a dump of the stack from gdb, i.e. the result of the following gdb command : ``dump binary memory [stack_dump] [begin_addr] [end_addr]`` We set the stack to the same addresses as the gdb session to avoid pointers corruption. :param stack_dump: The dump file. :param stac...
angr/state_plugins/gdb.py
def set_stack(self, stack_dump, stack_top): """ Stack dump is a dump of the stack from gdb, i.e. the result of the following gdb command : ``dump binary memory [stack_dump] [begin_addr] [end_addr]`` We set the stack to the same addresses as the gdb session to avoid pointers corruption....
def set_stack(self, stack_dump, stack_top): """ Stack dump is a dump of the stack from gdb, i.e. the result of the following gdb command : ``dump binary memory [stack_dump] [begin_addr] [end_addr]`` We set the stack to the same addresses as the gdb session to avoid pointers corruption....
[ "Stack", "dump", "is", "a", "dump", "of", "the", "stack", "from", "gdb", "i", ".", "e", ".", "the", "result", "of", "the", "following", "gdb", "command", ":" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/gdb.py#L33-L49
[ "def", "set_stack", "(", "self", ",", "stack_dump", ",", "stack_top", ")", ":", "data", "=", "self", ".", "_read_data", "(", "stack_dump", ")", "self", ".", "real_stack_top", "=", "stack_top", "addr", "=", "stack_top", "-", "len", "(", "data", ")", "# Ad...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
GDB.set_heap
Heap dump is a dump of the heap from gdb, i.e. the result of the following gdb command: ``dump binary memory [stack_dump] [begin] [end]`` :param heap_dump: The dump file. :param heap_base: The start address of the heap in the gdb session.
angr/state_plugins/gdb.py
def set_heap(self, heap_dump, heap_base): """ Heap dump is a dump of the heap from gdb, i.e. the result of the following gdb command: ``dump binary memory [stack_dump] [begin] [end]`` :param heap_dump: The dump file. :param heap_base: The start address of the heap i...
def set_heap(self, heap_dump, heap_base): """ Heap dump is a dump of the heap from gdb, i.e. the result of the following gdb command: ``dump binary memory [stack_dump] [begin] [end]`` :param heap_dump: The dump file. :param heap_base: The start address of the heap i...
[ "Heap", "dump", "is", "a", "dump", "of", "the", "heap", "from", "gdb", "i", ".", "e", ".", "the", "result", "of", "the", "following", "gdb", "command", ":" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/gdb.py#L51-L67
[ "def", "set_heap", "(", "self", ",", "heap_dump", ",", "heap_base", ")", ":", "# We set the heap at the same addresses as the gdb session to avoid pointer corruption.", "data", "=", "self", ".", "_read_data", "(", "heap_dump", ")", "self", ".", "state", ".", "heap", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
GDB.set_data
Update any data range (most likely use is the data segments of loaded objects)
angr/state_plugins/gdb.py
def set_data(self, addr, data_dump): """ Update any data range (most likely use is the data segments of loaded objects) """ data = self._read_data(data_dump) l.info("Set data from 0x%x to %#x", addr, addr+len(data)) self._write(addr, data)
def set_data(self, addr, data_dump): """ Update any data range (most likely use is the data segments of loaded objects) """ data = self._read_data(data_dump) l.info("Set data from 0x%x to %#x", addr, addr+len(data)) self._write(addr, data)
[ "Update", "any", "data", "range", "(", "most", "likely", "use", "is", "the", "data", "segments", "of", "loaded", "objects", ")" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/gdb.py#L69-L75
[ "def", "set_data", "(", "self", ",", "addr", ",", "data_dump", ")", ":", "data", "=", "self", ".", "_read_data", "(", "data_dump", ")", "l", ".", "info", "(", "\"Set data from 0x%x to %#x\"", ",", "addr", ",", "addr", "+", "len", "(", "data", ")", ")",...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
GDB.set_regs
Initialize register values within the state :param regs_dump: The output of ``info registers`` in gdb.
angr/state_plugins/gdb.py
def set_regs(self, regs_dump): """ Initialize register values within the state :param regs_dump: The output of ``info registers`` in gdb. """ if self.real_stack_top == 0 and self.adjust_stack is True: raise SimStateError("You need to set the stack first, or set" ...
def set_regs(self, regs_dump): """ Initialize register values within the state :param regs_dump: The output of ``info registers`` in gdb. """ if self.real_stack_top == 0 and self.adjust_stack is True: raise SimStateError("You need to set the stack first, or set" ...
[ "Initialize", "register", "values", "within", "the", "state" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/gdb.py#L77-L101
[ "def", "set_regs", "(", "self", ",", "regs_dump", ")", ":", "if", "self", ".", "real_stack_top", "==", "0", "and", "self", ".", "adjust_stack", "is", "True", ":", "raise", "SimStateError", "(", "\"You need to set the stack first, or set\"", "\"adjust_stack to False....
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
GDB._adjust_regs
Adjust bp and sp w.r.t. stack difference between GDB session and angr. This matches sp and bp registers, but there is a high risk of pointers inconsistencies.
angr/state_plugins/gdb.py
def _adjust_regs(self): """ Adjust bp and sp w.r.t. stack difference between GDB session and angr. This matches sp and bp registers, but there is a high risk of pointers inconsistencies. """ if not self.adjust_stack: return bp = self.state.arch.register_names...
def _adjust_regs(self): """ Adjust bp and sp w.r.t. stack difference between GDB session and angr. This matches sp and bp registers, but there is a high risk of pointers inconsistencies. """ if not self.adjust_stack: return bp = self.state.arch.register_names...
[ "Adjust", "bp", "and", "sp", "w", ".", "r", ".", "t", ".", "stack", "difference", "between", "GDB", "session", "and", "angr", ".", "This", "matches", "sp", "and", "bp", "registers", "but", "there", "is", "a", "high", "risk", "of", "pointers", "inconsis...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/gdb.py#L103-L118
[ "def", "_adjust_regs", "(", "self", ")", ":", "if", "not", "self", ".", "adjust_stack", ":", "return", "bp", "=", "self", ".", "state", ".", "arch", ".", "register_names", "[", "self", ".", "state", ".", "arch", ".", "bp_offset", "]", "sp", "=", "sel...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
LoopFinder._parse_loop_graph
Create a Loop object for a strongly connected graph, and any strongly connected subgraphs, if possible. :param subg: A strongly connected subgraph. :param bigg: The graph which subg is a subgraph of. :return: A list of Loop objects, some of which may be inside others, ...
angr/analyses/loopfinder.py
def _parse_loop_graph(self, subg, bigg): """ Create a Loop object for a strongly connected graph, and any strongly connected subgraphs, if possible. :param subg: A strongly connected subgraph. :param bigg: The graph which subg is a subgraph of. :return: A l...
def _parse_loop_graph(self, subg, bigg): """ Create a Loop object for a strongly connected graph, and any strongly connected subgraphs, if possible. :param subg: A strongly connected subgraph. :param bigg: The graph which subg is a subgraph of. :return: A l...
[ "Create", "a", "Loop", "object", "for", "a", "strongly", "connected", "graph", "and", "any", "strongly", "connected", "subgraphs", "if", "possible", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/loopfinder.py#L61-L150
[ "def", "_parse_loop_graph", "(", "self", ",", "subg", ",", "bigg", ")", ":", "loop_body_nodes", "=", "list", "(", "subg", ".", "nodes", "(", ")", ")", "[", ":", "]", "entry_edges", "=", "[", "]", "break_edges", "=", "[", "]", "continue_edges", "=", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
LoopFinder._parse_loops_from_graph
Return all Loop instances that can be extracted from a graph. :param graph: The graph to analyze. :return: A list of all the Loop instances that were found in the graph.
angr/analyses/loopfinder.py
def _parse_loops_from_graph(self, graph): """ Return all Loop instances that can be extracted from a graph. :param graph: The graph to analyze. :return: A list of all the Loop instances that were found in the graph. """ outtop = [] outall = [] f...
def _parse_loops_from_graph(self, graph): """ Return all Loop instances that can be extracted from a graph. :param graph: The graph to analyze. :return: A list of all the Loop instances that were found in the graph. """ outtop = [] outall = [] f...
[ "Return", "all", "Loop", "instances", "that", "can", "be", "extracted", "from", "a", "graph", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/loopfinder.py#L152-L170
[ "def", "_parse_loops_from_graph", "(", "self", ",", "graph", ")", ":", "outtop", "=", "[", "]", "outall", "=", "[", "]", "for", "subg", "in", "networkx", ".", "strongly_connected_component_subgraphs", "(", "graph", ")", ":", "if", "len", "(", "subg", ".", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSootValue_InstanceFieldRef.get_ref
Resolve the field within the given state.
angr/engines/soot/values/instancefieldref.py
def get_ref(cls, state, obj_alloc_id, field_class_name, field_name, field_type): """ Resolve the field within the given state. """ # resolve field field_class = state.javavm_classloader.get_class(field_class_name) field_id = resolve_field(state, field_class, field_name, f...
def get_ref(cls, state, obj_alloc_id, field_class_name, field_name, field_type): """ Resolve the field within the given state. """ # resolve field field_class = state.javavm_classloader.get_class(field_class_name) field_id = resolve_field(state, field_class, field_name, f...
[ "Resolve", "the", "field", "within", "the", "given", "state", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/soot/values/instancefieldref.py#L36-L44
[ "def", "get_ref", "(", "cls", ",", "state", ",", "obj_alloc_id", ",", "field_class_name", ",", "field_name", ",", "field_type", ")", ":", "# resolve field", "field_class", "=", "state", ".", "javavm_classloader", ".", "get_class", "(", "field_class_name", ")", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
_euclidean_dist
:param vector_a: A list of numbers. :param vector_b: A list of numbers. :returns: The euclidean distance between the two vectors.
angr/analyses/bindiff.py
def _euclidean_dist(vector_a, vector_b): """ :param vector_a: A list of numbers. :param vector_b: A list of numbers. :returns: The euclidean distance between the two vectors. """ dist = 0 for (x, y) in zip(vector_a, vector_b): dist += (x-y)*(x-y) return math.sqrt(...
def _euclidean_dist(vector_a, vector_b): """ :param vector_a: A list of numbers. :param vector_b: A list of numbers. :returns: The euclidean distance between the two vectors. """ dist = 0 for (x, y) in zip(vector_a, vector_b): dist += (x-y)*(x-y) return math.sqrt(...
[ ":", "param", "vector_a", ":", "A", "list", "of", "numbers", ".", ":", "param", "vector_b", ":", "A", "list", "of", "numbers", ".", ":", "returns", ":", "The", "euclidean", "distance", "between", "the", "two", "vectors", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L44-L53
[ "def", "_euclidean_dist", "(", "vector_a", ",", "vector_b", ")", ":", "dist", "=", "0", "for", "(", "x", ",", "y", ")", "in", "zip", "(", "vector_a", ",", "vector_b", ")", ":", "dist", "+=", "(", "x", "-", "y", ")", "*", "(", "x", "-", "y", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
_get_closest_matches
:param input_attributes: First dictionary of objects to attribute tuples. :param target_attributes: Second dictionary of blocks to attribute tuples. :returns: A dictionary of objects in the input_attributes to the closest objects in the target_attributes.
angr/analyses/bindiff.py
def _get_closest_matches(input_attributes, target_attributes): """ :param input_attributes: First dictionary of objects to attribute tuples. :param target_attributes: Second dictionary of blocks to attribute tuples. :returns: A dictionary of objects in the input_attributes to the ...
def _get_closest_matches(input_attributes, target_attributes): """ :param input_attributes: First dictionary of objects to attribute tuples. :param target_attributes: Second dictionary of blocks to attribute tuples. :returns: A dictionary of objects in the input_attributes to the ...
[ ":", "param", "input_attributes", ":", "First", "dictionary", "of", "objects", "to", "attribute", "tuples", ".", ":", "param", "target_attributes", ":", "Second", "dictionary", "of", "blocks", "to", "attribute", "tuples", ".", ":", "returns", ":", "A", "dictio...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L56-L78
[ "def", "_get_closest_matches", "(", "input_attributes", ",", "target_attributes", ")", ":", "closest_matches", "=", "{", "}", "# for each object in the first set find the objects with the closest target attributes", "for", "a", "in", "input_attributes", ":", "best_dist", "=", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
_levenshtein_distance
:param s1: A list or string :param s2: Another list or string :returns: The levenshtein distance between the two
angr/analyses/bindiff.py
def _levenshtein_distance(s1, s2): """ :param s1: A list or string :param s2: Another list or string :returns: The levenshtein distance between the two """ if len(s1) > len(s2): s1, s2 = s2, s1 distances = range(len(s1) + 1) for index2, num2 in enumerate(s2): new_dis...
def _levenshtein_distance(s1, s2): """ :param s1: A list or string :param s2: Another list or string :returns: The levenshtein distance between the two """ if len(s1) > len(s2): s1, s2 = s2, s1 distances = range(len(s1) + 1) for index2, num2 in enumerate(s2): new_dis...
[ ":", "param", "s1", ":", "A", "list", "or", "string", ":", "param", "s2", ":", "Another", "list", "or", "string", ":", "returns", ":", "The", "levenshtein", "distance", "between", "the", "two" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L82-L101
[ "def", "_levenshtein_distance", "(", "s1", ",", "s2", ")", ":", "if", "len", "(", "s1", ")", ">", "len", "(", "s2", ")", ":", "s1", ",", "s2", "=", "s2", ",", "s1", "distances", "=", "range", "(", "len", "(", "s1", ")", "+", "1", ")", "for", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
_normalized_levenshtein_distance
This function calculates the levenshtein distance but allows for elements in the lists to be different by any number in the set acceptable_differences. :param s1: A list. :param s2: Another list. :param acceptable_differences: A set of numbers. If (s2[i]-s1[i]...
angr/analyses/bindiff.py
def _normalized_levenshtein_distance(s1, s2, acceptable_differences): """ This function calculates the levenshtein distance but allows for elements in the lists to be different by any number in the set acceptable_differences. :param s1: A list. :param s2: A...
def _normalized_levenshtein_distance(s1, s2, acceptable_differences): """ This function calculates the levenshtein distance but allows for elements in the lists to be different by any number in the set acceptable_differences. :param s1: A list. :param s2: A...
[ "This", "function", "calculates", "the", "levenshtein", "distance", "but", "allows", "for", "elements", "in", "the", "lists", "to", "be", "different", "by", "any", "number", "in", "the", "set", "acceptable_differences", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L104-L128
[ "def", "_normalized_levenshtein_distance", "(", "s1", ",", "s2", ",", "acceptable_differences", ")", ":", "if", "len", "(", "s1", ")", ">", "len", "(", "s2", ")", ":", "s1", ",", "s2", "=", "s2", ",", "s1", "acceptable_differences", "=", "set", "(", "-...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
_is_better_match
:param x: The first element of a possible match. :param y: The second element of a possible match. :param matched_a: The current matches for the first set. :param matched_b: The current matches for the second set. :param attributes_dict_a: The at...
angr/analyses/bindiff.py
def _is_better_match(x, y, matched_a, matched_b, attributes_dict_a, attributes_dict_b): """ :param x: The first element of a possible match. :param y: The second element of a possible match. :param matched_a: The current matches for the first set. :param...
def _is_better_match(x, y, matched_a, matched_b, attributes_dict_a, attributes_dict_b): """ :param x: The first element of a possible match. :param y: The second element of a possible match. :param matched_a: The current matches for the first set. :param...
[ ":", "param", "x", ":", "The", "first", "element", "of", "a", "possible", "match", ".", ":", "param", "y", ":", "The", "second", "element", "of", "a", "possible", "match", ".", ":", "param", "matched_a", ":", "The", "current", "matches", "for", "the", ...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L131-L151
[ "def", "_is_better_match", "(", "x", ",", "y", ",", "matched_a", ",", "matched_b", ",", "attributes_dict_a", ",", "attributes_dict_b", ")", ":", "attributes_x", "=", "attributes_dict_a", "[", "x", "]", "attributes_y", "=", "attributes_dict_b", "[", "y", "]", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
differing_constants
Compares two basic blocks and finds all the constants that differ from the first block to the second. :param block_a: The first block to compare. :param block_b: The second block to compare. :returns: Returns a list of differing constants in the form of ConstantChange, which has the offset in the ...
angr/analyses/bindiff.py
def differing_constants(block_a, block_b): """ Compares two basic blocks and finds all the constants that differ from the first block to the second. :param block_a: The first block to compare. :param block_b: The second block to compare. :returns: Returns a list of differing constants in the ...
def differing_constants(block_a, block_b): """ Compares two basic blocks and finds all the constants that differ from the first block to the second. :param block_a: The first block to compare. :param block_b: The second block to compare. :returns: Returns a list of differing constants in the ...
[ "Compares", "two", "basic", "blocks", "and", "finds", "all", "the", "constants", "that", "differ", "from", "the", "first", "block", "to", "the", "second", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L154-L193
[ "def", "differing_constants", "(", "block_a", ",", "block_b", ")", ":", "statements_a", "=", "[", "s", "for", "s", "in", "block_a", ".", "vex", ".", "statements", "if", "s", ".", "tag", "!=", "\"Ist_IMark\"", "]", "+", "[", "block_a", ".", "vex", ".", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FunctionDiff.probably_identical
:returns: Whether or not these two functions are identical.
angr/analyses/bindiff.py
def probably_identical(self): """ :returns: Whether or not these two functions are identical. """ if len(self._unmatched_blocks_from_a | self._unmatched_blocks_from_b) > 0: return False for (a, b) in self._block_matches: if not self.blocks_probably_identic...
def probably_identical(self): """ :returns: Whether or not these two functions are identical. """ if len(self._unmatched_blocks_from_a | self._unmatched_blocks_from_b) > 0: return False for (a, b) in self._block_matches: if not self.blocks_probably_identic...
[ ":", "returns", ":", "Whether", "or", "not", "these", "two", "functions", "are", "identical", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L368-L377
[ "def", "probably_identical", "(", "self", ")", ":", "if", "len", "(", "self", ".", "_unmatched_blocks_from_a", "|", "self", ".", "_unmatched_blocks_from_b", ")", ">", "0", ":", "return", "False", "for", "(", "a", ",", "b", ")", "in", "self", ".", "_block...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FunctionDiff.identical_blocks
:returns: A list of block matches which appear to be identical
angr/analyses/bindiff.py
def identical_blocks(self): """ :returns: A list of block matches which appear to be identical """ identical_blocks = [] for (block_a, block_b) in self._block_matches: if self.blocks_probably_identical(block_a, block_b): identical_blocks.append((block_...
def identical_blocks(self): """ :returns: A list of block matches which appear to be identical """ identical_blocks = [] for (block_a, block_b) in self._block_matches: if self.blocks_probably_identical(block_a, block_b): identical_blocks.append((block_...
[ ":", "returns", ":", "A", "list", "of", "block", "matches", "which", "appear", "to", "be", "identical" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L380-L388
[ "def", "identical_blocks", "(", "self", ")", ":", "identical_blocks", "=", "[", "]", "for", "(", "block_a", ",", "block_b", ")", "in", "self", ".", "_block_matches", ":", "if", "self", ".", "blocks_probably_identical", "(", "block_a", ",", "block_b", ")", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FunctionDiff.differing_blocks
:returns: A list of block matches which appear to differ
angr/analyses/bindiff.py
def differing_blocks(self): """ :returns: A list of block matches which appear to differ """ differing_blocks = [] for (block_a, block_b) in self._block_matches: if not self.blocks_probably_identical(block_a, block_b): differing_blocks.append((block_a,...
def differing_blocks(self): """ :returns: A list of block matches which appear to differ """ differing_blocks = [] for (block_a, block_b) in self._block_matches: if not self.blocks_probably_identical(block_a, block_b): differing_blocks.append((block_a,...
[ ":", "returns", ":", "A", "list", "of", "block", "matches", "which", "appear", "to", "differ" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L391-L399
[ "def", "differing_blocks", "(", "self", ")", ":", "differing_blocks", "=", "[", "]", "for", "(", "block_a", ",", "block_b", ")", "in", "self", ".", "_block_matches", ":", "if", "not", "self", ".", "blocks_probably_identical", "(", "block_a", ",", "block_b", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FunctionDiff.blocks_with_differing_constants
:return: A list of block matches which appear to differ
angr/analyses/bindiff.py
def blocks_with_differing_constants(self): """ :return: A list of block matches which appear to differ """ differing_blocks = [] diffs = dict() for (block_a, block_b) in self._block_matches: if self.blocks_probably_identical(block_a, block_b) and \ ...
def blocks_with_differing_constants(self): """ :return: A list of block matches which appear to differ """ differing_blocks = [] diffs = dict() for (block_a, block_b) in self._block_matches: if self.blocks_probably_identical(block_a, block_b) and \ ...
[ ":", "return", ":", "A", "list", "of", "block", "matches", "which", "appear", "to", "differ" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L402-L416
[ "def", "blocks_with_differing_constants", "(", "self", ")", ":", "differing_blocks", "=", "[", "]", "diffs", "=", "dict", "(", ")", "for", "(", "block_a", ",", "block_b", ")", "in", "self", ".", "_block_matches", ":", "if", "self", ".", "blocks_probably_iden...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FunctionDiff.block_similarity
:param block_a: The first block address. :param block_b: The second block address. :returns: The similarity of the basic blocks, normalized for the base address of the block and function call addresses.
angr/analyses/bindiff.py
def block_similarity(self, block_a, block_b): """ :param block_a: The first block address. :param block_b: The second block address. :returns: The similarity of the basic blocks, normalized for the base address of the block and function call addresses. ...
def block_similarity(self, block_a, block_b): """ :param block_a: The first block address. :param block_b: The second block address. :returns: The similarity of the basic blocks, normalized for the base address of the block and function call addresses. ...
[ ":", "param", "block_a", ":", "The", "first", "block", "address", ".", ":", "param", "block_b", ":", "The", "second", "block", "address", ".", ":", "returns", ":", "The", "similarity", "of", "the", "basic", "blocks", "normalized", "for", "the", "base", "...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L435-L492
[ "def", "block_similarity", "(", "self", ",", "block_a", ",", "block_b", ")", ":", "# handle sim procedure blocks", "if", "self", ".", "_project_a", ".", "is_hooked", "(", "block_a", ")", "and", "self", ".", "_project_b", ".", "is_hooked", "(", "block_b", ")", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FunctionDiff.blocks_probably_identical
:param block_a: The first block address. :param block_b: The second block address. :param check_constants: Whether or not to require matching constants in blocks. :returns: Whether or not the blocks appear to be identical.
angr/analyses/bindiff.py
def blocks_probably_identical(self, block_a, block_b, check_constants=False): """ :param block_a: The first block address. :param block_b: The second block address. :param check_constants: Whether or not to require matching constants in blocks. :returns: ...
def blocks_probably_identical(self, block_a, block_b, check_constants=False): """ :param block_a: The first block address. :param block_b: The second block address. :param check_constants: Whether or not to require matching constants in blocks. :returns: ...
[ ":", "param", "block_a", ":", "The", "first", "block", "address", ".", ":", "param", "block_b", ":", "The", "second", "block", "address", ".", ":", "param", "check_constants", ":", "Whether", "or", "not", "to", "require", "matching", "constants", "in", "bl...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L494-L557
[ "def", "blocks_probably_identical", "(", "self", ",", "block_a", ",", "block_b", ",", "check_constants", "=", "False", ")", ":", "# handle sim procedure blocks", "if", "self", ".", "_project_a", ".", "is_hooked", "(", "block_a", ")", "and", "self", ".", "_projec...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FunctionDiff._compute_block_attributes
:param function: A normalized function object. :returns: A dictionary of basic block addresses to tuples of attributes.
angr/analyses/bindiff.py
def _compute_block_attributes(function): """ :param function: A normalized function object. :returns: A dictionary of basic block addresses to tuples of attributes. """ # The attributes we use are the distance form function start, distance from function exit and whet...
def _compute_block_attributes(function): """ :param function: A normalized function object. :returns: A dictionary of basic block addresses to tuples of attributes. """ # The attributes we use are the distance form function start, distance from function exit and whet...
[ ":", "param", "function", ":", "A", "normalized", "function", "object", ".", ":", "returns", ":", "A", "dictionary", "of", "basic", "block", "addresses", "to", "tuples", "of", "attributes", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L567-L590
[ "def", "_compute_block_attributes", "(", "function", ")", ":", "# The attributes we use are the distance form function start, distance from function exit and whether", "# or not it has a subfunction call", "distances_from_start", "=", "FunctionDiff", ".", "_distances_from_function_start", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FunctionDiff._distances_from_function_exit
:param function: A normalized Function object. :returns: A dictionary of basic block addresses and their distance to the exit of the function.
angr/analyses/bindiff.py
def _distances_from_function_exit(function): """ :param function: A normalized Function object. :returns: A dictionary of basic block addresses and their distance to the exit of the function. """ reverse_graph = function.graph.reverse() # we aren't guaranteed...
def _distances_from_function_exit(function): """ :param function: A normalized Function object. :returns: A dictionary of basic block addresses and their distance to the exit of the function. """ reverse_graph = function.graph.reverse() # we aren't guaranteed...
[ ":", "param", "function", ":", "A", "normalized", "Function", "object", ".", ":", "returns", ":", "A", "dictionary", "of", "basic", "block", "addresses", "and", "their", "distance", "to", "the", "exit", "of", "the", "function", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L602-L631
[ "def", "_distances_from_function_exit", "(", "function", ")", ":", "reverse_graph", "=", "function", ".", "graph", ".", "reverse", "(", ")", "# we aren't guaranteed to have an exit from the function so explicitly add the node", "reverse_graph", ".", "add_node", "(", "\"start\...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FunctionDiff._compute_diff
Computes the diff of the functions and saves the result.
angr/analyses/bindiff.py
def _compute_diff(self): """ Computes the diff of the functions and saves the result. """ # get the attributes for all blocks l.debug("Computing diff of functions: %s, %s", ("%#x" % self._function_a.startpoint.addr) if self._function_a.startpoint is not None else ...
def _compute_diff(self): """ Computes the diff of the functions and saves the result. """ # get the attributes for all blocks l.debug("Computing diff of functions: %s, %s", ("%#x" % self._function_a.startpoint.addr) if self._function_a.startpoint is not None else ...
[ "Computes", "the", "diff", "of", "the", "functions", "and", "saves", "the", "result", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L633-L713
[ "def", "_compute_diff", "(", "self", ")", ":", "# get the attributes for all blocks", "l", ".", "debug", "(", "\"Computing diff of functions: %s, %s\"", ",", "(", "\"%#x\"", "%", "self", ".", "_function_a", ".", "startpoint", ".", "addr", ")", "if", "self", ".", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FunctionDiff._get_block_matches
:param attributes_a: A dict of blocks to their attributes :param attributes_b: A dict of blocks to their attributes The following parameters are optional. :param filter_set_a: A set to limit attributes_a to the blocks in this set. :param filter_set_b: A set to limit attribu...
angr/analyses/bindiff.py
def _get_block_matches(self, attributes_a, attributes_b, filter_set_a=None, filter_set_b=None, delta=(0, 0, 0), tiebreak_with_block_similarity=False): """ :param attributes_a: A dict of blocks to their attributes :param attributes_b: A dict of blocks to their att...
def _get_block_matches(self, attributes_a, attributes_b, filter_set_a=None, filter_set_b=None, delta=(0, 0, 0), tiebreak_with_block_similarity=False): """ :param attributes_a: A dict of blocks to their attributes :param attributes_b: A dict of blocks to their att...
[ ":", "param", "attributes_a", ":", "A", "dict", "of", "blocks", "to", "their", "attributes", ":", "param", "attributes_b", ":", "A", "dict", "of", "blocks", "to", "their", "attributes" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L734-L805
[ "def", "_get_block_matches", "(", "self", ",", "attributes_a", ",", "attributes_b", ",", "filter_set_a", "=", "None", ",", "filter_set_b", "=", "None", ",", "delta", "=", "(", "0", ",", "0", ",", "0", ")", ",", "tiebreak_with_block_similarity", "=", "False",...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
BinDiff.functions_probably_identical
Compare two functions and return True if they appear identical. :param func_a_addr: The address of the first function (in the first binary). :param func_b_addr: The address of the second function (in the second binary). :returns: Whether or not the functions appear to be identical.
angr/analyses/bindiff.py
def functions_probably_identical(self, func_a_addr, func_b_addr, check_consts=False): """ Compare two functions and return True if they appear identical. :param func_a_addr: The address of the first function (in the first binary). :param func_b_addr: The address of the second function (...
def functions_probably_identical(self, func_a_addr, func_b_addr, check_consts=False): """ Compare two functions and return True if they appear identical. :param func_a_addr: The address of the first function (in the first binary). :param func_b_addr: The address of the second function (...
[ "Compare", "two", "functions", "and", "return", "True", "if", "they", "appear", "identical", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L878-L893
[ "def", "functions_probably_identical", "(", "self", ",", "func_a_addr", ",", "func_b_addr", ",", "check_consts", "=", "False", ")", ":", "if", "self", ".", "cfg_a", ".", "project", ".", "is_hooked", "(", "func_a_addr", ")", "and", "self", ".", "cfg_b", ".", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
BinDiff.identical_functions
:returns: A list of function matches that appear to be identical
angr/analyses/bindiff.py
def identical_functions(self): """ :returns: A list of function matches that appear to be identical """ identical_funcs = [] for (func_a, func_b) in self.function_matches: if self.functions_probably_identical(func_a, func_b): identical_funcs.append((fu...
def identical_functions(self): """ :returns: A list of function matches that appear to be identical """ identical_funcs = [] for (func_a, func_b) in self.function_matches: if self.functions_probably_identical(func_a, func_b): identical_funcs.append((fu...
[ ":", "returns", ":", "A", "list", "of", "function", "matches", "that", "appear", "to", "be", "identical" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L896-L904
[ "def", "identical_functions", "(", "self", ")", ":", "identical_funcs", "=", "[", "]", "for", "(", "func_a", ",", "func_b", ")", "in", "self", ".", "function_matches", ":", "if", "self", ".", "functions_probably_identical", "(", "func_a", ",", "func_b", ")",...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
BinDiff.differing_functions
:returns: A list of function matches that appear to differ
angr/analyses/bindiff.py
def differing_functions(self): """ :returns: A list of function matches that appear to differ """ different_funcs = [] for (func_a, func_b) in self.function_matches: if not self.functions_probably_identical(func_a, func_b): different_funcs.append((func...
def differing_functions(self): """ :returns: A list of function matches that appear to differ """ different_funcs = [] for (func_a, func_b) in self.function_matches: if not self.functions_probably_identical(func_a, func_b): different_funcs.append((func...
[ ":", "returns", ":", "A", "list", "of", "function", "matches", "that", "appear", "to", "differ" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L907-L915
[ "def", "differing_functions", "(", "self", ")", ":", "different_funcs", "=", "[", "]", "for", "(", "func_a", ",", "func_b", ")", "in", "self", ".", "function_matches", ":", "if", "not", "self", ".", "functions_probably_identical", "(", "func_a", ",", "func_b...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
BinDiff.differing_functions_with_consts
:return: A list of function matches that appear to differ including just by constants
angr/analyses/bindiff.py
def differing_functions_with_consts(self): """ :return: A list of function matches that appear to differ including just by constants """ different_funcs = [] for (func_a, func_b) in self.function_matches: if not self.functions_probably_identical(func_a, func_b, check_...
def differing_functions_with_consts(self): """ :return: A list of function matches that appear to differ including just by constants """ different_funcs = [] for (func_a, func_b) in self.function_matches: if not self.functions_probably_identical(func_a, func_b, check_...
[ ":", "return", ":", "A", "list", "of", "function", "matches", "that", "appear", "to", "differ", "including", "just", "by", "constants" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L917-L925
[ "def", "differing_functions_with_consts", "(", "self", ")", ":", "different_funcs", "=", "[", "]", "for", "(", "func_a", ",", "func_b", ")", "in", "self", ".", "function_matches", ":", "if", "not", "self", ".", "functions_probably_identical", "(", "func_a", ",...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
BinDiff.differing_blocks
:returns: A list of block matches that appear to differ
angr/analyses/bindiff.py
def differing_blocks(self): """ :returns: A list of block matches that appear to differ """ differing_blocks = [] for (func_a, func_b) in self.function_matches: differing_blocks.extend(self.get_function_diff(func_a, func_b).differing_blocks) return differing_b...
def differing_blocks(self): """ :returns: A list of block matches that appear to differ """ differing_blocks = [] for (func_a, func_b) in self.function_matches: differing_blocks.extend(self.get_function_diff(func_a, func_b).differing_blocks) return differing_b...
[ ":", "returns", ":", "A", "list", "of", "block", "matches", "that", "appear", "to", "differ" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L928-L935
[ "def", "differing_blocks", "(", "self", ")", ":", "differing_blocks", "=", "[", "]", "for", "(", "func_a", ",", "func_b", ")", "in", "self", ".", "function_matches", ":", "differing_blocks", ".", "extend", "(", "self", ".", "get_function_diff", "(", "func_a"...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
BinDiff.identical_blocks
:return A list of all block matches that appear to be identical
angr/analyses/bindiff.py
def identical_blocks(self): """ :return A list of all block matches that appear to be identical """ identical_blocks = [] for (func_a, func_b) in self.function_matches: identical_blocks.extend(self.get_function_diff(func_a, func_b).identical_blocks) return ide...
def identical_blocks(self): """ :return A list of all block matches that appear to be identical """ identical_blocks = [] for (func_a, func_b) in self.function_matches: identical_blocks.extend(self.get_function_diff(func_a, func_b).identical_blocks) return ide...
[ ":", "return", "A", "list", "of", "all", "block", "matches", "that", "appear", "to", "be", "identical" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L938-L945
[ "def", "identical_blocks", "(", "self", ")", ":", "identical_blocks", "=", "[", "]", "for", "(", "func_a", ",", "func_b", ")", "in", "self", ".", "function_matches", ":", "identical_blocks", ".", "extend", "(", "self", ".", "get_function_diff", "(", "func_a"...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
BinDiff.blocks_with_differing_constants
:return: A dict of block matches with differing constants to the tuple of constants
angr/analyses/bindiff.py
def blocks_with_differing_constants(self): """ :return: A dict of block matches with differing constants to the tuple of constants """ diffs = dict() for (func_a, func_b) in self.function_matches: diffs.update(self.get_function_diff(func_a, func_b).blocks_with_differi...
def blocks_with_differing_constants(self): """ :return: A dict of block matches with differing constants to the tuple of constants """ diffs = dict() for (func_a, func_b) in self.function_matches: diffs.update(self.get_function_diff(func_a, func_b).blocks_with_differi...
[ ":", "return", ":", "A", "dict", "of", "block", "matches", "with", "differing", "constants", "to", "the", "tuple", "of", "constants" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L948-L955
[ "def", "blocks_with_differing_constants", "(", "self", ")", ":", "diffs", "=", "dict", "(", ")", "for", "(", "func_a", ",", "func_b", ")", "in", "self", ".", "function_matches", ":", "diffs", ".", "update", "(", "self", ".", "get_function_diff", "(", "func...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
BinDiff.get_function_diff
:param function_addr_a: The address of the first function (in the first binary) :param function_addr_b: The address of the second function (in the second binary) :returns: the FunctionDiff of the two functions
angr/analyses/bindiff.py
def get_function_diff(self, function_addr_a, function_addr_b): """ :param function_addr_a: The address of the first function (in the first binary) :param function_addr_b: The address of the second function (in the second binary) :returns: the FunctionDiff of the two functions """...
def get_function_diff(self, function_addr_a, function_addr_b): """ :param function_addr_a: The address of the first function (in the first binary) :param function_addr_b: The address of the second function (in the second binary) :returns: the FunctionDiff of the two functions """...
[ ":", "param", "function_addr_a", ":", "The", "address", "of", "the", "first", "function", "(", "in", "the", "first", "binary", ")", ":", "param", "function_addr_b", ":", "The", "address", "of", "the", "second", "function", "(", "in", "the", "second", "bina...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L962-L973
[ "def", "get_function_diff", "(", "self", ",", "function_addr_a", ",", "function_addr_b", ")", ":", "pair", "=", "(", "function_addr_a", ",", "function_addr_b", ")", "if", "pair", "not", "in", "self", ".", "_function_diffs", ":", "function_a", "=", "self", ".",...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
BinDiff._compute_function_attributes
:param cfg: An angr CFG object :returns: a dictionary of function addresses to tuples of attributes
angr/analyses/bindiff.py
def _compute_function_attributes(cfg): """ :param cfg: An angr CFG object :returns: a dictionary of function addresses to tuples of attributes """ # the attributes we use are the number of basic blocks, number of edges, and number of subfunction calls attributes = dict...
def _compute_function_attributes(cfg): """ :param cfg: An angr CFG object :returns: a dictionary of function addresses to tuples of attributes """ # the attributes we use are the number of basic blocks, number of edges, and number of subfunction calls attributes = dict...
[ ":", "param", "cfg", ":", "An", "angr", "CFG", "object", ":", "returns", ":", "a", "dictionary", "of", "function", "addresses", "to", "tuples", "of", "attributes" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L976-L1001
[ "def", "_compute_function_attributes", "(", "cfg", ")", ":", "# the attributes we use are the number of basic blocks, number of edges, and number of subfunction calls", "attributes", "=", "dict", "(", ")", "all_funcs", "=", "set", "(", "cfg", ".", "kb", ".", "callgraph", "....
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
BinDiff._get_function_matches
:param attributes_a: A dict of functions to their attributes :param attributes_b: A dict of functions to their attributes The following parameters are optional. :param filter_set_a: A set to limit attributes_a to the functions in this set. :param filter_set_b: A set to limi...
angr/analyses/bindiff.py
def _get_function_matches(attributes_a, attributes_b, filter_set_a=None, filter_set_b=None): """ :param attributes_a: A dict of functions to their attributes :param attributes_b: A dict of functions to their attributes The following parameters are optional. :param filter_...
def _get_function_matches(attributes_a, attributes_b, filter_set_a=None, filter_set_b=None): """ :param attributes_a: A dict of functions to their attributes :param attributes_b: A dict of functions to their attributes The following parameters are optional. :param filter_...
[ ":", "param", "attributes_a", ":", "A", "dict", "of", "functions", "to", "their", "attributes", ":", "param", "attributes_b", ":", "A", "dict", "of", "functions", "to", "their", "attributes" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/bindiff.py#L1171-L1205
[ "def", "_get_function_matches", "(", "attributes_a", ",", "attributes_b", ",", "filter_set_a", "=", "None", ",", "filter_set_b", "=", "None", ")", ":", "# get the attributes that are in the sets", "if", "filter_set_a", "is", "None", ":", "filtered_attributes_a", "=", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
load_shellcode
Load a new project based on a string of raw bytecode. :param shellcode: The data to load :param arch: The name of the arch to use, or an archinfo class :param start_offset: The offset into the data to start analysis (default 0) :param load_address: The address to place the data i...
angr/project.py
def load_shellcode(shellcode, arch, start_offset=0, load_address=0): """ Load a new project based on a string of raw bytecode. :param shellcode: The data to load :param arch: The name of the arch to use, or an archinfo class :param start_offset: The offset into the data to start...
def load_shellcode(shellcode, arch, start_offset=0, load_address=0): """ Load a new project based on a string of raw bytecode. :param shellcode: The data to load :param arch: The name of the arch to use, or an archinfo class :param start_offset: The offset into the data to start...
[ "Load", "a", "new", "project", "based", "on", "a", "string", "of", "raw", "bytecode", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/project.py#L17-L34
[ "def", "load_shellcode", "(", "shellcode", ",", "arch", ",", "start_offset", "=", "0", ",", "load_address", "=", "0", ")", ":", "return", "Project", "(", "BytesIO", "(", "shellcode", ")", ",", "main_opts", "=", "{", "'backend'", ":", "'blob'", ",", "'arc...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Project._register_object
This scans through an objects imports and hooks them with simprocedures from our library whenever possible
angr/project.py
def _register_object(self, obj, sim_proc_arch): """ This scans through an objects imports and hooks them with simprocedures from our library whenever possible """ # Step 1: get the set of libraries we are allowed to use to resolve unresolved symbols missing_libs = [] for...
def _register_object(self, obj, sim_proc_arch): """ This scans through an objects imports and hooks them with simprocedures from our library whenever possible """ # Step 1: get the set of libraries we are allowed to use to resolve unresolved symbols missing_libs = [] for...
[ "This", "scans", "through", "an", "objects", "imports", "and", "hooks", "them", "with", "simprocedures", "from", "our", "library", "whenever", "possible" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/project.py#L231-L340
[ "def", "_register_object", "(", "self", ",", "obj", ",", "sim_proc_arch", ")", ":", "# Step 1: get the set of libraries we are allowed to use to resolve unresolved symbols", "missing_libs", "=", "[", "]", "for", "lib_name", "in", "self", ".", "loader", ".", "missing_depen...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Project._guess_simprocedure
Does symbol name `f` exist as a SIM_PROCEDURE? If so, return it, else return None. Narrows down the set of libraries to search based on hint. Part of the hack to enable Binary Ninja support. Remove if _register_objects() stops using it.
angr/project.py
def _guess_simprocedure(self, f, hint): """ Does symbol name `f` exist as a SIM_PROCEDURE? If so, return it, else return None. Narrows down the set of libraries to search based on hint. Part of the hack to enable Binary Ninja support. Remove if _register_objects() stops using it. ...
def _guess_simprocedure(self, f, hint): """ Does symbol name `f` exist as a SIM_PROCEDURE? If so, return it, else return None. Narrows down the set of libraries to search based on hint. Part of the hack to enable Binary Ninja support. Remove if _register_objects() stops using it. ...
[ "Does", "symbol", "name", "f", "exist", "as", "a", "SIM_PROCEDURE?", "If", "so", "return", "it", "else", "return", "None", ".", "Narrows", "down", "the", "set", "of", "libraries", "to", "search", "based", "on", "hint", ".", "Part", "of", "the", "hack", ...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/project.py#L342-L361
[ "def", "_guess_simprocedure", "(", "self", ",", "f", ",", "hint", ")", ":", "# First, filter the SIM_LIBRARIES to a reasonable subset based on the hint", "hinted_libs", "=", "[", "]", "if", "hint", "==", "\"win\"", ":", "hinted_libs", "=", "filter", "(", "lambda", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Project._check_user_blacklists
Has symbol name `f` been marked for exclusion by any of the user parameters?
angr/project.py
def _check_user_blacklists(self, f): """ Has symbol name `f` been marked for exclusion by any of the user parameters? """ return not self._should_use_sim_procedures or \ f in self._exclude_sim_procedures_list or \ f in self._ignore_functions or \ ...
def _check_user_blacklists(self, f): """ Has symbol name `f` been marked for exclusion by any of the user parameters? """ return not self._should_use_sim_procedures or \ f in self._exclude_sim_procedures_list or \ f in self._ignore_functions or \ ...
[ "Has", "symbol", "name", "f", "been", "marked", "for", "exclusion", "by", "any", "of", "the", "user", "parameters?" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/project.py#L363-L371
[ "def", "_check_user_blacklists", "(", "self", ",", "f", ")", ":", "return", "not", "self", ".", "_should_use_sim_procedures", "or", "f", "in", "self", ".", "_exclude_sim_procedures_list", "or", "f", "in", "self", ".", "_ignore_functions", "or", "(", "self", "....
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Project.hook
Hook a section of code with a custom function. This is used internally to provide symbolic summaries of library functions, and can be used to instrument execution or to modify control flow. When hook is not specified, it returns a function decorator that allows easy hooking. Usage:: ...
angr/project.py
def hook(self, addr, hook=None, length=0, kwargs=None, replace=False): """ Hook a section of code with a custom function. This is used internally to provide symbolic summaries of library functions, and can be used to instrument execution or to modify control flow. When hook is n...
def hook(self, addr, hook=None, length=0, kwargs=None, replace=False): """ Hook a section of code with a custom function. This is used internally to provide symbolic summaries of library functions, and can be used to instrument execution or to modify control flow. When hook is n...
[ "Hook", "a", "section", "of", "code", "with", "a", "custom", "function", ".", "This", "is", "used", "internally", "to", "provide", "symbolic", "summaries", "of", "library", "functions", "and", "can", "be", "used", "to", "instrument", "execution", "or", "to",...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/project.py#L385-L436
[ "def", "hook", "(", "self", ",", "addr", ",", "hook", "=", "None", ",", "length", "=", "0", ",", "kwargs", "=", "None", ",", "replace", "=", "False", ")", ":", "if", "hook", "is", "None", ":", "# if we haven't been passed a thing to hook with, assume we're b...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Project.hooked_by
Returns the current hook for `addr`. :param addr: An address. :returns: None if the address is not hooked.
angr/project.py
def hooked_by(self, addr): """ Returns the current hook for `addr`. :param addr: An address. :returns: None if the address is not hooked. """ if not self.is_hooked(addr): l.warning("Address %s is not hooked", self._addr_to_str(addr)) return N...
def hooked_by(self, addr): """ Returns the current hook for `addr`. :param addr: An address. :returns: None if the address is not hooked. """ if not self.is_hooked(addr): l.warning("Address %s is not hooked", self._addr_to_str(addr)) return N...
[ "Returns", "the", "current", "hook", "for", "addr", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/project.py#L447-L460
[ "def", "hooked_by", "(", "self", ",", "addr", ")", ":", "if", "not", "self", ".", "is_hooked", "(", "addr", ")", ":", "l", ".", "warning", "(", "\"Address %s is not hooked\"", ",", "self", ".", "_addr_to_str", "(", "addr", ")", ")", "return", "None", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Project.unhook
Remove a hook. :param addr: The address of the hook.
angr/project.py
def unhook(self, addr): """ Remove a hook. :param addr: The address of the hook. """ if not self.is_hooked(addr): l.warning("Address %s not hooked", self._addr_to_str(addr)) return del self._sim_procedures[addr]
def unhook(self, addr): """ Remove a hook. :param addr: The address of the hook. """ if not self.is_hooked(addr): l.warning("Address %s not hooked", self._addr_to_str(addr)) return del self._sim_procedures[addr]
[ "Remove", "a", "hook", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/project.py#L462-L472
[ "def", "unhook", "(", "self", ",", "addr", ")", ":", "if", "not", "self", ".", "is_hooked", "(", "addr", ")", ":", "l", ".", "warning", "(", "\"Address %s not hooked\"", ",", "self", ".", "_addr_to_str", "(", "addr", ")", ")", "return", "del", "self", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Project.hook_symbol
Resolve a dependency in a binary. Looks up the address of the given symbol, and then hooks that address. If the symbol was not available in the loaded libraries, this address may be provided by the CLE externs object. Additionally, if instead of a symbol name you provide an address, some secret...
angr/project.py
def hook_symbol(self, symbol_name, simproc, kwargs=None, replace=None): """ Resolve a dependency in a binary. Looks up the address of the given symbol, and then hooks that address. If the symbol was not available in the loaded libraries, this address may be provided by the CLE externs ob...
def hook_symbol(self, symbol_name, simproc, kwargs=None, replace=None): """ Resolve a dependency in a binary. Looks up the address of the given symbol, and then hooks that address. If the symbol was not available in the loaded libraries, this address may be provided by the CLE externs ob...
[ "Resolve", "a", "dependency", "in", "a", "binary", ".", "Looks", "up", "the", "address", "of", "the", "given", "symbol", "and", "then", "hooks", "that", "address", ".", "If", "the", "symbol", "was", "not", "available", "in", "the", "loaded", "libraries", ...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/project.py#L474-L522
[ "def", "hook_symbol", "(", "self", ",", "symbol_name", ",", "simproc", ",", "kwargs", "=", "None", ",", "replace", "=", "None", ")", ":", "if", "type", "(", "symbol_name", ")", "is", "not", "int", ":", "sym", "=", "self", ".", "loader", ".", "find_sy...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Project.is_symbol_hooked
Check if a symbol is already hooked. :param str symbol_name: Name of the symbol. :return: True if the symbol can be resolved and is hooked, False otherwise. :rtype: bool
angr/project.py
def is_symbol_hooked(self, symbol_name): """ Check if a symbol is already hooked. :param str symbol_name: Name of the symbol. :return: True if the symbol can be resolved and is hooked, False otherwise. :rtype: bool """ sym = self.loader.find_symbol(symbol_name) ...
def is_symbol_hooked(self, symbol_name): """ Check if a symbol is already hooked. :param str symbol_name: Name of the symbol. :return: True if the symbol can be resolved and is hooked, False otherwise. :rtype: bool """ sym = self.loader.find_symbol(symbol_name) ...
[ "Check", "if", "a", "symbol", "is", "already", "hooked", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/project.py#L524-L537
[ "def", "is_symbol_hooked", "(", "self", ",", "symbol_name", ")", ":", "sym", "=", "self", ".", "loader", ".", "find_symbol", "(", "symbol_name", ")", "if", "sym", "is", "None", ":", "l", ".", "warning", "(", "\"Could not find symbol %s\"", ",", "symbol_name"...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Project.unhook_symbol
Remove the hook on a symbol. This function will fail if the symbol is provided by the extern object, as that would result in a state where analysis would be unable to cope with a call to this symbol.
angr/project.py
def unhook_symbol(self, symbol_name): """ Remove the hook on a symbol. This function will fail if the symbol is provided by the extern object, as that would result in a state where analysis would be unable to cope with a call to this symbol. """ sym = self.loader.find_sym...
def unhook_symbol(self, symbol_name): """ Remove the hook on a symbol. This function will fail if the symbol is provided by the extern object, as that would result in a state where analysis would be unable to cope with a call to this symbol. """ sym = self.loader.find_sym...
[ "Remove", "the", "hook", "on", "a", "symbol", ".", "This", "function", "will", "fail", "if", "the", "symbol", "is", "provided", "by", "the", "extern", "object", "as", "that", "would", "result", "in", "a", "state", "where", "analysis", "would", "be", "una...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/project.py#L539-L556
[ "def", "unhook_symbol", "(", "self", ",", "symbol_name", ")", ":", "sym", "=", "self", ".", "loader", ".", "find_symbol", "(", "symbol_name", ")", "if", "sym", "is", "None", ":", "l", ".", "warning", "(", "\"Could not find symbol %s\"", ",", "symbol_name", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Project.rehook_symbol
Move the hook for a symbol to a specific address :param new_address: the new address that will trigger the SimProc execution :param symbol_name: the name of the symbol (f.i. strcmp ) :return: None
angr/project.py
def rehook_symbol(self, new_address, symbol_name): """ Move the hook for a symbol to a specific address :param new_address: the new address that will trigger the SimProc execution :param symbol_name: the name of the symbol (f.i. strcmp ) :return: None """ new_sim_...
def rehook_symbol(self, new_address, symbol_name): """ Move the hook for a symbol to a specific address :param new_address: the new address that will trigger the SimProc execution :param symbol_name: the name of the symbol (f.i. strcmp ) :return: None """ new_sim_...
[ "Move", "the", "hook", "for", "a", "symbol", "to", "a", "specific", "address", ":", "param", "new_address", ":", "the", "new", "address", "that", "will", "trigger", "the", "SimProc", "execution", ":", "param", "symbol_name", ":", "the", "name", "of", "the"...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/project.py#L558-L572
[ "def", "rehook_symbol", "(", "self", ",", "new_address", ",", "symbol_name", ")", ":", "new_sim_procedures", "=", "{", "}", "for", "key_address", ",", "simproc_obj", "in", "self", ".", "_sim_procedures", ".", "items", "(", ")", ":", "if", "simproc_obj", ".",...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Project.execute
This function is a symbolic execution helper in the simple style supported by triton and manticore. It designed to be run after setting up hooks (see Project.hook), in which the symbolic state can be checked. This function can be run in three different ways: - When run with...
angr/project.py
def execute(self, *args, **kwargs): """ This function is a symbolic execution helper in the simple style supported by triton and manticore. It designed to be run after setting up hooks (see Project.hook), in which the symbolic state can be checked. This function can be r...
def execute(self, *args, **kwargs): """ This function is a symbolic execution helper in the simple style supported by triton and manticore. It designed to be run after setting up hooks (see Project.hook), in which the symbolic state can be checked. This function can be r...
[ "This", "function", "is", "a", "symbolic", "execution", "helper", "in", "the", "simple", "style", "supported", "by", "triton", "and", "manticore", ".", "It", "designed", "to", "be", "run", "after", "setting", "up", "hooks", "(", "see", "Project", ".", "hoo...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/project.py#L578-L605
[ "def", "execute", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "args", ":", "state", "=", "args", "[", "0", "]", "else", ":", "state", "=", "self", ".", "factory", ".", "full_init_state", "(", "*", "*", "kwargs", ")", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Project._hook_decorator
Return a function decorator that allows easy hooking. Please refer to hook() for its usage. :return: The function decorator.
angr/project.py
def _hook_decorator(self, addr, length=0, kwargs=None): """ Return a function decorator that allows easy hooking. Please refer to hook() for its usage. :return: The function decorator. """ def hook_decorator(func): self.hook(addr, func, length=length, kwargs=kwargs)...
def _hook_decorator(self, addr, length=0, kwargs=None): """ Return a function decorator that allows easy hooking. Please refer to hook() for its usage. :return: The function decorator. """ def hook_decorator(func): self.hook(addr, func, length=length, kwargs=kwargs)...
[ "Return", "a", "function", "decorator", "that", "allows", "easy", "hooking", ".", "Please", "refer", "to", "hook", "()", "for", "its", "usage", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/project.py#L617-L628
[ "def", "_hook_decorator", "(", "self", ",", "addr", ",", "length", "=", "0", ",", "kwargs", "=", "None", ")", ":", "def", "hook_decorator", "(", "func", ")", ":", "self", ".", "hook", "(", "addr", ",", "func", ",", "length", "=", "length", ",", "kw...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Project.is_java_project
Indicates if the project's main binary is a Java Archive.
angr/project.py
def is_java_project(self): """ Indicates if the project's main binary is a Java Archive. """ if self._is_java_project is None: self._is_java_project = isinstance(self.arch, ArchSoot) return self._is_java_project
def is_java_project(self): """ Indicates if the project's main binary is a Java Archive. """ if self._is_java_project is None: self._is_java_project = isinstance(self.arch, ArchSoot) return self._is_java_project
[ "Indicates", "if", "the", "project", "s", "main", "binary", "is", "a", "Java", "Archive", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/project.py#L701-L707
[ "def", "is_java_project", "(", "self", ")", ":", "if", "self", ".", "_is_java_project", "is", "None", ":", "self", ".", "_is_java_project", "=", "isinstance", "(", "self", ".", "arch", ",", "ArchSoot", ")", "return", "self", ".", "_is_java_project" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Project.is_java_jni_project
Indicates if the project's main binary is a Java Archive, which interacts during its execution with native libraries (via JNI).
angr/project.py
def is_java_jni_project(self): """ Indicates if the project's main binary is a Java Archive, which interacts during its execution with native libraries (via JNI). """ if self._is_java_jni_project is None: self._is_java_jni_project = isinstance(self.arch, ArchSoot) and...
def is_java_jni_project(self): """ Indicates if the project's main binary is a Java Archive, which interacts during its execution with native libraries (via JNI). """ if self._is_java_jni_project is None: self._is_java_jni_project = isinstance(self.arch, ArchSoot) and...
[ "Indicates", "if", "the", "project", "s", "main", "binary", "is", "a", "Java", "Archive", "which", "interacts", "during", "its", "execution", "with", "native", "libraries", "(", "via", "JNI", ")", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/project.py#L710-L717
[ "def", "is_java_jni_project", "(", "self", ")", ":", "if", "self", ".", "_is_java_jni_project", "is", "None", ":", "self", ".", "_is_java_jni_project", "=", "isinstance", "(", "self", ".", "arch", ",", "ArchSoot", ")", "and", "self", ".", "simos", ".", "is...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
PluginHub.register_preset
Register a preset instance with the class of the hub it corresponds to. This allows individual plugin objects to automatically register themselves with a preset by using a classmethod of their own with only the name of the preset to register with.
angr/misc/plugins.py
def register_preset(cls, name, preset): """ Register a preset instance with the class of the hub it corresponds to. This allows individual plugin objects to automatically register themselves with a preset by using a classmethod of their own with only the name of the preset to register wi...
def register_preset(cls, name, preset): """ Register a preset instance with the class of the hub it corresponds to. This allows individual plugin objects to automatically register themselves with a preset by using a classmethod of their own with only the name of the preset to register wi...
[ "Register", "a", "preset", "instance", "with", "the", "class", "of", "the", "hub", "it", "corresponds", "to", ".", "This", "allows", "individual", "plugin", "objects", "to", "automatically", "register", "themselves", "with", "a", "preset", "by", "using", "a", ...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/misc/plugins.py#L42-L50
[ "def", "register_preset", "(", "cls", ",", "name", ",", "preset", ")", ":", "if", "cls", ".", "_presets", "is", "None", ":", "cls", ".", "_presets", "=", "{", "}", "cls", ".", "_presets", "[", "name", "]", "=", "preset" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
PluginHub.use_plugin_preset
Apply a preset to the hub. If there was a previously active preset, discard it. Preset can be either the string name of a preset or a PluginPreset instance.
angr/misc/plugins.py
def use_plugin_preset(self, preset): """ Apply a preset to the hub. If there was a previously active preset, discard it. Preset can be either the string name of a preset or a PluginPreset instance. """ if isinstance(preset, str): try: preset = self._p...
def use_plugin_preset(self, preset): """ Apply a preset to the hub. If there was a previously active preset, discard it. Preset can be either the string name of a preset or a PluginPreset instance. """ if isinstance(preset, str): try: preset = self._p...
[ "Apply", "a", "preset", "to", "the", "hub", ".", "If", "there", "was", "a", "previously", "active", "preset", "discard", "it", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/misc/plugins.py#L109-L129
[ "def", "use_plugin_preset", "(", "self", ",", "preset", ")", ":", "if", "isinstance", "(", "preset", ",", "str", ")", ":", "try", ":", "preset", "=", "self", ".", "_presets", "[", "preset", "]", "except", "(", "AttributeError", ",", "KeyError", ")", ":...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
PluginHub.discard_plugin_preset
Discard the current active preset. Will release any active plugins that could have come from the old preset.
angr/misc/plugins.py
def discard_plugin_preset(self): """ Discard the current active preset. Will release any active plugins that could have come from the old preset. """ if self.has_plugin_preset: for name, plugin in list(self._active_plugins.items()): if id(plugin) in self._prov...
def discard_plugin_preset(self): """ Discard the current active preset. Will release any active plugins that could have come from the old preset. """ if self.has_plugin_preset: for name, plugin in list(self._active_plugins.items()): if id(plugin) in self._prov...
[ "Discard", "the", "current", "active", "preset", ".", "Will", "release", "any", "active", "plugins", "that", "could", "have", "come", "from", "the", "old", "preset", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/misc/plugins.py#L131-L140
[ "def", "discard_plugin_preset", "(", "self", ")", ":", "if", "self", ".", "has_plugin_preset", ":", "for", "name", ",", "plugin", "in", "list", "(", "self", ".", "_active_plugins", ".", "items", "(", ")", ")", ":", "if", "id", "(", "plugin", ")", "in",...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
PluginHub.get_plugin
Get the plugin named ``name``. If no such plugin is currently active, try to activate a new one using the current preset.
angr/misc/plugins.py
def get_plugin(self, name): """ Get the plugin named ``name``. If no such plugin is currently active, try to activate a new one using the current preset. """ if name in self._active_plugins: return self._active_plugins[name] elif self.has_plugin_preset: ...
def get_plugin(self, name): """ Get the plugin named ``name``. If no such plugin is currently active, try to activate a new one using the current preset. """ if name in self._active_plugins: return self._active_plugins[name] elif self.has_plugin_preset: ...
[ "Get", "the", "plugin", "named", "name", ".", "If", "no", "such", "plugin", "is", "currently", "active", "try", "to", "activate", "a", "new", "one", "using", "the", "current", "preset", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/misc/plugins.py#L146-L165
[ "def", "get_plugin", "(", "self", ",", "name", ")", ":", "if", "name", "in", "self", ".", "_active_plugins", ":", "return", "self", ".", "_active_plugins", "[", "name", "]", "elif", "self", ".", "has_plugin_preset", ":", "plugin_cls", "=", "self", ".", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
PluginHub.register_plugin
Add a new plugin ``plugin`` with name ``name`` to the active plugins.
angr/misc/plugins.py
def register_plugin(self, name, plugin): """ Add a new plugin ``plugin`` with name ``name`` to the active plugins. """ if self.has_plugin(name): self.release_plugin(name) self._active_plugins[name] = plugin setattr(self, name, plugin) return plugin
def register_plugin(self, name, plugin): """ Add a new plugin ``plugin`` with name ``name`` to the active plugins. """ if self.has_plugin(name): self.release_plugin(name) self._active_plugins[name] = plugin setattr(self, name, plugin) return plugin
[ "Add", "a", "new", "plugin", "plugin", "with", "name", "name", "to", "the", "active", "plugins", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/misc/plugins.py#L181-L189
[ "def", "register_plugin", "(", "self", ",", "name", ",", "plugin", ")", ":", "if", "self", ".", "has_plugin", "(", "name", ")", ":", "self", ".", "release_plugin", "(", "name", ")", "self", ".", "_active_plugins", "[", "name", "]", "=", "plugin", "seta...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
PluginHub.release_plugin
Deactivate and remove the plugin with name ``name``.
angr/misc/plugins.py
def release_plugin(self, name): """ Deactivate and remove the plugin with name ``name``. """ plugin = self._active_plugins[name] if id(plugin) in self._provided_by_preset: self._provided_by_preset.remove(id(plugin)) del self._active_plugins[name] dela...
def release_plugin(self, name): """ Deactivate and remove the plugin with name ``name``. """ plugin = self._active_plugins[name] if id(plugin) in self._provided_by_preset: self._provided_by_preset.remove(id(plugin)) del self._active_plugins[name] dela...
[ "Deactivate", "and", "remove", "the", "plugin", "with", "name", "name", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/misc/plugins.py#L191-L200
[ "def", "release_plugin", "(", "self", ",", "name", ")", ":", "plugin", "=", "self", ".", "_active_plugins", "[", "name", "]", "if", "id", "(", "plugin", ")", "in", "self", ".", "_provided_by_preset", ":", "self", ".", "_provided_by_preset", ".", "remove", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
PluginPreset.copy
Return a copy of self.
angr/misc/plugins.py
def copy(self): """ Return a copy of self. """ cls = self.__class__ result = cls.__new__(cls) result._default_plugins = dict(self._default_plugins) # pylint:disable=protected-access return result
def copy(self): """ Return a copy of self. """ cls = self.__class__ result = cls.__new__(cls) result._default_plugins = dict(self._default_plugins) # pylint:disable=protected-access return result
[ "Return", "a", "copy", "of", "self", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/misc/plugins.py#L249-L256
[ "def", "copy", "(", "self", ")", ":", "cls", "=", "self", ".", "__class__", "result", "=", "cls", ".", "__new__", "(", "cls", ")", "result", ".", "_default_plugins", "=", "dict", "(", "self", ".", "_default_plugins", ")", "# pylint:disable=protected-access",...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Tracer._grab_concretization_results
Grabs the concretized result so we can add the constraint ourselves.
angr/exploration_techniques/tracer.py
def _grab_concretization_results(cls, state): """ Grabs the concretized result so we can add the constraint ourselves. """ # only grab ones that match the constrained addrs if cls._should_add_constraints(state): addr = state.inspect.address_concretization_expr ...
def _grab_concretization_results(cls, state): """ Grabs the concretized result so we can add the constraint ourselves. """ # only grab ones that match the constrained addrs if cls._should_add_constraints(state): addr = state.inspect.address_concretization_expr ...
[ "Grabs", "the", "concretized", "result", "so", "we", "can", "add", "the", "constraint", "ourselves", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/tracer.py#L459-L470
[ "def", "_grab_concretization_results", "(", "cls", ",", "state", ")", ":", "# only grab ones that match the constrained addrs", "if", "cls", ".", "_should_add_constraints", "(", "state", ")", ":", "addr", "=", "state", ".", "inspect", ".", "address_concretization_expr",...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Tracer._should_add_constraints
Check to see if the current address concretization variable is any of the registered constrained_addrs we want to allow concretization for
angr/exploration_techniques/tracer.py
def _should_add_constraints(cls, state): """ Check to see if the current address concretization variable is any of the registered constrained_addrs we want to allow concretization for """ expr = state.inspect.address_concretization_expr hit_indices = cls._to_indices(state...
def _should_add_constraints(cls, state): """ Check to see if the current address concretization variable is any of the registered constrained_addrs we want to allow concretization for """ expr = state.inspect.address_concretization_expr hit_indices = cls._to_indices(state...
[ "Check", "to", "see", "if", "the", "current", "address", "concretization", "variable", "is", "any", "of", "the", "registered", "constrained_addrs", "we", "want", "to", "allow", "concretization", "for" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/tracer.py#L482-L494
[ "def", "_should_add_constraints", "(", "cls", ",", "state", ")", ":", "expr", "=", "state", ".", "inspect", ".", "address_concretization_expr", "hit_indices", "=", "cls", ".", "_to_indices", "(", "state", ",", "expr", ")", "for", "action", "in", "state", "."...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimHeapBrk.allocate
The actual allocation primitive for this heap implementation. Increases the position of the break to allocate space. Has no guards against the heap growing too large. :param sim_size: a size specifying how much to increase the break pointer by :returns: a pointer to the previous break position,...
angr/state_plugins/heap/heap_brk.py
def allocate(self, sim_size): """ The actual allocation primitive for this heap implementation. Increases the position of the break to allocate space. Has no guards against the heap growing too large. :param sim_size: a size specifying how much to increase the break pointer by :...
def allocate(self, sim_size): """ The actual allocation primitive for this heap implementation. Increases the position of the break to allocate space. Has no guards against the heap growing too large. :param sim_size: a size specifying how much to increase the break pointer by :...
[ "The", "actual", "allocation", "primitive", "for", "this", "heap", "implementation", ".", "Increases", "the", "position", "of", "the", "break", "to", "allocate", "space", ".", "Has", "no", "guards", "against", "the", "heap", "growing", "too", "large", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_brk.py#L31-L43
[ "def", "allocate", "(", "self", ",", "sim_size", ")", ":", "size", "=", "self", ".", "_conc_alloc_size", "(", "sim_size", ")", "addr", "=", "self", ".", "state", ".", "heap", ".", "heap_location", "self", ".", "state", ".", "heap", ".", "heap_location", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimHeapBrk.release
The memory release primitive for this heap implementation. Decreases the position of the break to deallocate space. Guards against releasing beyond the initial heap base. :param sim_size: a size specifying how much to decrease the break pointer by (may be symbolic or not)
angr/state_plugins/heap/heap_brk.py
def release(self, sim_size): """ The memory release primitive for this heap implementation. Decreases the position of the break to deallocate space. Guards against releasing beyond the initial heap base. :param sim_size: a size specifying how much to decrease the break pointer by (may b...
def release(self, sim_size): """ The memory release primitive for this heap implementation. Decreases the position of the break to deallocate space. Guards against releasing beyond the initial heap base. :param sim_size: a size specifying how much to decrease the break pointer by (may b...
[ "The", "memory", "release", "primitive", "for", "this", "heap", "implementation", ".", "Decreases", "the", "position", "of", "the", "break", "to", "deallocate", "space", ".", "Guards", "against", "releasing", "beyond", "the", "initial", "heap", "base", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_brk.py#L45-L56
[ "def", "release", "(", "self", ",", "sim_size", ")", ":", "requested", "=", "self", ".", "_conc_alloc_size", "(", "sim_size", ")", "used", "=", "self", ".", "heap_location", "-", "self", ".", "heap_base", "released", "=", "requested", "if", "requested", "<...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
get_function_name
Get the function name from a C-style function declaration string. :param str s: A C-style function declaration string. :return: The function name. :rtype: str
angr/utils/library.py
def get_function_name(s): """ Get the function name from a C-style function declaration string. :param str s: A C-style function declaration string. :return: The function name. :rtype: str """ s = s.strip() if s.startswith("__attribute__"): # Remove "__attribute__ ((...
def get_function_name(s): """ Get the function name from a C-style function declaration string. :param str s: A C-style function declaration string. :return: The function name. :rtype: str """ s = s.strip() if s.startswith("__attribute__"): # Remove "__attribute__ ((...
[ "Get", "the", "function", "name", "from", "a", "C", "-", "style", "function", "declaration", "string", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/utils/library.py#L5-L36
[ "def", "get_function_name", "(", "s", ")", ":", "s", "=", "s", ".", "strip", "(", ")", "if", "s", ".", "startswith", "(", "\"__attribute__\"", ")", ":", "# Remove \"__attribute__ ((foobar))\"", "if", "\"))\"", "not", "in", "s", ":", "raise", "ValueError", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
convert_cproto_to_py
Convert a C-style function declaration string to its corresponding SimTypes-based Python representation. :param str c_decl: The C-style function declaration string. :return: A tuple of the function name, the prototype, and a string representing the ...
angr/utils/library.py
def convert_cproto_to_py(c_decl): """ Convert a C-style function declaration string to its corresponding SimTypes-based Python representation. :param str c_decl: The C-style function declaration string. :return: A tuple of the function name, the prototype, and a stri...
def convert_cproto_to_py(c_decl): """ Convert a C-style function declaration string to its corresponding SimTypes-based Python representation. :param str c_decl: The C-style function declaration string. :return: A tuple of the function name, the prototype, and a stri...
[ "Convert", "a", "C", "-", "style", "function", "declaration", "string", "to", "its", "corresponding", "SimTypes", "-", "based", "Python", "representation", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/utils/library.py#L39-L73
[ "def", "convert_cproto_to_py", "(", "c_decl", ")", ":", "s", "=", "[", "]", "try", ":", "s", ".", "append", "(", "'# %s'", "%", "c_decl", ")", "# comment string", "parsed", "=", "parse_file", "(", "c_decl", ")", "parsed_decl", "=", "parsed", "[", "0", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
PTChunk.set_size
Use this to set the size on a chunk. When the chunk is new (such as when a free chunk is shrunk to form an allocated chunk and a remainder free chunk) it is recommended that the is_free hint be used since setting the size depends on the chunk's freeness, and vice versa. :param size: size of the...
angr/state_plugins/heap/heap_ptmalloc.py
def set_size(self, size, is_free=None): #pylint:disable=arguments-differ """ Use this to set the size on a chunk. When the chunk is new (such as when a free chunk is shrunk to form an allocated chunk and a remainder free chunk) it is recommended that the is_free hint be used since setting the ...
def set_size(self, size, is_free=None): #pylint:disable=arguments-differ """ Use this to set the size on a chunk. When the chunk is new (such as when a free chunk is shrunk to form an allocated chunk and a remainder free chunk) it is recommended that the is_free hint be used since setting the ...
[ "Use", "this", "to", "set", "the", "size", "on", "a", "chunk", ".", "When", "the", "chunk", "is", "new", "(", "such", "as", "when", "a", "free", "chunk", "is", "shrunk", "to", "form", "an", "allocated", "chunk", "and", "a", "remainder", "free", "chun...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L64-L82
[ "def", "set_size", "(", "self", ",", "size", ",", "is_free", "=", "None", ")", ":", "#pylint:disable=arguments-differ", "self", ".", "_set_leading_size", "(", "size", ")", "next_chunk", "=", "self", ".", "next_chunk", "(", ")", "if", "is_free", "is", "not", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
PTChunk.set_prev_freeness
Sets (or unsets) the flag controlling whether the previous chunk is free. :param is_free: if True, sets the previous chunk to be free; if False, sets it to be allocated
angr/state_plugins/heap/heap_ptmalloc.py
def set_prev_freeness(self, is_free): """ Sets (or unsets) the flag controlling whether the previous chunk is free. :param is_free: if True, sets the previous chunk to be free; if False, sets it to be allocated """ level = silence_logger() size_field = self.state.memory....
def set_prev_freeness(self, is_free): """ Sets (or unsets) the flag controlling whether the previous chunk is free. :param is_free: if True, sets the previous chunk to be free; if False, sets it to be allocated """ level = silence_logger() size_field = self.state.memory....
[ "Sets", "(", "or", "unsets", ")", "the", "flag", "controlling", "whether", "the", "previous", "chunk", "is", "free", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L84-L96
[ "def", "set_prev_freeness", "(", "self", ",", "is_free", ")", ":", "level", "=", "silence_logger", "(", ")", "size_field", "=", "self", ".", "state", ".", "memory", ".", "load", "(", "self", ".", "base", "+", "self", ".", "_chunk_size_t_size", ",", "self...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
PTChunk.is_prev_free
Returns a concrete state of the flag indicating whether the previous chunk is free or not. Issues a warning if that flag is symbolic and has multiple solutions, and then assumes that the previous chunk is free. :returns: True if the previous chunk is free; False otherwise
angr/state_plugins/heap/heap_ptmalloc.py
def is_prev_free(self): """ Returns a concrete state of the flag indicating whether the previous chunk is free or not. Issues a warning if that flag is symbolic and has multiple solutions, and then assumes that the previous chunk is free. :returns: True if the previous chunk is free; Fa...
def is_prev_free(self): """ Returns a concrete state of the flag indicating whether the previous chunk is free or not. Issues a warning if that flag is symbolic and has multiple solutions, and then assumes that the previous chunk is free. :returns: True if the previous chunk is free; Fa...
[ "Returns", "a", "concrete", "state", "of", "the", "flag", "indicating", "whether", "the", "previous", "chunk", "is", "free", "or", "not", ".", "Issues", "a", "warning", "if", "that", "flag", "is", "symbolic", "and", "has", "multiple", "solutions", "and", "...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L98-L112
[ "def", "is_prev_free", "(", "self", ")", ":", "flag", "=", "self", ".", "state", ".", "memory", ".", "load", "(", "self", ".", "base", "+", "self", ".", "_chunk_size_t_size", ",", "self", ".", "_chunk_size_t_size", ")", "&", "CHUNK_P_MASK", "def", "sym_f...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
PTChunk.prev_size
Returns the size of the previous chunk, masking off what would be the flag bits if it were in the actual size field. Performs NO CHECKING to determine whether the previous chunk size is valid (for example, when the previous chunk is not free, its size cannot be determined).
angr/state_plugins/heap/heap_ptmalloc.py
def prev_size(self): """ Returns the size of the previous chunk, masking off what would be the flag bits if it were in the actual size field. Performs NO CHECKING to determine whether the previous chunk size is valid (for example, when the previous chunk is not free, its size cannot be d...
def prev_size(self): """ Returns the size of the previous chunk, masking off what would be the flag bits if it were in the actual size field. Performs NO CHECKING to determine whether the previous chunk size is valid (for example, when the previous chunk is not free, its size cannot be d...
[ "Returns", "the", "size", "of", "the", "previous", "chunk", "masking", "off", "what", "would", "be", "the", "flag", "bits", "if", "it", "were", "in", "the", "actual", "size", "field", ".", "Performs", "NO", "CHECKING", "to", "determine", "whether", "the", ...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L114-L120
[ "def", "prev_size", "(", "self", ")", ":", "return", "self", ".", "state", ".", "memory", ".", "load", "(", "self", ".", "base", ",", "self", ".", "_chunk_size_t_size", ")", "&", "~", "CHUNK_FLAGS_MASK" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
PTChunk.next_chunk
Returns the chunk immediately following (and adjacent to) this one, if it exists. :returns: The following chunk, or None if applicable
angr/state_plugins/heap/heap_ptmalloc.py
def next_chunk(self): """ Returns the chunk immediately following (and adjacent to) this one, if it exists. :returns: The following chunk, or None if applicable """ def sym_base_handler(base): l.warning("A computed chunk base is symbolic; maximizing it") ...
def next_chunk(self): """ Returns the chunk immediately following (and adjacent to) this one, if it exists. :returns: The following chunk, or None if applicable """ def sym_base_handler(base): l.warning("A computed chunk base is symbolic; maximizing it") ...
[ "Returns", "the", "chunk", "immediately", "following", "(", "and", "adjacent", "to", ")", "this", "one", "if", "it", "exists", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L143-L158
[ "def", "next_chunk", "(", "self", ")", ":", "def", "sym_base_handler", "(", "base", ")", ":", "l", ".", "warning", "(", "\"A computed chunk base is symbolic; maximizing it\"", ")", "return", "self", ".", "state", ".", "solver", ".", "max_int", "(", "base", ")"...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
PTChunk.prev_chunk
Returns the chunk immediately prior (and adjacent) to this one, if that chunk is free. If the prior chunk is not free, then its base cannot be located and this method raises an error. :returns: If possible, the previous chunk; otherwise, raises an error
angr/state_plugins/heap/heap_ptmalloc.py
def prev_chunk(self): """ Returns the chunk immediately prior (and adjacent) to this one, if that chunk is free. If the prior chunk is not free, then its base cannot be located and this method raises an error. :returns: If possible, the previous chunk; otherwise, raises an error ...
def prev_chunk(self): """ Returns the chunk immediately prior (and adjacent) to this one, if that chunk is free. If the prior chunk is not free, then its base cannot be located and this method raises an error. :returns: If possible, the previous chunk; otherwise, raises an error ...
[ "Returns", "the", "chunk", "immediately", "prior", "(", "and", "adjacent", ")", "to", "this", "one", "if", "that", "chunk", "is", "free", ".", "If", "the", "prior", "chunk", "is", "not", "free", "then", "its", "base", "cannot", "be", "located", "and", ...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L160-L170
[ "def", "prev_chunk", "(", "self", ")", ":", "if", "self", ".", "is_prev_free", "(", ")", ":", "return", "PTChunk", "(", "self", ".", "base", "-", "self", ".", "prev_size", "(", ")", ",", "self", ".", "state", ")", "else", ":", "raise", "SimHeapError"...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
PTChunk.fwd_chunk
Returns the chunk following this chunk in the list of free chunks. If this chunk is not free, then it resides in no such list and this method raises an error. :returns: If possible, the forward chunk; otherwise, raises an error
angr/state_plugins/heap/heap_ptmalloc.py
def fwd_chunk(self): """ Returns the chunk following this chunk in the list of free chunks. If this chunk is not free, then it resides in no such list and this method raises an error. :returns: If possible, the forward chunk; otherwise, raises an error """ if self.is_fre...
def fwd_chunk(self): """ Returns the chunk following this chunk in the list of free chunks. If this chunk is not free, then it resides in no such list and this method raises an error. :returns: If possible, the forward chunk; otherwise, raises an error """ if self.is_fre...
[ "Returns", "the", "chunk", "following", "this", "chunk", "in", "the", "list", "of", "free", "chunks", ".", "If", "this", "chunk", "is", "not", "free", "then", "it", "resides", "in", "no", "such", "list", "and", "this", "method", "raises", "an", "error", ...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L172-L183
[ "def", "fwd_chunk", "(", "self", ")", ":", "if", "self", ".", "is_free", "(", ")", ":", "base", "=", "self", ".", "state", ".", "memory", ".", "load", "(", "self", ".", "base", "+", "2", "*", "self", ".", "_chunk_size_t_size", ",", "self", ".", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimHeapPTMalloc.chunk_from_mem
Given a pointer to a user payload, return the base of the chunk associated with that payload (i.e. the chunk pointer). Returns None if ptr is null. :param ptr: a pointer to the base of a user payload in the heap :returns: a pointer to the base of the associated heap chunk, or None if ptr is nul...
angr/state_plugins/heap/heap_ptmalloc.py
def chunk_from_mem(self, ptr): """ Given a pointer to a user payload, return the base of the chunk associated with that payload (i.e. the chunk pointer). Returns None if ptr is null. :param ptr: a pointer to the base of a user payload in the heap :returns: a pointer to the base ...
def chunk_from_mem(self, ptr): """ Given a pointer to a user payload, return the base of the chunk associated with that payload (i.e. the chunk pointer). Returns None if ptr is null. :param ptr: a pointer to the base of a user payload in the heap :returns: a pointer to the base ...
[ "Given", "a", "pointer", "to", "a", "user", "payload", "return", "the", "base", "of", "the", "chunk", "associated", "with", "that", "payload", "(", "i", ".", "e", ".", "the", "chunk", "pointer", ")", ".", "Returns", "None", "if", "ptr", "is", "null", ...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L263-L279
[ "def", "chunk_from_mem", "(", "self", ",", "ptr", ")", ":", "if", "self", ".", "state", ".", "solver", ".", "symbolic", "(", "ptr", ")", ":", "try", ":", "ptr", "=", "self", ".", "state", ".", "solver", ".", "eval_one", "(", "ptr", ")", "except", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimHeapPTMalloc._find_bck
Simply finds the free chunk that would be the backwards chunk relative to the chunk at ptr. Hence, the free head and all other metadata are unaltered by this function.
angr/state_plugins/heap/heap_ptmalloc.py
def _find_bck(self, chunk): """ Simply finds the free chunk that would be the backwards chunk relative to the chunk at ptr. Hence, the free head and all other metadata are unaltered by this function. """ cur = self.free_head_chunk if cur is None: return None ...
def _find_bck(self, chunk): """ Simply finds the free chunk that would be the backwards chunk relative to the chunk at ptr. Hence, the free head and all other metadata are unaltered by this function. """ cur = self.free_head_chunk if cur is None: return None ...
[ "Simply", "finds", "the", "free", "chunk", "that", "would", "be", "the", "backwards", "chunk", "relative", "to", "the", "chunk", "at", "ptr", ".", "Hence", "the", "free", "head", "and", "all", "other", "metadata", "are", "unaltered", "by", "this", "functio...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L281-L302
[ "def", "_find_bck", "(", "self", ",", "chunk", ")", ":", "cur", "=", "self", ".", "free_head_chunk", "if", "cur", "is", "None", ":", "return", "None", "fwd", "=", "cur", ".", "fwd_chunk", "(", ")", "if", "cur", "==", "fwd", ":", "return", "cur", "#...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimHeapPTMalloc._set_final_freeness
Sets the freedom of the final chunk. Since no proper chunk follows the final chunk, the heap itself manages this. Nonetheless, for now it is implemented as if an additional chunk followed the final chunk.
angr/state_plugins/heap/heap_ptmalloc.py
def _set_final_freeness(self, flag): """ Sets the freedom of the final chunk. Since no proper chunk follows the final chunk, the heap itself manages this. Nonetheless, for now it is implemented as if an additional chunk followed the final chunk. """ if flag: self.stat...
def _set_final_freeness(self, flag): """ Sets the freedom of the final chunk. Since no proper chunk follows the final chunk, the heap itself manages this. Nonetheless, for now it is implemented as if an additional chunk followed the final chunk. """ if flag: self.stat...
[ "Sets", "the", "freedom", "of", "the", "final", "chunk", ".", "Since", "no", "proper", "chunk", "follows", "the", "final", "chunk", "the", "heap", "itself", "manages", "this", ".", "Nonetheless", "for", "now", "it", "is", "implemented", "as", "if", "an", ...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L304-L312
[ "def", "_set_final_freeness", "(", "self", ",", "flag", ")", ":", "if", "flag", ":", "self", ".", "state", ".", "memory", ".", "store", "(", "self", ".", "heap_base", "+", "self", ".", "heap_size", "-", "self", ".", "_chunk_size_t_size", ",", "~", "CHU...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimHeapPTMalloc._make_chunk_size
Takes an allocation size as requested by the user and modifies it to be a suitable chunk size.
angr/state_plugins/heap/heap_ptmalloc.py
def _make_chunk_size(self, req_size): """ Takes an allocation size as requested by the user and modifies it to be a suitable chunk size. """ size = req_size size += 2 * self._chunk_size_t_size # Two size fields size = self._chunk_min_size if size < self._chunk_min_size e...
def _make_chunk_size(self, req_size): """ Takes an allocation size as requested by the user and modifies it to be a suitable chunk size. """ size = req_size size += 2 * self._chunk_size_t_size # Two size fields size = self._chunk_min_size if size < self._chunk_min_size e...
[ "Takes", "an", "allocation", "size", "as", "requested", "by", "the", "user", "and", "modifies", "it", "to", "be", "a", "suitable", "chunk", "size", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L314-L323
[ "def", "_make_chunk_size", "(", "self", ",", "req_size", ")", ":", "size", "=", "req_size", "size", "+=", "2", "*", "self", ".", "_chunk_size_t_size", "# Two size fields", "size", "=", "self", ".", "_chunk_min_size", "if", "size", "<", "self", ".", "_chunk_m...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSootValue_StringRef.new_string
Allocate and initialize a new string in the context of the state passed. The method returns the reference to the newly allocated string :param state: angr state where we want to allocate the string :type SimState :param value: value of the string to initialize :type claripy.Str...
angr/engines/soot/values/strref.py
def new_string(state, value): """ Allocate and initialize a new string in the context of the state passed. The method returns the reference to the newly allocated string :param state: angr state where we want to allocate the string :type SimState :param value: value of ...
def new_string(state, value): """ Allocate and initialize a new string in the context of the state passed. The method returns the reference to the newly allocated string :param state: angr state where we want to allocate the string :type SimState :param value: value of ...
[ "Allocate", "and", "initialize", "a", "new", "string", "in", "the", "context", "of", "the", "state", "passed", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/soot/values/strref.py#L26-L41
[ "def", "new_string", "(", "state", ",", "value", ")", ":", "str_ref", "=", "SimSootValue_StringRef", "(", "state", ".", "memory", ".", "get_new_uuid", "(", ")", ")", "state", ".", "memory", ".", "store", "(", "str_ref", ",", "value", ")", "return", "str_...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
strtol.strtol_inner
:param s: the string address/offset :param state: SimState :param region: memory, file, etc :param base: the base to use to interpret the number note: all numbers may start with +/- and base 16 may start with 0x :param signed: boolean, true means the result will be signed, otherw...
angr/procedures/libc/strtol.py
def strtol_inner(s, state, region, base, signed, read_length=None): """ :param s: the string address/offset :param state: SimState :param region: memory, file, etc :param base: the base to use to interpret the number note: all numbers may start with +/- and base 16 may st...
def strtol_inner(s, state, region, base, signed, read_length=None): """ :param s: the string address/offset :param state: SimState :param region: memory, file, etc :param base: the base to use to interpret the number note: all numbers may start with +/- and base 16 may st...
[ ":", "param", "s", ":", "the", "string", "address", "/", "offset", ":", "param", "state", ":", "SimState", ":", "param", "region", ":", "memory", "file", "etc", ":", "param", "base", ":", "the", "base", "to", "use", "to", "interpret", "the", "number", ...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/libc/strtol.py#L15-L55
[ "def", "strtol_inner", "(", "s", ",", "state", ",", "region", ",", "base", ",", "signed", ",", "read_length", "=", "None", ")", ":", "# sanity check", "if", "base", "<", "2", "or", "base", ">", "36", ":", "raise", "SimProcedureError", "(", "\"base should...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
strtol._load_num_with_prefix
loads a number from addr, and returns a condition that addr must start with the prefix
angr/procedures/libc/strtol.py
def _load_num_with_prefix(prefix, addr, region, state, base, signed, read_length=None): """ loads a number from addr, and returns a condition that addr must start with the prefix """ length = len(prefix) read_length = (read_length-length) if read_length else None conditio...
def _load_num_with_prefix(prefix, addr, region, state, base, signed, read_length=None): """ loads a number from addr, and returns a condition that addr must start with the prefix """ length = len(prefix) read_length = (read_length-length) if read_length else None conditio...
[ "loads", "a", "number", "from", "addr", "and", "returns", "a", "condition", "that", "addr", "must", "start", "with", "the", "prefix" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/libc/strtol.py#L58-L75
[ "def", "_load_num_with_prefix", "(", "prefix", ",", "addr", ",", "region", ",", "state", ",", "base", ",", "signed", ",", "read_length", "=", "None", ")", ":", "length", "=", "len", "(", "prefix", ")", "read_length", "=", "(", "read_length", "-", "length...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
strtol._string_to_int
reads values from s and generates the symbolic number that it would equal the first char is either a number in the given base, or the result is 0 expression indicates whether or not it was successful
angr/procedures/libc/strtol.py
def _string_to_int(s, state, region, base, signed, read_length=None): """ reads values from s and generates the symbolic number that it would equal the first char is either a number in the given base, or the result is 0 expression indicates whether or not it was successful """ ...
def _string_to_int(s, state, region, base, signed, read_length=None): """ reads values from s and generates the symbolic number that it would equal the first char is either a number in the given base, or the result is 0 expression indicates whether or not it was successful """ ...
[ "reads", "values", "from", "s", "and", "generates", "the", "symbolic", "number", "that", "it", "would", "equal", "the", "first", "char", "is", "either", "a", "number", "in", "the", "given", "base", "or", "the", "result", "is", "0", "expression", "indicates...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/libc/strtol.py#L78-L149
[ "def", "_string_to_int", "(", "s", ",", "state", ",", "region", ",", "base", ",", "signed", ",", "read_length", "=", "None", ")", ":", "# if length wasn't provided, read the maximum bytes", "length", "=", "state", ".", "libc", ".", "max_strtol_len", "if", "read_...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
strtol._char_to_val
converts a symbolic char to a number in the given base returns expression, result expression is a symbolic boolean indicating whether or not it was a valid number result is the value
angr/procedures/libc/strtol.py
def _char_to_val(char, base): """ converts a symbolic char to a number in the given base returns expression, result expression is a symbolic boolean indicating whether or not it was a valid number result is the value """ cases = [] # 0-9 max_digit ...
def _char_to_val(char, base): """ converts a symbolic char to a number in the given base returns expression, result expression is a symbolic boolean indicating whether or not it was a valid number result is the value """ cases = [] # 0-9 max_digit ...
[ "converts", "a", "symbolic", "char", "to", "a", "number", "in", "the", "given", "base", "returns", "expression", "result", "expression", "is", "a", "symbolic", "boolean", "indicating", "whether", "or", "not", "it", "was", "a", "valid", "number", "result", "i...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/libc/strtol.py#L152-L186
[ "def", "_char_to_val", "(", "char", ",", "base", ")", ":", "cases", "=", "[", "]", "# 0-9", "max_digit", "=", "claripy", ".", "BVV", "(", "b\"9\"", ")", "min_digit", "=", "claripy", ".", "BVV", "(", "b\"0\"", ")", "if", "base", "<", "10", ":", "max...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FormatString.replace
Implement printf - based on the stored format specifier information, format the values from the arg getter function `args` into a string. :param startpos: The index of the first argument to be used by the first element of the format string :param args: A function which, given an argum...
angr/procedures/stubs/format_parser.py
def replace(self, startpos, args): """ Implement printf - based on the stored format specifier information, format the values from the arg getter function `args` into a string. :param startpos: The index of the first argument to be used by the first element of the format string :...
def replace(self, startpos, args): """ Implement printf - based on the stored format specifier information, format the values from the arg getter function `args` into a string. :param startpos: The index of the first argument to be used by the first element of the format string :...
[ "Implement", "printf", "-", "based", "on", "the", "stored", "format", "specifier", "information", "format", "the", "values", "from", "the", "arg", "getter", "function", "args", "into", "a", "string", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/stubs/format_parser.py#L54-L113
[ "def", "replace", "(", "self", ",", "startpos", ",", "args", ")", ":", "argpos", "=", "startpos", "string", "=", "None", "for", "component", "in", "self", ".", "components", ":", "# if this is just concrete data", "if", "isinstance", "(", "component", ",", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FormatString.interpret
implement scanf - extract formatted data from memory or a file according to the stored format specifiers and store them into the pointers extracted from `args`. :param startpos: The index of the first argument corresponding to the first format element :param args: A function which, gi...
angr/procedures/stubs/format_parser.py
def interpret(self, startpos, args, addr=None, simfd=None): """ implement scanf - extract formatted data from memory or a file according to the stored format specifiers and store them into the pointers extracted from `args`. :param startpos: The index of the first argument correspond...
def interpret(self, startpos, args, addr=None, simfd=None): """ implement scanf - extract formatted data from memory or a file according to the stored format specifiers and store them into the pointers extracted from `args`. :param startpos: The index of the first argument correspond...
[ "implement", "scanf", "-", "extract", "formatted", "data", "from", "memory", "or", "a", "file", "according", "to", "the", "stored", "format", "specifiers", "and", "store", "them", "into", "the", "pointers", "extracted", "from", "args", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/stubs/format_parser.py#L115-L298
[ "def", "interpret", "(", "self", ",", "startpos", ",", "args", ",", "addr", "=", "None", ",", "simfd", "=", "None", ")", ":", "if", "simfd", "is", "not", "None", "and", "isinstance", "(", "simfd", ".", "read_storage", ",", "SimPackets", ")", ":", "ar...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FormatParser._mod_spec
Modified length specifiers: mapping between length modifiers and conversion specifiers. This generates all the possibilities, i.e. hhd, etc.
angr/procedures/stubs/format_parser.py
def _mod_spec(self): """ Modified length specifiers: mapping between length modifiers and conversion specifiers. This generates all the possibilities, i.e. hhd, etc. """ mod_spec={} for mod, sizes in self.int_len_mod.items(): for conv in self.int_sign['signe...
def _mod_spec(self): """ Modified length specifiers: mapping between length modifiers and conversion specifiers. This generates all the possibilities, i.e. hhd, etc. """ mod_spec={} for mod, sizes in self.int_len_mod.items(): for conv in self.int_sign['signe...
[ "Modified", "length", "specifiers", ":", "mapping", "between", "length", "modifiers", "and", "conversion", "specifiers", ".", "This", "generates", "all", "the", "possibilities", "i", ".", "e", ".", "hhd", "etc", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/stubs/format_parser.py#L396-L411
[ "def", "_mod_spec", "(", "self", ")", ":", "mod_spec", "=", "{", "}", "for", "mod", ",", "sizes", "in", "self", ".", "int_len_mod", ".", "items", "(", ")", ":", "for", "conv", "in", "self", ".", "int_sign", "[", "'signed'", "]", ":", "mod_spec", "[...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FormatParser._all_spec
All specifiers and their lengths.
angr/procedures/stubs/format_parser.py
def _all_spec(self): """ All specifiers and their lengths. """ base = self._mod_spec for spec in self.basic_spec: base[spec] = self.basic_spec[spec] return base
def _all_spec(self): """ All specifiers and their lengths. """ base = self._mod_spec for spec in self.basic_spec: base[spec] = self.basic_spec[spec] return base
[ "All", "specifiers", "and", "their", "lengths", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/stubs/format_parser.py#L414-L424
[ "def", "_all_spec", "(", "self", ")", ":", "base", "=", "self", ".", "_mod_spec", "for", "spec", "in", "self", ".", "basic_spec", ":", "base", "[", "spec", "]", "=", "self", ".", "basic_spec", "[", "spec", "]", "return", "base" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FormatParser._match_spec
match the string `nugget` to a format specifier.
angr/procedures/stubs/format_parser.py
def _match_spec(self, nugget): """ match the string `nugget` to a format specifier. """ # TODO: handle positional modifiers and other similar format string tricks. all_spec = self._all_spec # iterate through nugget throwing away anything which is an int # TODO st...
def _match_spec(self, nugget): """ match the string `nugget` to a format specifier. """ # TODO: handle positional modifiers and other similar format string tricks. all_spec = self._all_spec # iterate through nugget throwing away anything which is an int # TODO st...
[ "match", "the", "string", "nugget", "to", "a", "format", "specifier", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/stubs/format_parser.py#L429-L475
[ "def", "_match_spec", "(", "self", ",", "nugget", ")", ":", "# TODO: handle positional modifiers and other similar format string tricks.", "all_spec", "=", "self", ".", "_all_spec", "# iterate through nugget throwing away anything which is an int", "# TODO store this in a size variable...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FormatParser._get_fmt
Extract the actual formats from the format string `fmt`. :param list fmt: A list of format chars. :returns: a FormatString object
angr/procedures/stubs/format_parser.py
def _get_fmt(self, fmt): """ Extract the actual formats from the format string `fmt`. :param list fmt: A list of format chars. :returns: a FormatString object """ # iterate over the format string looking for format specifiers components = [ ] i = 0 ...
def _get_fmt(self, fmt): """ Extract the actual formats from the format string `fmt`. :param list fmt: A list of format chars. :returns: a FormatString object """ # iterate over the format string looking for format specifiers components = [ ] i = 0 ...
[ "Extract", "the", "actual", "formats", "from", "the", "format", "string", "fmt", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/stubs/format_parser.py#L477-L515
[ "def", "_get_fmt", "(", "self", ",", "fmt", ")", ":", "# iterate over the format string looking for format specifiers", "components", "=", "[", "]", "i", "=", "0", "while", "i", "<", "len", "(", "fmt", ")", ":", "if", "type", "(", "fmt", "[", "i", "]", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40