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
SimIROp._op_generic_StoU_saturation
Return unsigned saturated BV from signed BV. Min and max value should be unsigned.
angr/engines/vex/irop.py
def _op_generic_StoU_saturation(self, value, min_value, max_value): #pylint:disable=no-self-use """ Return unsigned saturated BV from signed BV. Min and max value should be unsigned. """ return claripy.If( claripy.SGT(value, max_value), max_value, ...
def _op_generic_StoU_saturation(self, value, min_value, max_value): #pylint:disable=no-self-use """ Return unsigned saturated BV from signed BV. Min and max value should be unsigned. """ return claripy.If( claripy.SGT(value, max_value), max_value, ...
[ "Return", "unsigned", "saturated", "BV", "from", "signed", "BV", ".", "Min", "and", "max", "value", "should", "be", "unsigned", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/vex/irop.py#L837-L845
[ "def", "_op_generic_StoU_saturation", "(", "self", ",", "value", ",", "min_value", ",", "max_value", ")", ":", "#pylint:disable=no-self-use", "return", "claripy", ".", "If", "(", "claripy", ".", "SGT", "(", "value", ",", "max_value", ")", ",", "max_value", ","...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
CFGFastSoot._scan_block
Scan a basic block starting at a specific address :param CFGJob cfg_job: The CFGJob instance. :return: a list of successors :rtype: list
angr/analyses/cfg/cfg_fast_soot.py
def _scan_block(self, cfg_job): """ Scan a basic block starting at a specific address :param CFGJob cfg_job: The CFGJob instance. :return: a list of successors :rtype: list """ addr = cfg_job.addr current_func_addr = cfg_job.func_addr if self._a...
def _scan_block(self, cfg_job): """ Scan a basic block starting at a specific address :param CFGJob cfg_job: The CFGJob instance. :return: a list of successors :rtype: list """ addr = cfg_job.addr current_func_addr = cfg_job.func_addr if self._a...
[ "Scan", "a", "basic", "block", "starting", "at", "a", "specific", "address" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_fast_soot.py#L299-L317
[ "def", "_scan_block", "(", "self", ",", "cfg_job", ")", ":", "addr", "=", "cfg_job", ".", "addr", "current_func_addr", "=", "cfg_job", ".", "func_addr", "if", "self", ".", "_addr_hooked_or_syscall", "(", "addr", ")", ":", "entries", "=", "self", ".", "_sca...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
CFGFastSoot._scan_soot_block
Generate a list of successors (generating them each as entries) to IRSB. Updates previous CFG nodes with edges. :param CFGJob cfg_job: The CFGJob instance. :param int current_func_addr: Address of the current function :return: a list of successors :rtype: list
angr/analyses/cfg/cfg_fast_soot.py
def _scan_soot_block(self, cfg_job, current_func_addr): """ Generate a list of successors (generating them each as entries) to IRSB. Updates previous CFG nodes with edges. :param CFGJob cfg_job: The CFGJob instance. :param int current_func_addr: Address of the current function ...
def _scan_soot_block(self, cfg_job, current_func_addr): """ Generate a list of successors (generating them each as entries) to IRSB. Updates previous CFG nodes with edges. :param CFGJob cfg_job: The CFGJob instance. :param int current_func_addr: Address of the current function ...
[ "Generate", "a", "list", "of", "successors", "(", "generating", "them", "each", "as", "entries", ")", "to", "IRSB", ".", "Updates", "previous", "CFG", "nodes", "with", "edges", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_fast_soot.py#L319-L369
[ "def", "_scan_soot_block", "(", "self", ",", "cfg_job", ",", "current_func_addr", ")", ":", "addr", ",", "function_addr", ",", "cfg_node", ",", "soot_block", "=", "self", ".", "_generate_cfgnode", "(", "cfg_job", ",", "current_func_addr", ")", "# Add edges going t...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
CFGFastSoot._create_jobs
Given a node and details of a successor, makes a list of CFGJobs and if it is a call or exit marks it appropriately so in the CFG :param int target: Destination of the resultant job :param str jumpkind: The jumpkind of the edge going to this node :param int current_funct...
angr/analyses/cfg/cfg_fast_soot.py
def _create_jobs(self, target, jumpkind, current_function_addr, soot_block, addr, cfg_node, stmt_addr, stmt_idx): # pylint:disable=arguments-differ """ Given a node and details of a successor, makes a list of CFGJobs and if it is a call or exit marks it appropriately so in the CFG :pa...
def _create_jobs(self, target, jumpkind, current_function_addr, soot_block, addr, cfg_node, stmt_addr, stmt_idx): # pylint:disable=arguments-differ """ Given a node and details of a successor, makes a list of CFGJobs and if it is a call or exit marks it appropriately so in the CFG :pa...
[ "Given", "a", "node", "and", "details", "of", "a", "successor", "makes", "a", "list", "of", "CFGJobs", "and", "if", "it", "is", "a", "call", "or", "exit", "marks", "it", "appropriately", "so", "in", "the", "CFG" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_fast_soot.py#L371-L443
[ "def", "_create_jobs", "(", "self", ",", "target", ",", "jumpkind", ",", "current_function_addr", ",", "soot_block", ",", "addr", ",", "cfg_node", ",", "stmt_addr", ",", "stmt_idx", ")", ":", "# pylint:disable=arguments-differ", "target_addr", "=", "target", "jobs...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
CFGFastSoot.make_functions
Revisit the entire control flow graph, create Function instances accordingly, and correctly put blocks into each function. Although Function objects are crated during the CFG recovery, they are neither sound nor accurate. With a pre-constructed CFG, this method rebuilds all functions bearing th...
angr/analyses/cfg/cfg_fast_soot.py
def make_functions(self): """ Revisit the entire control flow graph, create Function instances accordingly, and correctly put blocks into each function. Although Function objects are crated during the CFG recovery, they are neither sound nor accurate. With a pre-constructed CFG,...
def make_functions(self): """ Revisit the entire control flow graph, create Function instances accordingly, and correctly put blocks into each function. Although Function objects are crated during the CFG recovery, they are neither sound nor accurate. With a pre-constructed CFG,...
[ "Revisit", "the", "entire", "control", "flow", "graph", "create", "Function", "instances", "accordingly", "and", "correctly", "put", "blocks", "into", "each", "function", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_fast_soot.py#L445-L552
[ "def", "make_functions", "(", "self", ")", ":", "tmp_functions", "=", "self", ".", "kb", ".", "functions", ".", "copy", "(", ")", "for", "function", "in", "tmp_functions", ".", "values", "(", ")", ":", "function", ".", "mark_nonreturning_calls_endpoints", "(...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSootValue_ThisRef.set_field
Sets an instance field.
angr/engines/soot/values/thisref.py
def set_field(self, state, field_name, field_type, value): """ Sets an instance field. """ field_ref = SimSootValue_InstanceFieldRef.get_ref(state=state, obj_alloc_id=self.heap_alloc_id, ...
def set_field(self, state, field_name, field_type, value): """ Sets an instance field. """ field_ref = SimSootValue_InstanceFieldRef.get_ref(state=state, obj_alloc_id=self.heap_alloc_id, ...
[ "Sets", "an", "instance", "field", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/soot/values/thisref.py#L35-L45
[ "def", "set_field", "(", "self", ",", "state", ",", "field_name", ",", "field_type", ",", "value", ")", ":", "field_ref", "=", "SimSootValue_InstanceFieldRef", ".", "get_ref", "(", "state", "=", "state", ",", "obj_alloc_id", "=", "self", ".", "heap_alloc_id", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSootValue_ThisRef.get_field
Gets the value of an instance field.
angr/engines/soot/values/thisref.py
def get_field(self, state, field_name, field_type): """ Gets the value of an instance field. """ # get field reference field_ref = SimSootValue_InstanceFieldRef.get_ref(state=state, obj_alloc_id=self.heap_alloc_id, ...
def get_field(self, state, field_name, field_type): """ Gets the value of an instance field. """ # get field reference field_ref = SimSootValue_InstanceFieldRef.get_ref(state=state, obj_alloc_id=self.heap_alloc_id, ...
[ "Gets", "the", "value", "of", "an", "instance", "field", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/soot/values/thisref.py#L47-L58
[ "def", "get_field", "(", "self", ",", "state", ",", "field_name", ",", "field_type", ")", ":", "# get field reference", "field_ref", "=", "SimSootValue_InstanceFieldRef", ".", "get_ref", "(", "state", "=", "state", ",", "obj_alloc_id", "=", "self", ".", "heap_al...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSootValue_ThisRef.store_field
Store a field of a given object, without resolving hierachy :param state: angr state where we want to allocate the object attribute :type SimState :param field_name: name of the attribute :type str :param field_value: attibute's value :type SimSootValue
angr/engines/soot/values/thisref.py
def store_field(self, state, field_name, field_type, value): """ Store a field of a given object, without resolving hierachy :param state: angr state where we want to allocate the object attribute :type SimState :param field_name: name of the attribute :type str ...
def store_field(self, state, field_name, field_type, value): """ Store a field of a given object, without resolving hierachy :param state: angr state where we want to allocate the object attribute :type SimState :param field_name: name of the attribute :type str ...
[ "Store", "a", "field", "of", "a", "given", "object", "without", "resolving", "hierachy" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/soot/values/thisref.py#L60-L72
[ "def", "store_field", "(", "self", ",", "state", ",", "field_name", ",", "field_type", ",", "value", ")", ":", "field_ref", "=", "SimSootValue_InstanceFieldRef", "(", "self", ".", "heap_alloc_id", ",", "self", ".", "type", ",", "field_name", ",", "field_type",...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSootValue_ThisRef.load_field
Load a field of a given object, without resolving hierachy :param state: angr state where we want to load the object attribute :type SimState :param field_name: name of the attribute :type str :param field_type: type of the attribute :type str
angr/engines/soot/values/thisref.py
def load_field(self, state, field_name, field_type): """ Load a field of a given object, without resolving hierachy :param state: angr state where we want to load the object attribute :type SimState :param field_name: name of the attribute :type str :param field_...
def load_field(self, state, field_name, field_type): """ Load a field of a given object, without resolving hierachy :param state: angr state where we want to load the object attribute :type SimState :param field_name: name of the attribute :type str :param field_...
[ "Load", "a", "field", "of", "a", "given", "object", "without", "resolving", "hierachy" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/soot/values/thisref.py#L74-L86
[ "def", "load_field", "(", "self", ",", "state", ",", "field_name", ",", "field_type", ")", ":", "field_ref", "=", "SimSootValue_InstanceFieldRef", "(", "self", ".", "heap_alloc_id", ",", "self", ".", "type", ",", "field_name", ",", "field_type", ")", "return",...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSootValue_ThisRef.new_object
Creates a new object reference. :param state: State associated to the object. :param type_: Class of the object. :param init_object: Whether the objects initializer method should be run. :return: Reference to the new object.
angr/engines/soot/values/thisref.py
def new_object(cls, state, type_, symbolic=False, init_object=False): """ Creates a new object reference. :param state: State associated to the object. :param type_: Class of the object. :param init_object: Whether the objects initializer method should be run. :return: Re...
def new_object(cls, state, type_, symbolic=False, init_object=False): """ Creates a new object reference. :param state: State associated to the object. :param type_: Class of the object. :param init_object: Whether the objects initializer method should be run. :return: Re...
[ "Creates", "a", "new", "object", "reference", ".", ":", "param", "state", ":", "State", "associated", "to", "the", "object", ".", ":", "param", "type_", ":", "Class", "of", "the", "object", ".", ":", "param", "init_object", ":", "Whether", "the", "object...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/soot/values/thisref.py#L94-L123
[ "def", "new_object", "(", "cls", ",", "state", ",", "type_", ",", "symbolic", "=", "False", ",", "init_object", "=", "False", ")", ":", "# create reference", "obj_ref", "=", "cls", "(", "heap_alloc_id", "=", "state", ".", "memory", ".", "get_new_uuid", "("...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimOS.configure_project
Configure the project to set up global settings (like SimProcedures).
angr/simos/simos.py
def configure_project(self): """ Configure the project to set up global settings (like SimProcedures). """ self.return_deadend = self.project.loader.extern_object.allocate() self.project.hook(self.return_deadend, P['stubs']['CallReturn']()) self.unresolvable_jump_target ...
def configure_project(self): """ Configure the project to set up global settings (like SimProcedures). """ self.return_deadend = self.project.loader.extern_object.allocate() self.project.hook(self.return_deadend, P['stubs']['CallReturn']()) self.unresolvable_jump_target ...
[ "Configure", "the", "project", "to", "set", "up", "global", "settings", "(", "like", "SimProcedures", ")", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/simos.py#L37-L75
[ "def", "configure_project", "(", "self", ")", ":", "self", ".", "return_deadend", "=", "self", ".", "project", ".", "loader", ".", "extern_object", ".", "allocate", "(", ")", "self", ".", "project", ".", "hook", "(", "self", ".", "return_deadend", ",", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimOS.state_blank
Initialize a blank state. All parameters are optional. :param addr: The execution start address. :param initial_prefix: :param stack_end: The end of the stack (i.e., the byte after the last valid stack address). :param stack_size: The number of bytes to al...
angr/simos/simos.py
def state_blank(self, addr=None, initial_prefix=None, brk=None, stack_end=None, stack_size=1024*1024*8, stdin=None, **kwargs): """ Initialize a blank state. All parameters are optional. :param addr: The execution start address. :param initial_prefix: :param s...
def state_blank(self, addr=None, initial_prefix=None, brk=None, stack_end=None, stack_size=1024*1024*8, stdin=None, **kwargs): """ Initialize a blank state. All parameters are optional. :param addr: The execution start address. :param initial_prefix: :param s...
[ "Initialize", "a", "blank", "state", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/simos.py#L89-L190
[ "def", "state_blank", "(", "self", ",", "addr", "=", "None", ",", "initial_prefix", "=", "None", ",", "brk", "=", "None", ",", "stack_end", "=", "None", ",", "stack_size", "=", "1024", "*", "1024", "*", "8", ",", "stdin", "=", "None", ",", "*", "*"...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimOS.prepare_call_state
This function prepares a state that is executing a call instruction. If given an initial_state, it copies over all of the critical registers to it from the calling_state. Otherwise, it prepares the calling_state for action. This is mostly used to create minimalistic for CFG generation. Some ABI...
angr/simos/simos.py
def prepare_call_state(self, calling_state, initial_state=None, preserve_registers=(), preserve_memory=()): """ This function prepares a state that is executing a call instruction. If given an initial_state, it copies over all of the critical registers to it from the ...
def prepare_call_state(self, calling_state, initial_state=None, preserve_registers=(), preserve_memory=()): """ This function prepares a state that is executing a call instruction. If given an initial_state, it copies over all of the critical registers to it from the ...
[ "This", "function", "prepares", "a", "state", "that", "is", "executing", "a", "call", "instruction", ".", "If", "given", "an", "initial_state", "it", "copies", "over", "all", "of", "the", "critical", "registers", "to", "it", "from", "the", "calling_state", "...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/simos.py#L222-L249
[ "def", "prepare_call_state", "(", "self", ",", "calling_state", ",", "initial_state", "=", "None", ",", "preserve_registers", "=", "(", ")", ",", "preserve_memory", "=", "(", ")", ")", ":", "if", "isinstance", "(", "self", ".", "arch", ",", "ArchMIPS32", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimOS.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/simos.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 t...
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 t...
[ "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/simos.py#L251-L260
[ "def", "prepare_function_symbol", "(", "self", ",", "symbol_name", ",", "basic_addr", "=", "None", ")", ":", "if", "basic_addr", "is", "None", ":", "basic_addr", "=", "self", ".", "project", ".", "loader", ".", "extern_object", ".", "get_pseudo_addr", "(", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimOS.setup_gdt
Write the GlobalDescriptorTable object in the current state memory :param state: state in which to write the GDT :param gdt: GlobalDescriptorTable object :return:
angr/simos/simos.py
def setup_gdt(self, state, gdt): """ Write the GlobalDescriptorTable object in the current state memory :param state: state in which to write the GDT :param gdt: GlobalDescriptorTable object :return: """ state.memory.store(gdt.addr+8, gdt.table) state.reg...
def setup_gdt(self, state, gdt): """ Write the GlobalDescriptorTable object in the current state memory :param state: state in which to write the GDT :param gdt: GlobalDescriptorTable object :return: """ state.memory.store(gdt.addr+8, gdt.table) state.reg...
[ "Write", "the", "GlobalDescriptorTable", "object", "in", "the", "current", "state", "memory" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/simos.py#L295-L310
[ "def", "setup_gdt", "(", "self", ",", "state", ",", "gdt", ")", ":", "state", ".", "memory", ".", "store", "(", "gdt", ".", "addr", "+", "8", ",", "gdt", ".", "table", ")", "state", ".", "regs", ".", "gdt", "=", "gdt", ".", "gdt", "state", ".",...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimOS.generate_gdt
Generate a GlobalDescriptorTable object and populate it using the value of the gs and fs register :param fs: value of the fs segment register :param gs: value of the gs segment register :param fs_size: size of the fs segment register :param gs_size: size of the gs segment regi...
angr/simos/simos.py
def generate_gdt(self, fs, gs, fs_size=0xFFFFFFFF, gs_size=0xFFFFFFFF): """ Generate a GlobalDescriptorTable object and populate it using the value of the gs and fs register :param fs: value of the fs segment register :param gs: value of the gs segment register :param ...
def generate_gdt(self, fs, gs, fs_size=0xFFFFFFFF, gs_size=0xFFFFFFFF): """ Generate a GlobalDescriptorTable object and populate it using the value of the gs and fs register :param fs: value of the fs segment register :param gs: value of the gs segment register :param ...
[ "Generate", "a", "GlobalDescriptorTable", "object", "and", "populate", "it", "using", "the", "value", "of", "the", "gs", "and", "fs", "register" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/simos.py#L312-L356
[ "def", "generate_gdt", "(", "self", ",", "fs", ",", "gs", ",", "fs_size", "=", "0xFFFFFFFF", ",", "gs_size", "=", "0xFFFFFFFF", ")", ":", "A_PRESENT", "=", "0x80", "A_DATA", "=", "0x10", "A_DATA_WRITABLE", "=", "0x2", "A_PRIV_0", "=", "0x0", "A_DIR_CON_BIT...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
define_struct
Register a struct definition globally >>> define_struct('struct abcd {int x; int y;}')
angr/sim_type.py
def define_struct(defn): """ Register a struct definition globally >>> define_struct('struct abcd {int x; int y;}') """ struct = parse_type(defn) ALL_TYPES[struct.name] = struct return struct
def define_struct(defn): """ Register a struct definition globally >>> define_struct('struct abcd {int x; int y;}') """ struct = parse_type(defn) ALL_TYPES[struct.name] = struct return struct
[ "Register", "a", "struct", "definition", "globally" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_type.py#L986-L994
[ "def", "define_struct", "(", "defn", ")", ":", "struct", "=", "parse_type", "(", "defn", ")", "ALL_TYPES", "[", "struct", ".", "name", "]", "=", "struct", "return", "struct" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
do_preprocess
Run a string through the C preprocessor that ships with pycparser but is weirdly inaccessible?
angr/sim_type.py
def do_preprocess(defn): """ Run a string through the C preprocessor that ships with pycparser but is weirdly inaccessible? """ from pycparser.ply import lex, cpp lexer = lex.lex(cpp) p = cpp.Preprocessor(lexer) # p.add_path(dir) will add dir to the include search path p.parse(defn) ...
def do_preprocess(defn): """ Run a string through the C preprocessor that ships with pycparser but is weirdly inaccessible? """ from pycparser.ply import lex, cpp lexer = lex.lex(cpp) p = cpp.Preprocessor(lexer) # p.add_path(dir) will add dir to the include search path p.parse(defn) ...
[ "Run", "a", "string", "through", "the", "C", "preprocessor", "that", "ships", "with", "pycparser", "but", "is", "weirdly", "inaccessible?" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_type.py#L1006-L1015
[ "def", "do_preprocess", "(", "defn", ")", ":", "from", "pycparser", ".", "ply", "import", "lex", ",", "cpp", "lexer", "=", "lex", ".", "lex", "(", "cpp", ")", "p", "=", "cpp", ".", "Preprocessor", "(", "lexer", ")", "# p.add_path(dir) will add dir to the i...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
parse_file
Parse a series of C definitions, returns a tuple of two type mappings, one for variable definitions and one for type definitions.
angr/sim_type.py
def parse_file(defn, preprocess=True): """ Parse a series of C definitions, returns a tuple of two type mappings, one for variable definitions and one for type definitions. """ if pycparser is None: raise ImportError("Please install pycparser in order to parse C definitions") defn = '\n...
def parse_file(defn, preprocess=True): """ Parse a series of C definitions, returns a tuple of two type mappings, one for variable definitions and one for type definitions. """ if pycparser is None: raise ImportError("Please install pycparser in order to parse C definitions") defn = '\n...
[ "Parse", "a", "series", "of", "C", "definitions", "returns", "a", "tuple", "of", "two", "type", "mappings", "one", "for", "variable", "definitions", "and", "one", "for", "type", "definitions", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_type.py#L1033-L1064
[ "def", "parse_file", "(", "defn", ",", "preprocess", "=", "True", ")", ":", "if", "pycparser", "is", "None", ":", "raise", "ImportError", "(", "\"Please install pycparser in order to parse C definitions\"", ")", "defn", "=", "'\\n'", ".", "join", "(", "x", "for"...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
parse_type
Parse a simple type expression into a SimType >>> parse_type('int *')
angr/sim_type.py
def parse_type(defn, preprocess=True): """ Parse a simple type expression into a SimType >>> parse_type('int *') """ if pycparser is None: raise ImportError("Please install pycparser in order to parse C definitions") defn = 'typedef ' + defn.strip('; \n\t\r') + ' QQQQ;' if preproc...
def parse_type(defn, preprocess=True): """ Parse a simple type expression into a SimType >>> parse_type('int *') """ if pycparser is None: raise ImportError("Please install pycparser in order to parse C definitions") defn = 'typedef ' + defn.strip('; \n\t\r') + ' QQQQ;' if preproc...
[ "Parse", "a", "simple", "type", "expression", "into", "a", "SimType" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_type.py#L1067-L1087
[ "def", "parse_type", "(", "defn", ",", "preprocess", "=", "True", ")", ":", "if", "pycparser", "is", "None", ":", "raise", "ImportError", "(", "\"Please install pycparser in order to parse C definitions\"", ")", "defn", "=", "'typedef '", "+", "defn", ".", "strip"...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimType.alignment
The alignment of the type in bytes.
angr/sim_type.py
def alignment(self): """ The alignment of the type in bytes. """ if self._arch is None: return NotImplemented return self.size // self._arch.byte_width
def alignment(self): """ The alignment of the type in bytes. """ if self._arch is None: return NotImplemented return self.size // self._arch.byte_width
[ "The", "alignment", "of", "the", "type", "in", "bytes", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_type.py#L76-L82
[ "def", "alignment", "(", "self", ")", ":", "if", "self", ".", "_arch", "is", "None", ":", "return", "NotImplemented", "return", "self", ".", "size", "//", "self", ".", "_arch", ".", "byte_width" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Concrete.sync
Handle the switch between the concrete execution and angr. This method takes care of: 1- Synchronize registers. 2- Set a concrete target to the memory backer so the memory reads are redirected in the concrete process memory. 3- If possible restore the SimProcedures with the real addresse...
angr/state_plugins/concrete.py
def sync(self): """ Handle the switch between the concrete execution and angr. This method takes care of: 1- Synchronize registers. 2- Set a concrete target to the memory backer so the memory reads are redirected in the concrete process memory. 3- If possible restore the ...
def sync(self): """ Handle the switch between the concrete execution and angr. This method takes care of: 1- Synchronize registers. 2- Set a concrete target to the memory backer so the memory reads are redirected in the concrete process memory. 3- If possible restore the ...
[ "Handle", "the", "switch", "between", "the", "concrete", "execution", "and", "angr", ".", "This", "method", "takes", "care", "of", ":", "1", "-", "Synchronize", "registers", ".", "2", "-", "Set", "a", "concrete", "target", "to", "the", "memory", "backer", ...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/concrete.py#L60-L178
[ "def", "sync", "(", "self", ")", ":", "def", "_sync_segments", "(", "state", ")", ":", "\"\"\"\n Segment registers synchronization is on demand as soon as the\n symbolic execution access a segment register.\n \"\"\"", "concr_target", "=", "state", "."...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
UniqueSearch.similarity
The (L2) distance between the counts of the state addresses in the history of the path. :param state_a: The first state to compare :param state_b: The second state to compare
angr/exploration_techniques/unique.py
def similarity(state_a, state_b): """ The (L2) distance between the counts of the state addresses in the history of the path. :param state_a: The first state to compare :param state_b: The second state to compare """ count_a = Counter(state_a.history.bbl_addrs) co...
def similarity(state_a, state_b): """ The (L2) distance between the counts of the state addresses in the history of the path. :param state_a: The first state to compare :param state_b: The second state to compare """ count_a = Counter(state_a.history.bbl_addrs) co...
[ "The", "(", "L2", ")", "distance", "between", "the", "counts", "of", "the", "state", "addresses", "in", "the", "history", "of", "the", "path", ".", ":", "param", "state_a", ":", "The", "first", "state", "to", "compare", ":", "param", "state_b", ":", "T...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/unique.py#L78-L88
[ "def", "similarity", "(", "state_a", ",", "state_b", ")", ":", "count_a", "=", "Counter", "(", "state_a", ".", "history", ".", "bbl_addrs", ")", "count_b", "=", "Counter", "(", "state_b", ".", "history", ".", "bbl_addrs", ")", "normal_distance", "=", "sum"...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
UniqueSearch.sequence_matcher_similarity
The `difflib.SequenceMatcher` ratio between the state addresses in the history of the path. :param state_a: The first state to compare :param state_b: The second state to compare
angr/exploration_techniques/unique.py
def sequence_matcher_similarity(state_a, state_b): """ The `difflib.SequenceMatcher` ratio between the state addresses in the history of the path. :param state_a: The first state to compare :param state_b: The second state to compare """ addrs_a = tuple(state_a.history.bb...
def sequence_matcher_similarity(state_a, state_b): """ The `difflib.SequenceMatcher` ratio between the state addresses in the history of the path. :param state_a: The first state to compare :param state_b: The second state to compare """ addrs_a = tuple(state_a.history.bb...
[ "The", "difflib", ".", "SequenceMatcher", "ratio", "between", "the", "state", "addresses", "in", "the", "history", "of", "the", "path", ".", ":", "param", "state_a", ":", "The", "first", "state", "to", "compare", ":", "param", "state_b", ":", "The", "secon...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/unique.py#L91-L99
[ "def", "sequence_matcher_similarity", "(", "state_a", ",", "state_b", ")", ":", "addrs_a", "=", "tuple", "(", "state_a", ".", "history", ".", "bbl_addrs", ")", "addrs_b", "=", "tuple", "(", "state_b", ".", "history", ".", "bbl_addrs", ")", "return", "Sequenc...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
resolve_method
Resolves the method based on the given characteristics (name, class and params) The method may be defined in one of the superclasses of the given class (TODO: support interfaces). :rtype: archinfo.arch_soot.SootMethodDescriptor
angr/engines/soot/method_dispatcher.py
def resolve_method(state, method_name, class_name, params=(), ret_type=None, include_superclasses=True, init_class=True, raise_exception_if_not_found=False): """ Resolves the method based on the given characteristics (name, class and params) The method may be defined in...
def resolve_method(state, method_name, class_name, params=(), ret_type=None, include_superclasses=True, init_class=True, raise_exception_if_not_found=False): """ Resolves the method based on the given characteristics (name, class and params) The method may be defined in...
[ "Resolves", "the", "method", "based", "on", "the", "given", "characteristics", "(", "name", "class", "and", "params", ")", "The", "method", "may", "be", "defined", "in", "one", "of", "the", "superclasses", "of", "the", "given", "class", "(", "TODO", ":", ...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/soot/method_dispatcher.py#L11-L44
[ "def", "resolve_method", "(", "state", ",", "method_name", ",", "class_name", ",", "params", "=", "(", ")", ",", "ret_type", "=", "None", ",", "include_superclasses", "=", "True", ",", "init_class", "=", "True", ",", "raise_exception_if_not_found", "=", "False...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimRegArg._fix_offset
This is a hack to deal with small values being stored at offsets into large registers unpredictably
angr/calling_conventions.py
def _fix_offset(self, state, size, arch=None): """ This is a hack to deal with small values being stored at offsets into large registers unpredictably """ if state is not None: arch = state.arch if arch is None: raise ValueError('Either "state" or "arch" ...
def _fix_offset(self, state, size, arch=None): """ This is a hack to deal with small values being stored at offsets into large registers unpredictably """ if state is not None: arch = state.arch if arch is None: raise ValueError('Either "state" or "arch" ...
[ "This", "is", "a", "hack", "to", "deal", "with", "small", "values", "being", "stored", "at", "offsets", "into", "large", "registers", "unpredictably" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L96-L111
[ "def", "_fix_offset", "(", "self", ",", "state", ",", "size", ",", "arch", "=", "None", ")", ":", "if", "state", "is", "not", "None", ":", "arch", "=", "state", ".", "arch", "if", "arch", "is", "None", ":", "raise", "ValueError", "(", "'Either \"stat...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimCC.from_arg_kinds
Get an instance of the class that will extract floating-point/integral args correctly. :param arch: The Archinfo arch for this CC :param fp_args: A list, with one entry for each argument the function can take. True if the argument is fp, false if it is integral. ...
angr/calling_conventions.py
def from_arg_kinds(cls, arch, fp_args, ret_fp=False, sizes=None, sp_delta=None, func_ty=None): """ Get an instance of the class that will extract floating-point/integral args correctly. :param arch: The Archinfo arch for this CC :param fp_args: A list, with one entry for each...
def from_arg_kinds(cls, arch, fp_args, ret_fp=False, sizes=None, sp_delta=None, func_ty=None): """ Get an instance of the class that will extract floating-point/integral args correctly. :param arch: The Archinfo arch for this CC :param fp_args: A list, with one entry for each...
[ "Get", "an", "instance", "of", "the", "class", "that", "will", "extract", "floating", "-", "point", "/", "integral", "args", "correctly", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L297-L313
[ "def", "from_arg_kinds", "(", "cls", ",", "arch", ",", "fp_args", ",", "ret_fp", "=", "False", ",", "sizes", "=", "None", ",", "sp_delta", "=", "None", ",", "func_ty", "=", "None", ")", ":", "basic", "=", "cls", "(", "arch", ",", "sp_delta", "=", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimCC.int_args
Iterate through all the possible arg positions that can only be used to store integer or pointer values Does not take into account customizations. Returns an iterator of SimFunctionArguments
angr/calling_conventions.py
def int_args(self): """ Iterate through all the possible arg positions that can only be used to store integer or pointer values Does not take into account customizations. Returns an iterator of SimFunctionArguments """ if self.ARG_REGS is None: raise NotImple...
def int_args(self): """ Iterate through all the possible arg positions that can only be used to store integer or pointer values Does not take into account customizations. Returns an iterator of SimFunctionArguments """ if self.ARG_REGS is None: raise NotImple...
[ "Iterate", "through", "all", "the", "possible", "arg", "positions", "that", "can", "only", "be", "used", "to", "store", "integer", "or", "pointer", "values", "Does", "not", "take", "into", "account", "customizations", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L338-L348
[ "def", "int_args", "(", "self", ")", ":", "if", "self", ".", "ARG_REGS", "is", "None", ":", "raise", "NotImplementedError", "(", ")", "for", "reg", "in", "self", ".", "ARG_REGS", ":", "# pylint: disable=not-an-iterable", "yield", "SimRegArg", "(", "reg", ","...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimCC.both_args
Iterate through all the possible arg positions that can be used to store any kind of argument Does not take into account customizations. Returns an iterator of SimFunctionArguments
angr/calling_conventions.py
def both_args(self): """ Iterate through all the possible arg positions that can be used to store any kind of argument Does not take into account customizations. Returns an iterator of SimFunctionArguments """ turtle = self.STACKARG_SP_BUFF + self.STACKARG_SP_DIFF ...
def both_args(self): """ Iterate through all the possible arg positions that can be used to store any kind of argument Does not take into account customizations. Returns an iterator of SimFunctionArguments """ turtle = self.STACKARG_SP_BUFF + self.STACKARG_SP_DIFF ...
[ "Iterate", "through", "all", "the", "possible", "arg", "positions", "that", "can", "be", "used", "to", "store", "any", "kind", "of", "argument", "Does", "not", "take", "into", "account", "customizations", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L351-L361
[ "def", "both_args", "(", "self", ")", ":", "turtle", "=", "self", ".", "STACKARG_SP_BUFF", "+", "self", ".", "STACKARG_SP_DIFF", "while", "True", ":", "yield", "SimStackArg", "(", "turtle", ",", "self", ".", "arch", ".", "bytes", ")", "turtle", "+=", "se...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimCC.fp_args
Iterate through all the possible arg positions that can only be used to store floating point values Does not take into account customizations. Returns an iterator of SimFunctionArguments
angr/calling_conventions.py
def fp_args(self): """ Iterate through all the possible arg positions that can only be used to store floating point values Does not take into account customizations. Returns an iterator of SimFunctionArguments """ if self.FP_ARG_REGS is None: raise NotImpleme...
def fp_args(self): """ Iterate through all the possible arg positions that can only be used to store floating point values Does not take into account customizations. Returns an iterator of SimFunctionArguments """ if self.FP_ARG_REGS is None: raise NotImpleme...
[ "Iterate", "through", "all", "the", "possible", "arg", "positions", "that", "can", "only", "be", "used", "to", "store", "floating", "point", "values", "Does", "not", "take", "into", "account", "customizations", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L364-L374
[ "def", "fp_args", "(", "self", ")", ":", "if", "self", ".", "FP_ARG_REGS", "is", "None", ":", "raise", "NotImplementedError", "(", ")", "for", "reg", "in", "self", ".", "FP_ARG_REGS", ":", "# pylint: disable=not-an-iterable", "yield", "SimRegArg", "(", "reg", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimCC.is_fp_arg
This should take a SimFunctionArgument instance and return whether or not that argument is a floating-point argument. Returns True for MUST be a floating point arg, False for MUST NOT be a floating point arg, None for when it can be either.
angr/calling_conventions.py
def is_fp_arg(self, arg): """ This should take a SimFunctionArgument instance and return whether or not that argument is a floating-point argument. Returns True for MUST be a floating point arg, False for MUST NOT be a floating point arg, None for when it...
def is_fp_arg(self, arg): """ This should take a SimFunctionArgument instance and return whether or not that argument is a floating-point argument. Returns True for MUST be a floating point arg, False for MUST NOT be a floating point arg, None for when it...
[ "This", "should", "take", "a", "SimFunctionArgument", "instance", "and", "return", "whether", "or", "not", "that", "argument", "is", "a", "floating", "-", "point", "argument", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L376-L389
[ "def", "is_fp_arg", "(", "self", ",", "arg", ")", ":", "if", "arg", "in", "self", ".", "int_args", ":", "return", "False", "if", "arg", "in", "self", ".", "fp_args", "or", "arg", "==", "self", ".", "FP_RETURN_VAL", ":", "return", "True", "return", "N...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimCC.stack_space
:param args: A list of SimFunctionArguments :returns: The number of bytes that should be allocated on the stack to store all these args, NOT INCLUDING the return address.
angr/calling_conventions.py
def stack_space(self, args): """ :param args: A list of SimFunctionArguments :returns: The number of bytes that should be allocated on the stack to store all these args, NOT INCLUDING the return address. """ out = self.STACKARG_SP_DIF...
def stack_space(self, args): """ :param args: A list of SimFunctionArguments :returns: The number of bytes that should be allocated on the stack to store all these args, NOT INCLUDING the return address. """ out = self.STACKARG_SP_DIF...
[ ":", "param", "args", ":", "A", "list", "of", "SimFunctionArguments" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L404-L417
[ "def", "stack_space", "(", "self", ",", "args", ")", ":", "out", "=", "self", ".", "STACKARG_SP_DIFF", "for", "arg", "in", "args", ":", "if", "isinstance", "(", "arg", ",", "SimStackArg", ")", ":", "out", "=", "max", "(", "out", ",", "arg", ".", "s...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimCC.arg_locs
Pass this a list of whether each parameter is floating-point or not, and get back a list of SimFunctionArguments. Optionally, pass a list of argument sizes (in bytes) as well. If you've customized this CC, this will sanity-check the provided locations with the given list.
angr/calling_conventions.py
def arg_locs(self, is_fp=None, sizes=None): """ Pass this a list of whether each parameter is floating-point or not, and get back a list of SimFunctionArguments. Optionally, pass a list of argument sizes (in bytes) as well. If you've customized this CC, this will sanity-check the provid...
def arg_locs(self, is_fp=None, sizes=None): """ Pass this a list of whether each parameter is floating-point or not, and get back a list of SimFunctionArguments. Optionally, pass a list of argument sizes (in bytes) as well. If you've customized this CC, this will sanity-check the provid...
[ "Pass", "this", "a", "list", "of", "whether", "each", "parameter", "is", "floating", "-", "point", "or", "not", "and", "get", "back", "a", "list", "of", "SimFunctionArguments", ".", "Optionally", "pass", "a", "list", "of", "argument", "sizes", "(", "in", ...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L448-L465
[ "def", "arg_locs", "(", "self", ",", "is_fp", "=", "None", ",", "sizes", "=", "None", ")", ":", "session", "=", "self", ".", "arg_session", "if", "self", ".", "func_ty", "is", "None", ":", "# No function prototype is provided. `is_fp` must be provided.", "if", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimCC.arg
Returns a bitvector expression representing the nth argument of a function. `stack_base` is an optional pointer to the top of the stack at the function start. If it is not specified, use the current stack pointer. WARNING: this assumes that none of the arguments are floating-point and they're ...
angr/calling_conventions.py
def arg(self, state, index, stack_base=None): """ Returns a bitvector expression representing the nth argument of a function. `stack_base` is an optional pointer to the top of the stack at the function start. If it is not specified, use the current stack pointer. WARNING: this ...
def arg(self, state, index, stack_base=None): """ Returns a bitvector expression representing the nth argument of a function. `stack_base` is an optional pointer to the top of the stack at the function start. If it is not specified, use the current stack pointer. WARNING: this ...
[ "Returns", "a", "bitvector", "expression", "representing", "the", "nth", "argument", "of", "a", "function", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L467-L483
[ "def", "arg", "(", "self", ",", "state", ",", "index", ",", "stack_base", "=", "None", ")", ":", "session", "=", "self", ".", "arg_session", "if", "self", ".", "args", "is", "None", ":", "arg_loc", "=", "[", "session", ".", "next_arg", "(", "False", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimCC.get_args
`is_fp` should be a list of booleans specifying whether each corresponding argument is floating-point - True for fp and False for int. For a shorthand to assume that all the parameters are int, pass the number of parameters as an int. If you've customized this CC, you may omit this parameter en...
angr/calling_conventions.py
def get_args(self, state, is_fp=None, sizes=None, stack_base=None): """ `is_fp` should be a list of booleans specifying whether each corresponding argument is floating-point - True for fp and False for int. For a shorthand to assume that all the parameters are int, pass the number of par...
def get_args(self, state, is_fp=None, sizes=None, stack_base=None): """ `is_fp` should be a list of booleans specifying whether each corresponding argument is floating-point - True for fp and False for int. For a shorthand to assume that all the parameters are int, pass the number of par...
[ "is_fp", "should", "be", "a", "list", "of", "booleans", "specifying", "whether", "each", "corresponding", "argument", "is", "floating", "-", "point", "-", "True", "for", "fp", "and", "False", "for", "int", ".", "For", "a", "shorthand", "to", "assume", "tha...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L485-L520
[ "def", "get_args", "(", "self", ",", "state", ",", "is_fp", "=", "None", ",", "sizes", "=", "None", ",", "stack_base", "=", "None", ")", ":", "if", "sizes", "is", "None", "and", "self", ".", "func_ty", "is", "not", "None", ":", "sizes", "=", "[", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimCC.setup_callsite
This function performs the actions of the caller getting ready to jump into a function. :param state: The SimState to operate on :param ret_addr: The address to return to when the called function finishes :param args: The list of arguments that that the called functi...
angr/calling_conventions.py
def setup_callsite(self, state, ret_addr, args, stack_base=None, alloc_base=None, grow_like_stack=True): """ This function performs the actions of the caller getting ready to jump into a function. :param state: The SimState to operate on :param ret_addr: The address to ...
def setup_callsite(self, state, ret_addr, args, stack_base=None, alloc_base=None, grow_like_stack=True): """ This function performs the actions of the caller getting ready to jump into a function. :param state: The SimState to operate on :param ret_addr: The address to ...
[ "This", "function", "performs", "the", "actions", "of", "the", "caller", "getting", "ready", "to", "jump", "into", "a", "function", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L522-L629
[ "def", "setup_callsite", "(", "self", ",", "state", ",", "ret_addr", ",", "args", ",", "stack_base", "=", "None", ",", "alloc_base", "=", "None", ",", "grow_like_stack", "=", "True", ")", ":", "# STEP 0: clerical work", "if", "isinstance", "(", "self", ",", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimCC.teardown_callsite
This function performs the actions of the callee as it's getting ready to return. It returns the address to return to. :param state: The state to mutate :param return_val: The value to return :param arg_types: The fp-ness of each of the args....
angr/calling_conventions.py
def teardown_callsite(self, state, return_val=None, arg_types=None, force_callee_cleanup=False): """ This function performs the actions of the callee as it's getting ready to return. It returns the address to return to. :param state: The state to mutate :param ...
def teardown_callsite(self, state, return_val=None, arg_types=None, force_callee_cleanup=False): """ This function performs the actions of the callee as it's getting ready to return. It returns the address to return to. :param state: The state to mutate :param ...
[ "This", "function", "performs", "the", "actions", "of", "the", "callee", "as", "it", "s", "getting", "ready", "to", "return", ".", "It", "returns", "the", "address", "to", "return", "to", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L631-L663
[ "def", "teardown_callsite", "(", "self", ",", "state", ",", "return_val", "=", "None", ",", "arg_types", "=", "None", ",", "force_callee_cleanup", "=", "False", ")", ":", "if", "return_val", "is", "not", "None", ":", "self", ".", "set_return_val", "(", "st...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimCC.get_return_val
Get the return value out of the given state
angr/calling_conventions.py
def get_return_val(self, state, is_fp=None, size=None, stack_base=None): """ Get the return value out of the given state """ ty = self.func_ty.returnty if self.func_ty is not None else None if self.ret_val is not None: loc = self.ret_val elif is_fp is not None...
def get_return_val(self, state, is_fp=None, size=None, stack_base=None): """ Get the return value out of the given state """ ty = self.func_ty.returnty if self.func_ty is not None else None if self.ret_val is not None: loc = self.ret_val elif is_fp is not None...
[ "Get", "the", "return", "value", "out", "of", "the", "given", "state" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L667-L687
[ "def", "get_return_val", "(", "self", ",", "state", ",", "is_fp", "=", "None", ",", "size", "=", "None", ",", "stack_base", "=", "None", ")", ":", "ty", "=", "self", ".", "func_ty", ".", "returnty", "if", "self", ".", "func_ty", "is", "not", "None", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimCC.set_return_val
Set the return value into the given state
angr/calling_conventions.py
def set_return_val(self, state, val, is_fp=None, size=None, stack_base=None): """ Set the return value into the given state """ ty = self.func_ty.returnty if self.func_ty is not None else None try: betterval = self._standardize_value(val, ty, state, None) exce...
def set_return_val(self, state, val, is_fp=None, size=None, stack_base=None): """ Set the return value into the given state """ ty = self.func_ty.returnty if self.func_ty is not None else None try: betterval = self._standardize_value(val, ty, state, None) exce...
[ "Set", "the", "return", "value", "into", "the", "given", "state" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L689-L710
[ "def", "set_return_val", "(", "self", ",", "state", ",", "val", ",", "is_fp", "=", "None", ",", "size", "=", "None", ",", "stack_base", "=", "None", ")", ":", "ty", "=", "self", ".", "func_ty", ".", "returnty", "if", "self", ".", "func_ty", "is", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimCC.find_cc
Pinpoint the best-fit calling convention and return the corresponding SimCC instance, or None if no fit is found. :param Arch arch: An ArchX instance. Can be obtained from archinfo. :param list args: A list of arguments. :param int sp_delta: The change of stack pointer be...
angr/calling_conventions.py
def find_cc(arch, args, sp_delta): """ Pinpoint the best-fit calling convention and return the corresponding SimCC instance, or None if no fit is found. :param Arch arch: An ArchX instance. Can be obtained from archinfo. :param list args: A list of arguments. ...
def find_cc(arch, args, sp_delta): """ Pinpoint the best-fit calling convention and return the corresponding SimCC instance, or None if no fit is found. :param Arch arch: An ArchX instance. Can be obtained from archinfo. :param list args: A list of arguments. ...
[ "Pinpoint", "the", "best", "-", "fit", "calling", "convention", "and", "return", "the", "corresponding", "SimCC", "instance", "or", "None", "if", "no", "fit", "is", "found", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L889-L907
[ "def", "find_cc", "(", "arch", ",", "args", ",", "sp_delta", ")", ":", "if", "arch", ".", "name", "not", "in", "CC", ":", "return", "None", "possible_cc_classes", "=", "CC", "[", "arch", ".", "name", "]", "for", "cc_cls", "in", "possible_cc_classes", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimCC.get_arg_info
This is just a simple wrapper that collects the information from various locations is_fp and sizes are passed to self.arg_locs and self.get_args :param angr.SimState state: The state to evaluate and extract the values from :return: A list of tuples, where the nth tuple is (type, name, locatio...
angr/calling_conventions.py
def get_arg_info(self, state, is_fp=None, sizes=None): """ This is just a simple wrapper that collects the information from various locations is_fp and sizes are passed to self.arg_locs and self.get_args :param angr.SimState state: The state to evaluate and extract the values from ...
def get_arg_info(self, state, is_fp=None, sizes=None): """ This is just a simple wrapper that collects the information from various locations is_fp and sizes are passed to self.arg_locs and self.get_args :param angr.SimState state: The state to evaluate and extract the values from ...
[ "This", "is", "just", "a", "simple", "wrapper", "that", "collects", "the", "information", "from", "various", "locations", "is_fp", "and", "sizes", "are", "passed", "to", "self", ".", "arg_locs", "and", "self", ".", "get_args", ":", "param", "angr", ".", "S...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L910-L921
[ "def", "get_arg_info", "(", "self", ",", "state", ",", "is_fp", "=", "None", ",", "sizes", "=", "None", ")", ":", "argument_types", "=", "self", ".", "func_ty", ".", "args", "argument_names", "=", "self", ".", "func_ty", ".", "arg_names", "if", "self", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSuccessors.add_successor
Add a successor state of the SimRun. This procedure stores method parameters into state.scratch, does some housekeeping, and calls out to helper functions to prepare the state and categorize it into the appropriate successor lists. :param SimState state: The successor state. ...
angr/engines/successors.py
def add_successor(self, state, target, guard, jumpkind, add_guard=True, exit_stmt_idx=None, exit_ins_addr=None, source=None): """ Add a successor state of the SimRun. This procedure stores method parameters into state.scratch, does some housekeeping, and calls out t...
def add_successor(self, state, target, guard, jumpkind, add_guard=True, exit_stmt_idx=None, exit_ins_addr=None, source=None): """ Add a successor state of the SimRun. This procedure stores method parameters into state.scratch, does some housekeeping, and calls out t...
[ "Add", "a", "successor", "state", "of", "the", "SimRun", ".", "This", "procedure", "stores", "method", "parameters", "into", "state", ".", "scratch", "does", "some", "housekeeping", "and", "calls", "out", "to", "helper", "functions", "to", "prepare", "the", ...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/successors.py#L86-L127
[ "def", "add_successor", "(", "self", ",", "state", ",", "target", ",", "guard", ",", "jumpkind", ",", "add_guard", "=", "True", ",", "exit_stmt_idx", "=", "None", ",", "exit_ins_addr", "=", "None", ",", "source", "=", "None", ")", ":", "# First, trigger th...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSuccessors._preprocess_successor
Preprocesses the successor state. :param state: the successor state
angr/engines/successors.py
def _preprocess_successor(self, state, add_guard=True): #pylint:disable=unused-argument """ Preprocesses the successor state. :param state: the successor state """ # Next, simplify what needs to be simplified if o.SIMPLIFY_EXIT_STATE in state.options: state....
def _preprocess_successor(self, state, add_guard=True): #pylint:disable=unused-argument """ Preprocesses the successor state. :param state: the successor state """ # Next, simplify what needs to be simplified if o.SIMPLIFY_EXIT_STATE in state.options: state....
[ "Preprocesses", "the", "successor", "state", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/successors.py#L133-L169
[ "def", "_preprocess_successor", "(", "self", ",", "state", ",", "add_guard", "=", "True", ")", ":", "#pylint:disable=unused-argument", "# Next, simplify what needs to be simplified", "if", "o", ".", "SIMPLIFY_EXIT_STATE", "in", "state", ".", "options", ":", "state", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSuccessors._categorize_successor
Append state into successor lists. :param state: a SimState instance :param target: The target (of the jump/call/ret) :return: The state
angr/engines/successors.py
def _categorize_successor(self, state): """ Append state into successor lists. :param state: a SimState instance :param target: The target (of the jump/call/ret) :return: The state """ self.all_successors.append(state) target = state.scratch.target ...
def _categorize_successor(self, state): """ Append state into successor lists. :param state: a SimState instance :param target: The target (of the jump/call/ret) :return: The state """ self.all_successors.append(state) target = state.scratch.target ...
[ "Append", "state", "into", "successor", "lists", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/successors.py#L228-L340
[ "def", "_categorize_successor", "(", "self", ",", "state", ")", ":", "self", ".", "all_successors", ".", "append", "(", "state", ")", "target", "=", "state", ".", "scratch", ".", "target", "# categorize the state", "if", "o", ".", "APPROXIMATE_GUARDS", "in", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSuccessors._fix_syscall_ip
Resolve syscall information from the state, get the IP address of the syscall SimProcedure, and set the IP of the state accordingly. Don't do anything if the resolution fails. :param SimState state: the program state. :return: None
angr/engines/successors.py
def _fix_syscall_ip(state): """ Resolve syscall information from the state, get the IP address of the syscall SimProcedure, and set the IP of the state accordingly. Don't do anything if the resolution fails. :param SimState state: the program state. :return: None """ ...
def _fix_syscall_ip(state): """ Resolve syscall information from the state, get the IP address of the syscall SimProcedure, and set the IP of the state accordingly. Don't do anything if the resolution fails. :param SimState state: the program state. :return: None """ ...
[ "Resolve", "syscall", "information", "from", "the", "state", "get", "the", "IP", "address", "of", "the", "syscall", "SimProcedure", "and", "set", "the", "IP", "of", "the", "state", "accordingly", ".", "Don", "t", "do", "anything", "if", "the", "resolution", ...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/successors.py#L372-L387
[ "def", "_fix_syscall_ip", "(", "state", ")", ":", "try", ":", "bypass", "=", "o", ".", "BYPASS_UNSUPPORTED_SYSCALL", "in", "state", ".", "options", "stub", "=", "state", ".", "project", ".", "simos", ".", "syscall", "(", "state", ",", "allow_unsupported", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSuccessors._finalize
Finalizes the request.
angr/engines/successors.py
def _finalize(self): """ Finalizes the request. """ if len(self.all_successors) == 0: return # do some cleanup if o.DOWNSIZE_Z3 in self.all_successors[0].options: for s in self.all_successors: s.downsize() # record if the ...
def _finalize(self): """ Finalizes the request. """ if len(self.all_successors) == 0: return # do some cleanup if o.DOWNSIZE_Z3 in self.all_successors[0].options: for s in self.all_successors: s.downsize() # record if the ...
[ "Finalizes", "the", "request", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/successors.py#L389-L403
[ "def", "_finalize", "(", "self", ")", ":", "if", "len", "(", "self", ".", "all_successors", ")", "==", "0", ":", "return", "# do some cleanup", "if", "o", ".", "DOWNSIZE_Z3", "in", "self", ".", "all_successors", "[", "0", "]", ".", "options", ":", "for...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSuccessors._eval_target_jumptable
A *very* fast method to evaluate symbolic jump targets if they are a) concrete targets, or b) targets coming from jump tables. :param state: A SimState instance. :param ip: The AST of the instruction pointer to evaluate. :param limit: The maximum number of concrete IPs. ...
angr/engines/successors.py
def _eval_target_jumptable(state, ip, limit): """ A *very* fast method to evaluate symbolic jump targets if they are a) concrete targets, or b) targets coming from jump tables. :param state: A SimState instance. :param ip: The AST of the instruction pointer to evaluate. ...
def _eval_target_jumptable(state, ip, limit): """ A *very* fast method to evaluate symbolic jump targets if they are a) concrete targets, or b) targets coming from jump tables. :param state: A SimState instance. :param ip: The AST of the instruction pointer to evaluate. ...
[ "A", "*", "very", "*", "fast", "method", "to", "evaluate", "symbolic", "jump", "targets", "if", "they", "are", "a", ")", "concrete", "targets", "or", "b", ")", "targets", "coming", "from", "jump", "tables", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/successors.py#L406-L493
[ "def", "_eval_target_jumptable", "(", "state", ",", "ip", ",", "limit", ")", ":", "if", "ip", ".", "symbolic", "is", "False", ":", "return", "[", "(", "claripy", ".", "ast", ".", "bool", ".", "true", ",", "ip", ")", "]", "# concrete", "# Detect whether...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSuccessors._eval_target_brutal
The traditional way of evaluating symbolic jump targets. :param state: A SimState instance. :param ip: The AST of the instruction pointer to evaluate. :param limit: The maximum number of concrete IPs. :return: A list of conditions and the corresponding concrete IPs. ...
angr/engines/successors.py
def _eval_target_brutal(state, ip, limit): """ The traditional way of evaluating symbolic jump targets. :param state: A SimState instance. :param ip: The AST of the instruction pointer to evaluate. :param limit: The maximum number of concrete IPs. :return: ...
def _eval_target_brutal(state, ip, limit): """ The traditional way of evaluating symbolic jump targets. :param state: A SimState instance. :param ip: The AST of the instruction pointer to evaluate. :param limit: The maximum number of concrete IPs. :return: ...
[ "The", "traditional", "way", "of", "evaluating", "symbolic", "jump", "targets", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/successors.py#L496-L509
[ "def", "_eval_target_brutal", "(", "state", ",", "ip", ",", "limit", ")", ":", "addrs", "=", "state", ".", "solver", ".", "eval_upto", "(", "ip", ",", "limit", ")", "return", "[", "(", "ip", "==", "addr", ",", "addr", ")", "for", "addr", "in", "add...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
memset._repeat_bytes
Get a long number for a byte being repeated for many times. This is part of the effort of optimizing performance of angr's memory operations. :param int byt: the byte to repeat :param int rep: times to repeat the byte :return: a long integer representing the repeating bytes ;rty...
angr/procedures/libc/memset.py
def _repeat_bytes(byt, rep): """ Get a long number for a byte being repeated for many times. This is part of the effort of optimizing performance of angr's memory operations. :param int byt: the byte to repeat :param int rep: times to repeat the byte :return: a long inte...
def _repeat_bytes(byt, rep): """ Get a long number for a byte being repeated for many times. This is part of the effort of optimizing performance of angr's memory operations. :param int byt: the byte to repeat :param int rep: times to repeat the byte :return: a long inte...
[ "Get", "a", "long", "number", "for", "a", "byte", "being", "repeated", "for", "many", "times", ".", "This", "is", "part", "of", "the", "effort", "of", "optimizing", "performance", "of", "angr", "s", "memory", "operations", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/libc/memset.py#L15-L39
[ "def", "_repeat_bytes", "(", "byt", ",", "rep", ")", ":", "if", "rep", "==", "1", ":", "return", "byt", "remainder", "=", "rep", "%", "2", "quotient", "=", "rep", "//", "2", "r_", "=", "memset", ".", "_repeat_bytes", "(", "byt", ",", "quotient", ")...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
MemoryData.copy
Make a copy of the MemoryData. :return: A copy of the MemoryData instance. :rtype: MemoryData
angr/knowledge_plugins/cfg/memory_data.py
def copy(self): """ Make a copy of the MemoryData. :return: A copy of the MemoryData instance. :rtype: MemoryData """ s = MemoryData(self.address, self.size, self.sort, pointer_addr=self.pointer_addr, max_size=self.max_size) s.content = self.content retu...
def copy(self): """ Make a copy of the MemoryData. :return: A copy of the MemoryData instance. :rtype: MemoryData """ s = MemoryData(self.address, self.size, self.sort, pointer_addr=self.pointer_addr, max_size=self.max_size) s.content = self.content retu...
[ "Make", "a", "copy", "of", "the", "MemoryData", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/cfg/memory_data.py#L111-L121
[ "def", "copy", "(", "self", ")", ":", "s", "=", "MemoryData", "(", "self", ".", "address", ",", "self", ".", "size", ",", "self", ".", "sort", ",", "pointer_addr", "=", "self", ".", "pointer_addr", ",", "max_size", "=", "self", ".", "max_size", ")", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
BasePage.store_mo
Stores a memory object. :param new_mo: the memory object :param overwrite: whether to overwrite objects already in memory (if false, just fill in the holes)
angr/storage/paged_memory.py
def store_mo(self, state, new_mo, overwrite=True): #pylint:disable=unused-argument """ Stores a memory object. :param new_mo: the memory object :param overwrite: whether to overwrite objects already in memory (if false, just fill in the holes) """ start, end = self._reso...
def store_mo(self, state, new_mo, overwrite=True): #pylint:disable=unused-argument """ Stores a memory object. :param new_mo: the memory object :param overwrite: whether to overwrite objects already in memory (if false, just fill in the holes) """ start, end = self._reso...
[ "Stores", "a", "memory", "object", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L69-L80
[ "def", "store_mo", "(", "self", ",", "state", ",", "new_mo", ",", "overwrite", "=", "True", ")", ":", "#pylint:disable=unused-argument", "start", ",", "end", "=", "self", ".", "_resolve_range", "(", "new_mo", ")", "if", "overwrite", ":", "self", ".", "stor...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
TreePage.load_mo
Loads a memory object from memory. :param page_idx: the index into the page :returns: a tuple of the object
angr/storage/paged_memory.py
def load_mo(self, state, page_idx): """ Loads a memory object from memory. :param page_idx: the index into the page :returns: a tuple of the object """ try: key = next(self._storage.irange(maximum=page_idx, reverse=True)) except StopIteration: ...
def load_mo(self, state, page_idx): """ Loads a memory object from memory. :param page_idx: the index into the page :returns: a tuple of the object """ try: key = next(self._storage.irange(maximum=page_idx, reverse=True)) except StopIteration: ...
[ "Loads", "a", "memory", "object", "from", "memory", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L207-L220
[ "def", "load_mo", "(", "self", ",", "state", ",", "page_idx", ")", ":", "try", ":", "key", "=", "next", "(", "self", ".", "_storage", ".", "irange", "(", "maximum", "=", "page_idx", ",", "reverse", "=", "True", ")", ")", "except", "StopIteration", ":...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
TreePage.load_slice
Return the memory objects overlapping with the provided slice. :param start: the start address :param end: the end address (non-inclusive) :returns: tuples of (starting_addr, memory_object)
angr/storage/paged_memory.py
def load_slice(self, state, start, end): """ Return the memory objects overlapping with the provided slice. :param start: the start address :param end: the end address (non-inclusive) :returns: tuples of (starting_addr, memory_object) """ keys = list(self._storag...
def load_slice(self, state, start, end): """ Return the memory objects overlapping with the provided slice. :param start: the start address :param end: the end address (non-inclusive) :returns: tuples of (starting_addr, memory_object) """ keys = list(self._storag...
[ "Return", "the", "memory", "objects", "overlapping", "with", "the", "provided", "slice", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L222-L239
[ "def", "load_slice", "(", "self", ",", "state", ",", "start", ",", "end", ")", ":", "keys", "=", "list", "(", "self", ".", "_storage", ".", "irange", "(", "start", ",", "end", "-", "1", ")", ")", "if", "not", "keys", "or", "keys", "[", "0", "]"...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
ListPage.load_mo
Loads a memory object from memory. :param page_idx: the index into the page :returns: a tuple of the object
angr/storage/paged_memory.py
def load_mo(self, state, page_idx): """ Loads a memory object from memory. :param page_idx: the index into the page :returns: a tuple of the object """ mo = self._storage[page_idx-self._page_addr] return self._sinkhole if mo is None else mo
def load_mo(self, state, page_idx): """ Loads a memory object from memory. :param page_idx: the index into the page :returns: a tuple of the object """ mo = self._storage[page_idx-self._page_addr] return self._sinkhole if mo is None else mo
[ "Loads", "a", "memory", "object", "from", "memory", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L287-L295
[ "def", "load_mo", "(", "self", ",", "state", ",", "page_idx", ")", ":", "mo", "=", "self", ".", "_storage", "[", "page_idx", "-", "self", ".", "_page_addr", "]", "return", "self", ".", "_sinkhole", "if", "mo", "is", "None", "else", "mo" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
ListPage.load_slice
Return the memory objects overlapping with the provided slice. :param start: the start address :param end: the end address (non-inclusive) :returns: tuples of (starting_addr, memory_object)
angr/storage/paged_memory.py
def load_slice(self, state, start, end): """ Return the memory objects overlapping with the provided slice. :param start: the start address :param end: the end address (non-inclusive) :returns: tuples of (starting_addr, memory_object) """ items = [ ] if s...
def load_slice(self, state, start, end): """ Return the memory objects overlapping with the provided slice. :param start: the start address :param end: the end address (non-inclusive) :returns: tuples of (starting_addr, memory_object) """ items = [ ] if s...
[ "Return", "the", "memory", "objects", "overlapping", "with", "the", "provided", "slice", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L297-L317
[ "def", "load_slice", "(", "self", ",", "state", ",", "start", ",", "end", ")", ":", "items", "=", "[", "]", "if", "start", ">", "self", ".", "_page_addr", "+", "self", ".", "_page_size", "or", "end", "<", "self", ".", "_page_addr", ":", "l", ".", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimPagedMemory.contains_no_backer
Tests if the address is contained in any page of paged memory, without considering memory backers. :param int addr: The address to test. :return: True if the address is included in one of the pages, False otherwise. :rtype: bool
angr/storage/paged_memory.py
def contains_no_backer(self, addr): """ Tests if the address is contained in any page of paged memory, without considering memory backers. :param int addr: The address to test. :return: True if the address is included in one of the pages, False otherwise. :rtype: bool ""...
def contains_no_backer(self, addr): """ Tests if the address is contained in any page of paged memory, without considering memory backers. :param int addr: The address to test. :return: True if the address is included in one of the pages, False otherwise. :rtype: bool ""...
[ "Tests", "if", "the", "address", "is", "contained", "in", "any", "page", "of", "paged", "memory", "without", "considering", "memory", "backers", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L601-L613
[ "def", "contains_no_backer", "(", "self", ",", "addr", ")", ":", "for", "i", ",", "p", "in", "self", ".", "_pages", ".", "items", "(", ")", ":", "if", "i", "*", "self", ".", "_page_size", "<=", "addr", "<", "(", "i", "+", "1", ")", "*", "self",...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimPagedMemory.__changed_bytes
Gets the set of changed bytes between `self` and `other`. :type other: SimPagedMemory :returns: A set of differing bytes.
angr/storage/paged_memory.py
def __changed_bytes(self, other): """ Gets the set of changed bytes between `self` and `other`. :type other: SimPagedMemory :returns: A set of differing bytes. """ if self._page_size != other._page_size: raise SimMemoryError("SimPagedMemory page size...
def __changed_bytes(self, other): """ Gets the set of changed bytes between `self` and `other`. :type other: SimPagedMemory :returns: A set of differing bytes. """ if self._page_size != other._page_size: raise SimMemoryError("SimPagedMemory page size...
[ "Gets", "the", "set", "of", "changed", "bytes", "between", "self", "and", "other", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L630-L697
[ "def", "__changed_bytes", "(", "self", ",", "other", ")", ":", "if", "self", ".", "_page_size", "!=", "other", ".", "_page_size", ":", "raise", "SimMemoryError", "(", "\"SimPagedMemory page sizes differ. This is asking for disaster.\"", ")", "our_pages", "=", "set", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimPagedMemory._apply_object_to_page
Writes a memory object to a `page` :param page_base: The base address of the page. :param mo: The memory object. :param page: (optional) the page to use. :param overwrite: (optional) If False, only write to currently-empty memory.
angr/storage/paged_memory.py
def _apply_object_to_page(self, page_base, mo, page=None, overwrite=True): """ Writes a memory object to a `page` :param page_base: The base address of the page. :param mo: The memory object. :param page: (optional) the page to use. :param overwrite: ...
def _apply_object_to_page(self, page_base, mo, page=None, overwrite=True): """ Writes a memory object to a `page` :param page_base: The base address of the page. :param mo: The memory object. :param page: (optional) the page to use. :param overwrite: ...
[ "Writes", "a", "memory", "object", "to", "a", "page" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L703-L726
[ "def", "_apply_object_to_page", "(", "self", ",", "page_base", ",", "mo", ",", "page", "=", "None", ",", "overwrite", "=", "True", ")", ":", "page_num", "=", "page_base", "//", "self", ".", "_page_size", "try", ":", "page", "=", "self", ".", "_get_page",...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimPagedMemory.store_memory_object
This function optimizes a large store by storing a single reference to the :class:`SimMemoryObject` instead of one for each byte. :param memory_object: the memory object to store
angr/storage/paged_memory.py
def store_memory_object(self, mo, overwrite=True): """ This function optimizes a large store by storing a single reference to the :class:`SimMemoryObject` instead of one for each byte. :param memory_object: the memory object to store """ for p in self._containing_pages_...
def store_memory_object(self, mo, overwrite=True): """ This function optimizes a large store by storing a single reference to the :class:`SimMemoryObject` instead of one for each byte. :param memory_object: the memory object to store """ for p in self._containing_pages_...
[ "This", "function", "optimizes", "a", "large", "store", "by", "storing", "a", "single", "reference", "to", "the", ":", "class", ":", "SimMemoryObject", "instead", "of", "one", "for", "each", "byte", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L738-L749
[ "def", "store_memory_object", "(", "self", ",", "mo", ",", "overwrite", "=", "True", ")", ":", "for", "p", "in", "self", ".", "_containing_pages_mo", "(", "mo", ")", ":", "self", ".", "_apply_object_to_page", "(", "p", ",", "mo", ",", "overwrite", "=", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimPagedMemory.replace_memory_object
Replaces the memory object `old` with a new memory object containing `new_content`. :param old: A SimMemoryObject (i.e., one from :func:`memory_objects_for_hash()` or :func:` memory_objects_for_name()`). :param new_content: The content (claripy expression) for the ne...
angr/storage/paged_memory.py
def replace_memory_object(self, old, new_content): """ Replaces the memory object `old` with a new memory object containing `new_content`. :param old: A SimMemoryObject (i.e., one from :func:`memory_objects_for_hash()` or :func:` memory_objects_for_name()`). ...
def replace_memory_object(self, old, new_content): """ Replaces the memory object `old` with a new memory object containing `new_content`. :param old: A SimMemoryObject (i.e., one from :func:`memory_objects_for_hash()` or :func:` memory_objects_for_name()`). ...
[ "Replaces", "the", "memory", "object", "old", "with", "a", "new", "memory", "object", "containing", "new_content", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L751-L771
[ "def", "replace_memory_object", "(", "self", ",", "old", ",", "new_content", ")", ":", "if", "old", ".", "object", ".", "size", "(", ")", "!=", "new_content", ".", "size", "(", ")", ":", "raise", "SimMemoryError", "(", "\"memory objects can only be replaced by...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimPagedMemory.replace_all
Replaces all instances of expression `old` with expression `new`. :param old: A claripy expression. Must contain at least one named variable (to make it possible to use the name index for speedup). :param new: The new variable to replace it with.
angr/storage/paged_memory.py
def replace_all(self, old, new): """ Replaces all instances of expression `old` with expression `new`. :param old: A claripy expression. Must contain at least one named variable (to make it possible to use the name index for speedup). :param new: The new variable to ...
def replace_all(self, old, new): """ Replaces all instances of expression `old` with expression `new`. :param old: A claripy expression. Must contain at least one named variable (to make it possible to use the name index for speedup). :param new: The new variable to ...
[ "Replaces", "all", "instances", "of", "expression", "old", "with", "expression", "new", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L773-L821
[ "def", "replace_all", "(", "self", ",", "old", ",", "new", ")", ":", "if", "options", ".", "REVERSE_MEMORY_NAME_MAP", "not", "in", "self", ".", "state", ".", "options", ":", "raise", "SimMemoryError", "(", "\"replace_all is not doable without a reverse name mapping....
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimPagedMemory.addrs_for_name
Returns addresses that contain expressions that contain a variable named `n`.
angr/storage/paged_memory.py
def addrs_for_name(self, n): """ Returns addresses that contain expressions that contain a variable named `n`. """ if n not in self._name_mapping: return self._mark_updated_mapping(self._name_mapping, n) to_discard = set() for e in self._name_mapping...
def addrs_for_name(self, n): """ Returns addresses that contain expressions that contain a variable named `n`. """ if n not in self._name_mapping: return self._mark_updated_mapping(self._name_mapping, n) to_discard = set() for e in self._name_mapping...
[ "Returns", "addresses", "that", "contain", "expressions", "that", "contain", "a", "variable", "named", "n", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L926-L942
[ "def", "addrs_for_name", "(", "self", ",", "n", ")", ":", "if", "n", "not", "in", "self", ".", "_name_mapping", ":", "return", "self", ".", "_mark_updated_mapping", "(", "self", ".", "_name_mapping", ",", "n", ")", "to_discard", "=", "set", "(", ")", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimPagedMemory.addrs_for_hash
Returns addresses that contain expressions that contain a variable with the hash of `h`.
angr/storage/paged_memory.py
def addrs_for_hash(self, h): """ Returns addresses that contain expressions that contain a variable with the hash of `h`. """ if h not in self._hash_mapping: return self._mark_updated_mapping(self._hash_mapping, h) to_discard = set() for e in self._h...
def addrs_for_hash(self, h): """ Returns addresses that contain expressions that contain a variable with the hash of `h`. """ if h not in self._hash_mapping: return self._mark_updated_mapping(self._hash_mapping, h) to_discard = set() for e in self._h...
[ "Returns", "addresses", "that", "contain", "expressions", "that", "contain", "a", "variable", "with", "the", "hash", "of", "h", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L944-L960
[ "def", "addrs_for_hash", "(", "self", ",", "h", ")", ":", "if", "h", "not", "in", "self", ".", "_hash_mapping", ":", "return", "self", ".", "_mark_updated_mapping", "(", "self", ".", "_hash_mapping", ",", "h", ")", "to_discard", "=", "set", "(", ")", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimPagedMemory.flush_pages
:param white_list: white list of page number to exclude from the flush
angr/storage/paged_memory.py
def flush_pages(self, white_list): """ :param white_list: white list of page number to exclude from the flush """ white_list_page_number = [] for addr in white_list: for page_addr in range(addr[0], addr[1], self._page_size): white_list_page_number...
def flush_pages(self, white_list): """ :param white_list: white list of page number to exclude from the flush """ white_list_page_number = [] for addr in white_list: for page_addr in range(addr[0], addr[1], self._page_size): white_list_page_number...
[ ":", "param", "white_list", ":", "white", "list", "of", "page", "number", "to", "exclude", "from", "the", "flush" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L1079-L1098
[ "def", "flush_pages", "(", "self", ",", "white_list", ")", ":", "white_list_page_number", "=", "[", "]", "for", "addr", "in", "white_list", ":", "for", "page_addr", "in", "range", "(", "addr", "[", "0", "]", ",", "addr", "[", "1", "]", ",", "self", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSystemPosix.open
Open a symbolic file. Basically open(2). :param name: Path of the symbolic file, as a string or bytes. :type name: string or bytes :param flags: File operation flags, a bitfield of constants from open(2), as an AST :param preferred_fd: Assign this fd ...
angr/state_plugins/posix.py
def open(self, name, flags, preferred_fd=None): """ Open a symbolic file. Basically open(2). :param name: Path of the symbolic file, as a string or bytes. :type name: string or bytes :param flags: File operation flags, a bitfield of constants fro...
def open(self, name, flags, preferred_fd=None): """ Open a symbolic file. Basically open(2). :param name: Path of the symbolic file, as a string or bytes. :type name: string or bytes :param flags: File operation flags, a bitfield of constants fro...
[ "Open", "a", "symbolic", "file", ".", "Basically", "open", "(", "2", ")", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/posix.py#L267-L316
[ "def", "open", "(", "self", ",", "name", ",", "flags", ",", "preferred_fd", "=", "None", ")", ":", "if", "len", "(", "name", ")", "==", "0", ":", "return", "None", "if", "type", "(", "name", ")", "is", "str", ":", "name", "=", "name", ".", "enc...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSystemPosix.get_fd
Looks up the SimFileDescriptor associated with the given number (an AST). If the number is concrete and does not map to anything, return None. If the number is symbolic, constrain it to an open fd and create a new file for it.
angr/state_plugins/posix.py
def get_fd(self, fd): """ Looks up the SimFileDescriptor associated with the given number (an AST). If the number is concrete and does not map to anything, return None. If the number is symbolic, constrain it to an open fd and create a new file for it. """ try: ...
def get_fd(self, fd): """ Looks up the SimFileDescriptor associated with the given number (an AST). If the number is concrete and does not map to anything, return None. If the number is symbolic, constrain it to an open fd and create a new file for it. """ try: ...
[ "Looks", "up", "the", "SimFileDescriptor", "associated", "with", "the", "given", "number", "(", "an", "AST", ")", ".", "If", "the", "number", "is", "concrete", "and", "does", "not", "map", "to", "anything", "return", "None", ".", "If", "the", "number", "...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/posix.py#L355-L375
[ "def", "get_fd", "(", "self", ",", "fd", ")", ":", "try", ":", "fd", "=", "self", ".", "state", ".", "solver", ".", "eval_one", "(", "fd", ")", "except", "SimSolverError", ":", "ideal", "=", "self", ".", "_pick_fd", "(", ")", "self", ".", "state", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSystemPosix.close
Closes the given file descriptor (an AST). Returns whether the operation succeeded (a concrete boolean)
angr/state_plugins/posix.py
def close(self, fd): """ Closes the given file descriptor (an AST). Returns whether the operation succeeded (a concrete boolean) """ try: fd = self.state.solver.eval_one(fd) except SimSolverError: l.error("Trying to close a symbolic file descriptor...
def close(self, fd): """ Closes the given file descriptor (an AST). Returns whether the operation succeeded (a concrete boolean) """ try: fd = self.state.solver.eval_one(fd) except SimSolverError: l.error("Trying to close a symbolic file descriptor...
[ "Closes", "the", "given", "file", "descriptor", "(", "an", "AST", ")", ".", "Returns", "whether", "the", "operation", "succeeded", "(", "a", "concrete", "boolean", ")" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/posix.py#L377-L396
[ "def", "close", "(", "self", ",", "fd", ")", ":", "try", ":", "fd", "=", "self", ".", "state", ".", "solver", ".", "eval_one", "(", "fd", ")", "except", "SimSolverError", ":", "l", ".", "error", "(", "\"Trying to close a symbolic file descriptor\"", ")", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSystemPosix.sigmask
Gets the current sigmask. If it's blank, a new one is created (of sigsetsize). :param sigsetsize: the size (in *bytes* of the sigmask set) :return: the sigmask
angr/state_plugins/posix.py
def sigmask(self, sigsetsize=None): """ Gets the current sigmask. If it's blank, a new one is created (of sigsetsize). :param sigsetsize: the size (in *bytes* of the sigmask set) :return: the sigmask """ if self._sigmask is None: if sigsetsize is not None: ...
def sigmask(self, sigsetsize=None): """ Gets the current sigmask. If it's blank, a new one is created (of sigsetsize). :param sigsetsize: the size (in *bytes* of the sigmask set) :return: the sigmask """ if self._sigmask is None: if sigsetsize is not None: ...
[ "Gets", "the", "current", "sigmask", ".", "If", "it", "s", "blank", "a", "new", "one", "is", "created", "(", "of", "sigsetsize", ")", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/posix.py#L425-L439
[ "def", "sigmask", "(", "self", ",", "sigsetsize", "=", "None", ")", ":", "if", "self", ".", "_sigmask", "is", "None", ":", "if", "sigsetsize", "is", "not", "None", ":", "sc", "=", "self", ".", "state", ".", "solver", ".", "eval", "(", "sigsetsize", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSystemPosix.sigprocmask
Updates the signal mask. :param how: the "how" argument of sigprocmask (see manpage) :param new_mask: the mask modification to apply :param sigsetsize: the size (in *bytes* of the sigmask set) :param valid_ptr: is set if the new_mask was not NULL
angr/state_plugins/posix.py
def sigprocmask(self, how, new_mask, sigsetsize, valid_ptr=True): """ Updates the signal mask. :param how: the "how" argument of sigprocmask (see manpage) :param new_mask: the mask modification to apply :param sigsetsize: the size (in *bytes* of the sigmask set) :param v...
def sigprocmask(self, how, new_mask, sigsetsize, valid_ptr=True): """ Updates the signal mask. :param how: the "how" argument of sigprocmask (see manpage) :param new_mask: the mask modification to apply :param sigsetsize: the size (in *bytes* of the sigmask set) :param v...
[ "Updates", "the", "signal", "mask", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/posix.py#L441-L463
[ "def", "sigprocmask", "(", "self", ",", "how", ",", "new_mask", ",", "sigsetsize", ",", "valid_ptr", "=", "True", ")", ":", "oldmask", "=", "self", ".", "sigmask", "(", "sigsetsize", ")", "self", ".", "_sigmask", "=", "self", ".", "state", ".", "solver...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSystemPosix.dump_file_by_path
Returns the concrete content for a file by path. :param path: file path as string :param kwargs: passed to state.solver.eval :return: file contents as string
angr/state_plugins/posix.py
def dump_file_by_path(self, path, **kwargs): """ Returns the concrete content for a file by path. :param path: file path as string :param kwargs: passed to state.solver.eval :return: file contents as string """ file = self.state.fs.get(path) if file is No...
def dump_file_by_path(self, path, **kwargs): """ Returns the concrete content for a file by path. :param path: file path as string :param kwargs: passed to state.solver.eval :return: file contents as string """ file = self.state.fs.get(path) if file is No...
[ "Returns", "the", "concrete", "content", "for", "a", "file", "by", "path", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/posix.py#L540-L551
[ "def", "dump_file_by_path", "(", "self", ",", "path", ",", "*", "*", "kwargs", ")", ":", "file", "=", "self", ".", "state", ".", "fs", ".", "get", "(", "path", ")", "if", "file", "is", "None", ":", "return", "None", "return", "file", ".", "concreti...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimSystemPosix.dumps
Returns the concrete content for a file descriptor. BACKWARD COMPATIBILITY: if you ask for file descriptors 0 1 or 2, it will return the data from stdin, stdout, or stderr as a flat string. :param fd: A file descriptor. :return: The concrete content. :rtype: str
angr/state_plugins/posix.py
def dumps(self, fd, **kwargs): """ Returns the concrete content for a file descriptor. BACKWARD COMPATIBILITY: if you ask for file descriptors 0 1 or 2, it will return the data from stdin, stdout, or stderr as a flat string. :param fd: A file descriptor. :return: Th...
def dumps(self, fd, **kwargs): """ Returns the concrete content for a file descriptor. BACKWARD COMPATIBILITY: if you ask for file descriptors 0 1 or 2, it will return the data from stdin, stdout, or stderr as a flat string. :param fd: A file descriptor. :return: Th...
[ "Returns", "the", "concrete", "content", "for", "a", "file", "descriptor", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/posix.py#L553-L569
[ "def", "dumps", "(", "self", ",", "fd", ",", "*", "*", "kwargs", ")", ":", "if", "0", "<=", "fd", "<=", "2", ":", "data", "=", "[", "self", ".", "stdin", ",", "self", ".", "stdout", ",", "self", ".", "stderr", "]", "[", "fd", "]", ".", "con...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimEngineConcrete.to_engine
Handle the concrete execution of the process This method takes care of: 1- Set the breakpoints on the addresses provided by the user 2- Concretize the symbolic variables and perform the write inside the concrete process 3- Continue the program execution. :param state: ...
angr/engines/concrete.py
def to_engine(self, state, extra_stop_points, concretize, timeout): """ Handle the concrete execution of the process This method takes care of: 1- Set the breakpoints on the addresses provided by the user 2- Concretize the symbolic variables and perform the write inside the concr...
def to_engine(self, state, extra_stop_points, concretize, timeout): """ Handle the concrete execution of the process This method takes care of: 1- Set the breakpoints on the addresses provided by the user 2- Concretize the symbolic variables and perform the write inside the concr...
[ "Handle", "the", "concrete", "execution", "of", "the", "process", "This", "method", "takes", "care", "of", ":", "1", "-", "Set", "the", "breakpoints", "on", "the", "addresses", "provided", "by", "the", "user", "2", "-", "Concretize", "the", "symbolic", "va...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/concrete.py#L56-L128
[ "def", "to_engine", "(", "self", ",", "state", ",", "extra_stop_points", ",", "concretize", ",", "timeout", ")", ":", "state", ".", "timeout", "=", "False", "state", ".", "errored", "=", "False", "extra_stop_points", "=", "[", "]", "if", "extra_stop_points",...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimEngineConcrete.check_concrete_target_methods
Check if the concrete target methods return the correct type of data :return: True if the concrete target is compliant
angr/engines/concrete.py
def check_concrete_target_methods(concrete_target): """ Check if the concrete target methods return the correct type of data :return: True if the concrete target is compliant """ entry_point = concrete_target.read_register("pc") if not type(entry_point) is int: ...
def check_concrete_target_methods(concrete_target): """ Check if the concrete target methods return the correct type of data :return: True if the concrete target is compliant """ entry_point = concrete_target.read_register("pc") if not type(entry_point) is int: ...
[ "Check", "if", "the", "concrete", "target", "methods", "return", "the", "correct", "type", "of", "data", ":", "return", ":", "True", "if", "the", "concrete", "target", "is", "compliant" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/concrete.py#L131-L163
[ "def", "check_concrete_target_methods", "(", "concrete_target", ")", ":", "entry_point", "=", "concrete_target", ".", "read_register", "(", "\"pc\"", ")", "if", "not", "type", "(", "entry_point", ")", "is", "int", ":", "l", ".", "error", "(", "\"read_register re...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimEngineVEX.process
:param state: The state with which to execute :param irsb: The PyVEX IRSB object to use for execution. If not provided one will be lifted. :param skip_stmts: The number of statements to skip in processing :param last_stmt: Do not execute any statements after this statement ...
angr/engines/vex/engine.py
def process(self, state, irsb=None, skip_stmts=0, last_stmt=99999999, whitelist=None, inline=False, force_addr=None, insn_bytes=None, size=None, num_inst=None, traceflags=0, thumb=False, ...
def process(self, state, irsb=None, skip_stmts=0, last_stmt=99999999, whitelist=None, inline=False, force_addr=None, insn_bytes=None, size=None, num_inst=None, traceflags=0, thumb=False, ...
[ ":", "param", "state", ":", "The", "state", "with", "which", "to", "execute", ":", "param", "irsb", ":", "The", "PyVEX", "IRSB", "object", "to", "use", "for", "execution", ".", "If", "not", "provided", "one", "will", "be", "lifted", ".", ":", "param", ...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/vex/engine.py#L88-L147
[ "def", "process", "(", "self", ",", "state", ",", "irsb", "=", "None", ",", "skip_stmts", "=", "0", ",", "last_stmt", "=", "99999999", ",", "whitelist", "=", "None", ",", "inline", "=", "False", ",", "force_addr", "=", "None", ",", "insn_bytes", "=", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimEngineVEX._handle_statement
This function receives an initial state and imark and processes a list of pyvex.IRStmts It annotates the request with a final state, last imark, and a list of SimIRStmts
angr/engines/vex/engine.py
def _handle_statement(self, state, successors, stmt): """ This function receives an initial state and imark and processes a list of pyvex.IRStmts It annotates the request with a final state, last imark, and a list of SimIRStmts """ if type(stmt) == pyvex.IRStmt.IMark: ...
def _handle_statement(self, state, successors, stmt): """ This function receives an initial state and imark and processes a list of pyvex.IRStmts It annotates the request with a final state, last imark, and a list of SimIRStmts """ if type(stmt) == pyvex.IRStmt.IMark: ...
[ "This", "function", "receives", "an", "initial", "state", "and", "imark", "and", "processes", "a", "list", "of", "pyvex", ".", "IRStmts", "It", "annotates", "the", "request", "with", "a", "final", "state", "last", "imark", "and", "a", "list", "of", "SimIRS...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/vex/engine.py#L362-L439
[ "def", "_handle_statement", "(", "self", ",", "state", ",", "successors", ",", "stmt", ")", ":", "if", "type", "(", "stmt", ")", "==", "pyvex", ".", "IRStmt", ".", "IMark", ":", "# TODO how much of this could be moved into the imark handler", "ins_addr", "=", "s...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimEngineVEX.lift
Lift an IRSB. There are many possible valid sets of parameters. You at the very least must pass some source of data, some source of an architecture, and some source of an address. Sources of data in order of priority: insn_bytes, clemory, state Sources of an address, in order of prior...
angr/engines/vex/engine.py
def lift(self, state=None, clemory=None, insn_bytes=None, arch=None, addr=None, size=None, num_inst=None, traceflags=0, thumb=False, extra_stop_points=None, opt_level=None, ...
def lift(self, state=None, clemory=None, insn_bytes=None, arch=None, addr=None, size=None, num_inst=None, traceflags=0, thumb=False, extra_stop_points=None, opt_level=None, ...
[ "Lift", "an", "IRSB", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/vex/engine.py#L466-L641
[ "def", "lift", "(", "self", ",", "state", "=", "None", ",", "clemory", "=", "None", ",", "insn_bytes", "=", "None", ",", "arch", "=", "None", ",", "addr", "=", "None", ",", "size", "=", "None", ",", "num_inst", "=", "None", ",", "traceflags", "=", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimEngineVEX._first_stoppoint
Enumerate the imarks in the block. If any of them (after the first one) are at a stop point, returns the address of the stop point. None is returned otherwise.
angr/engines/vex/engine.py
def _first_stoppoint(self, irsb, extra_stop_points=None): """ Enumerate the imarks in the block. If any of them (after the first one) are at a stop point, returns the address of the stop point. None is returned otherwise. """ if self._stop_points is None and extra_stop_points is ...
def _first_stoppoint(self, irsb, extra_stop_points=None): """ Enumerate the imarks in the block. If any of them (after the first one) are at a stop point, returns the address of the stop point. None is returned otherwise. """ if self._stop_points is None and extra_stop_points is ...
[ "Enumerate", "the", "imarks", "in", "the", "block", ".", "If", "any", "of", "them", "(", "after", "the", "first", "one", ")", "are", "at", "a", "stop", "point", "returns", "the", "address", "of", "the", "stop", "point", ".", "None", "is", "returned", ...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/vex/engine.py#L712-L732
[ "def", "_first_stoppoint", "(", "self", ",", "irsb", ",", "extra_stop_points", "=", "None", ")", ":", "if", "self", ".", "_stop_points", "is", "None", "and", "extra_stop_points", "is", "None", "and", "self", ".", "project", "is", "None", ":", "return", "No...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FunctionManager._genenare_callmap_sif
Generate a sif file from the call map. :param filepath: Path of the sif file :return: None
angr/knowledge_plugins/functions/function_manager.py
def _genenare_callmap_sif(self, filepath): """ Generate a sif file from the call map. :param filepath: Path of the sif file :return: None """ with open(filepath, "wb") as f: for src, dst in self.callgraph.edges(): f.write("%#x\tD...
def _genenare_callmap_sif(self, filepath): """ Generate a sif file from the call map. :param filepath: Path of the sif file :return: None """ with open(filepath, "wb") as f: for src, dst in self.callgraph.edges(): f.write("%#x\tD...
[ "Generate", "a", "sif", "file", "from", "the", "call", "map", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function_manager.py#L91-L100
[ "def", "_genenare_callmap_sif", "(", "self", ",", "filepath", ")", ":", "with", "open", "(", "filepath", ",", "\"wb\"", ")", "as", "f", ":", "for", "src", ",", "dst", "in", "self", ".", "callgraph", ".", "edges", "(", ")", ":", "f", ".", "write", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FunctionManager.ceiling_func
Return the function who has the least address that is greater than or equal to `addr`. :param int addr: The address to query. :return: A Function instance, or None if there is no other function after `addr`. :rtype: Function or None
angr/knowledge_plugins/functions/function_manager.py
def ceiling_func(self, addr): """ Return the function who has the least address that is greater than or equal to `addr`. :param int addr: The address to query. :return: A Function instance, or None if there is no other function after `addr`. :rtype: Function or ...
def ceiling_func(self, addr): """ Return the function who has the least address that is greater than or equal to `addr`. :param int addr: The address to query. :return: A Function instance, or None if there is no other function after `addr`. :rtype: Function or ...
[ "Return", "the", "function", "who", "has", "the", "least", "address", "that", "is", "greater", "than", "or", "equal", "to", "addr", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function_manager.py#L287-L301
[ "def", "ceiling_func", "(", "self", ",", "addr", ")", ":", "try", ":", "next_addr", "=", "self", ".", "_function_map", ".", "ceiling_addr", "(", "addr", ")", "return", "self", ".", "_function_map", ".", "get", "(", "next_addr", ")", "except", "KeyError", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FunctionManager.floor_func
Return the function who has the greatest address that is less than or equal to `addr`. :param int addr: The address to query. :return: A Function instance, or None if there is no other function before `addr`. :rtype: Function or None
angr/knowledge_plugins/functions/function_manager.py
def floor_func(self, addr): """ Return the function who has the greatest address that is less than or equal to `addr`. :param int addr: The address to query. :return: A Function instance, or None if there is no other function before `addr`. :rtype: Function or N...
def floor_func(self, addr): """ Return the function who has the greatest address that is less than or equal to `addr`. :param int addr: The address to query. :return: A Function instance, or None if there is no other function before `addr`. :rtype: Function or N...
[ "Return", "the", "function", "who", "has", "the", "greatest", "address", "that", "is", "less", "than", "or", "equal", "to", "addr", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function_manager.py#L303-L317
[ "def", "floor_func", "(", "self", ",", "addr", ")", ":", "try", ":", "prev_addr", "=", "self", ".", "_function_map", ".", "floor_addr", "(", "addr", ")", "return", "self", ".", "_function_map", "[", "prev_addr", "]", "except", "KeyError", ":", "return", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
FunctionManager.function
Get a function object from the function manager. Pass either `addr` or `name` with the appropriate values. :param int addr: Address of the function. :param str name: Name of the function. :param bool create: Whether to create the function or not if the function does not exist. ...
angr/knowledge_plugins/functions/function_manager.py
def function(self, addr=None, name=None, create=False, syscall=False, plt=None): """ Get a function object from the function manager. Pass either `addr` or `name` with the appropriate values. :param int addr: Address of the function. :param str name: Name of the function. ...
def function(self, addr=None, name=None, create=False, syscall=False, plt=None): """ Get a function object from the function manager. Pass either `addr` or `name` with the appropriate values. :param int addr: Address of the function. :param str name: Name of the function. ...
[ "Get", "a", "function", "object", "from", "the", "function", "manager", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function_manager.py#L319-L354
[ "def", "function", "(", "self", ",", "addr", "=", "None", ",", "name", "=", "None", ",", "create", "=", "False", ",", "syscall", "=", "False", ",", "plt", "=", "None", ")", ":", "if", "addr", "is", "not", "None", ":", "try", ":", "f", "=", "sel...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
CDG.get_dependants
Return a list of nodes that are control dependent on the given node in the control dependence graph
angr/analyses/cdg.py
def get_dependants(self, run): """ Return a list of nodes that are control dependent on the given node in the control dependence graph """ if run in self._graph.nodes(): return list(self._graph.successors(run)) else: return []
def get_dependants(self, run): """ Return a list of nodes that are control dependent on the given node in the control dependence graph """ if run in self._graph.nodes(): return list(self._graph.successors(run)) else: return []
[ "Return", "a", "list", "of", "nodes", "that", "are", "control", "dependent", "on", "the", "given", "node", "in", "the", "control", "dependence", "graph" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cdg.py#L62-L69
[ "def", "get_dependants", "(", "self", ",", "run", ")", ":", "if", "run", "in", "self", ".", "_graph", ".", "nodes", "(", ")", ":", "return", "list", "(", "self", ".", "_graph", ".", "successors", "(", "run", ")", ")", "else", ":", "return", "[", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
CDG.get_guardians
Return a list of nodes on whom the specific node is control dependent in the control dependence graph
angr/analyses/cdg.py
def get_guardians(self, run): """ Return a list of nodes on whom the specific node is control dependent in the control dependence graph """ if run in self._graph.nodes(): return list(self._graph.predecessors(run)) else: return []
def get_guardians(self, run): """ Return a list of nodes on whom the specific node is control dependent in the control dependence graph """ if run in self._graph.nodes(): return list(self._graph.predecessors(run)) else: return []
[ "Return", "a", "list", "of", "nodes", "on", "whom", "the", "specific", "node", "is", "control", "dependent", "in", "the", "control", "dependence", "graph" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cdg.py#L71-L78
[ "def", "get_guardians", "(", "self", ",", "run", ")", ":", "if", "run", "in", "self", ".", "_graph", ".", "nodes", "(", ")", ":", "return", "list", "(", "self", ".", "_graph", ".", "predecessors", "(", "run", ")", ")", "else", ":", "return", "[", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
CDG._construct
Construct a control dependence graph. This implementation is based on figure 6 of paper An Efficient Method of Computing Static Single Assignment Form by Ron Cytron, etc.
angr/analyses/cdg.py
def _construct(self): """ Construct a control dependence graph. This implementation is based on figure 6 of paper An Efficient Method of Computing Static Single Assignment Form by Ron Cytron, etc. """ self._acyclic_cfg = self._cfg.copy() # TODO: Cycle-removing i...
def _construct(self): """ Construct a control dependence graph. This implementation is based on figure 6 of paper An Efficient Method of Computing Static Single Assignment Form by Ron Cytron, etc. """ self._acyclic_cfg = self._cfg.copy() # TODO: Cycle-removing i...
[ "Construct", "a", "control", "dependence", "graph", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cdg.py#L84-L112
[ "def", "_construct", "(", "self", ")", ":", "self", ".", "_acyclic_cfg", "=", "self", ".", "_cfg", ".", "copy", "(", ")", "# TODO: Cycle-removing is not needed - confirm it later", "# The CFG we use should be acyclic!", "#self._acyclic_cfg.remove_cycles()", "# Pre-process the...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
CDG._pre_process_cfg
Pre-process the acyclic CFG. - Change all FakeRet edges to normal edges when necessary (e.g. the normal/expected return edge does not exist)
angr/analyses/cdg.py
def _pre_process_cfg(self): """ Pre-process the acyclic CFG. - Change all FakeRet edges to normal edges when necessary (e.g. the normal/expected return edge does not exist) """ for _, dst, data in self._acyclic_cfg.graph.edges(data=True): if 'jumpkind' in data and dat...
def _pre_process_cfg(self): """ Pre-process the acyclic CFG. - Change all FakeRet edges to normal edges when necessary (e.g. the normal/expected return edge does not exist) """ for _, dst, data in self._acyclic_cfg.graph.edges(data=True): if 'jumpkind' in data and dat...
[ "Pre", "-", "process", "the", "acyclic", "CFG", ".", "-", "Change", "all", "FakeRet", "edges", "to", "normal", "edges", "when", "necessary", "(", "e", ".", "g", ".", "the", "normal", "/", "expected", "return", "edge", "does", "not", "exist", ")" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cdg.py#L116-L128
[ "def", "_pre_process_cfg", "(", "self", ")", ":", "for", "_", ",", "dst", ",", "data", "in", "self", ".", "_acyclic_cfg", ".", "graph", ".", "edges", "(", "data", "=", "True", ")", ":", "if", "'jumpkind'", "in", "data", "and", "data", "[", "'jumpkind...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
CDG._post_process
There are cases where a loop has two overlapping loop headers thanks to the way VEX is dealing with continuous instructions. As we were breaking the connection between the second loop header and its successor, we shall restore them in our CDG.
angr/analyses/cdg.py
def _post_process(self): """ There are cases where a loop has two overlapping loop headers thanks to the way VEX is dealing with continuous instructions. As we were breaking the connection between the second loop header and its successor, we shall restore them in our CDG. ...
def _post_process(self): """ There are cases where a loop has two overlapping loop headers thanks to the way VEX is dealing with continuous instructions. As we were breaking the connection between the second loop header and its successor, we shall restore them in our CDG. ...
[ "There", "are", "cases", "where", "a", "loop", "has", "two", "overlapping", "loop", "headers", "thanks", "to", "the", "way", "VEX", "is", "dealing", "with", "continuous", "instructions", ".", "As", "we", "were", "breaking", "the", "connection", "between", "t...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cdg.py#L130-L140
[ "def", "_post_process", "(", "self", ")", ":", "# TODO: Verify its correctness", "loop_back_edges", "=", "self", ".", "_cfg", ".", "get_loop_back_edges", "(", ")", "for", "b1", ",", "b2", "in", "loop_back_edges", ":", "self", ".", "_graph", ".", "add_edge", "(...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
CDG._pd_post_process
Take care of those loop headers/tails where we manually broke their connection to the next BBL
angr/analyses/cdg.py
def _pd_post_process(self, cfg): """ Take care of those loop headers/tails where we manually broke their connection to the next BBL """ loop_back_edges = self._cfg.get_loop_back_edges() for b1, b2 in loop_back_edges: # The edge between b1 and b2 is manually b...
def _pd_post_process(self, cfg): """ Take care of those loop headers/tails where we manually broke their connection to the next BBL """ loop_back_edges = self._cfg.get_loop_back_edges() for b1, b2 in loop_back_edges: # The edge between b1 and b2 is manually b...
[ "Take", "care", "of", "those", "loop", "headers", "/", "tails", "where", "we", "manually", "broke", "their", "connection", "to", "the", "next", "BBL" ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cdg.py#L171-L188
[ "def", "_pd_post_process", "(", "self", ",", "cfg", ")", ":", "loop_back_edges", "=", "self", ".", "_cfg", ".", "get_loop_back_edges", "(", ")", "for", "b1", ",", "b2", "in", "loop_back_edges", ":", "# The edge between b1 and b2 is manually broken", "# The post domi...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
VariableManagerInternal.make_phi_node
Create a phi variable for variables at block `block_addr`. :param int block_addr: The address of the current block. :param variables: Variables that the phi variable represents. :return: The created phi variable.
angr/knowledge_plugins/variables/variable_manager.py
def make_phi_node(self, block_addr, *variables): """ Create a phi variable for variables at block `block_addr`. :param int block_addr: The address of the current block. :param variables: Variables that the phi variable represents. :return: The created phi v...
def make_phi_node(self, block_addr, *variables): """ Create a phi variable for variables at block `block_addr`. :param int block_addr: The address of the current block. :param variables: Variables that the phi variable represents. :return: The created phi v...
[ "Create", "a", "phi", "variable", "for", "variables", "at", "block", "block_addr", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/variables/variable_manager.py#L125-L168
[ "def", "make_phi_node", "(", "self", ",", "block_addr", ",", "*", "variables", ")", ":", "existing_phis", "=", "set", "(", ")", "non_phis", "=", "set", "(", ")", "for", "var", "in", "variables", ":", "if", "self", ".", "is_phi_variable", "(", "var", ")...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
VariableManagerInternal.get_variables
Get a list of variables. :param str or None sort: Sort of the variable to get. :param collapse_same_ident: Whether variables of the same identifier should be collapsed or not. :return: A list of variables. :rtype: list
angr/knowledge_plugins/variables/variable_manager.py
def get_variables(self, sort=None, collapse_same_ident=False): """ Get a list of variables. :param str or None sort: Sort of the variable to get. :param collapse_same_ident: Whether variables of the same identifier should be collapsed or not. :return: A lis...
def get_variables(self, sort=None, collapse_same_ident=False): """ Get a list of variables. :param str or None sort: Sort of the variable to get. :param collapse_same_ident: Whether variables of the same identifier should be collapsed or not. :return: A lis...
[ "Get", "a", "list", "of", "variables", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/variables/variable_manager.py#L253-L275
[ "def", "get_variables", "(", "self", ",", "sort", "=", "None", ",", "collapse_same_ident", "=", "False", ")", ":", "variables", "=", "[", "]", "if", "collapse_same_ident", ":", "raise", "NotImplementedError", "(", ")", "for", "var", "in", "self", ".", "_va...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
VariableManagerInternal.get_phi_subvariables
Get sub-variables that phi variable `var` represents. :param SimVariable var: The variable instance. :return: A set of sub-variables, or an empty set if `var` is not a phi variable. :rtype: set
angr/knowledge_plugins/variables/variable_manager.py
def get_phi_subvariables(self, var): """ Get sub-variables that phi variable `var` represents. :param SimVariable var: The variable instance. :return: A set of sub-variables, or an empty set if `var` is not a phi variable. :rtype: set """ ...
def get_phi_subvariables(self, var): """ Get sub-variables that phi variable `var` represents. :param SimVariable var: The variable instance. :return: A set of sub-variables, or an empty set if `var` is not a phi variable. :rtype: set """ ...
[ "Get", "sub", "-", "variables", "that", "phi", "variable", "var", "represents", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/variables/variable_manager.py#L288-L299
[ "def", "get_phi_subvariables", "(", "self", ",", "var", ")", ":", "if", "not", "self", ".", "is_phi_variable", "(", "var", ")", ":", "return", "set", "(", ")", "return", "self", ".", "_phi_variables", "[", "var", "]" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
VariableManagerInternal.get_phi_variables
Get a dict of phi variables and their corresponding variables. :param int block_addr: Address of the block. :return: A dict of phi variables of an empty dict if there are no phi variables at the block. :rtype: dict
angr/knowledge_plugins/variables/variable_manager.py
def get_phi_variables(self, block_addr): """ Get a dict of phi variables and their corresponding variables. :param int block_addr: Address of the block. :return: A dict of phi variables of an empty dict if there are no phi variables at the block. :rtype: ...
def get_phi_variables(self, block_addr): """ Get a dict of phi variables and their corresponding variables. :param int block_addr: Address of the block. :return: A dict of phi variables of an empty dict if there are no phi variables at the block. :rtype: ...
[ "Get", "a", "dict", "of", "phi", "variables", "and", "their", "corresponding", "variables", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/variables/variable_manager.py#L301-L315
[ "def", "get_phi_variables", "(", "self", ",", "block_addr", ")", ":", "if", "block_addr", "not", "in", "self", ".", "_phi_variables_by_block", ":", "return", "dict", "(", ")", "variables", "=", "{", "}", "for", "phi", "in", "self", ".", "_phi_variables_by_bl...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
VariableManagerInternal.input_variables
Get all variables that have never been written to. :return: A list of variables that are never written to.
angr/knowledge_plugins/variables/variable_manager.py
def input_variables(self, exclude_specials=True): """ Get all variables that have never been written to. :return: A list of variables that are never written to. """ def has_write_access(accesses): return any(acc for acc in accesses if acc.access_type == 'write') ...
def input_variables(self, exclude_specials=True): """ Get all variables that have never been written to. :return: A list of variables that are never written to. """ def has_write_access(accesses): return any(acc for acc in accesses if acc.access_type == 'write') ...
[ "Get", "all", "variables", "that", "have", "never", "been", "written", "to", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/variables/variable_manager.py#L317-L337
[ "def", "input_variables", "(", "self", ",", "exclude_specials", "=", "True", ")", ":", "def", "has_write_access", "(", "accesses", ")", ":", "return", "any", "(", "acc", "for", "acc", "in", "accesses", "if", "acc", ".", "access_type", "==", "'write'", ")",...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
VariableManagerInternal.assign_variable_names
Assign default names to all variables. :return: None
angr/knowledge_plugins/variables/variable_manager.py
def assign_variable_names(self): """ Assign default names to all variables. :return: None """ for var in self._variables: if isinstance(var, SimStackVariable): if var.name is not None: continue if var.ident.startsw...
def assign_variable_names(self): """ Assign default names to all variables. :return: None """ for var in self._variables: if isinstance(var, SimStackVariable): if var.name is not None: continue if var.ident.startsw...
[ "Assign", "default", "names", "to", "all", "variables", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/variables/variable_manager.py#L339-L358
[ "def", "assign_variable_names", "(", "self", ")", ":", "for", "var", "in", "self", ".", "_variables", ":", "if", "isinstance", "(", "var", ",", "SimStackVariable", ")", ":", "if", "var", ".", "name", "is", "not", "None", ":", "continue", "if", "var", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
VariableManager.get_variable_accesses
Get a list of all references to the given variable. :param SimVariable variable: The variable. :param bool same_name: Whether to include all variables with the same variable name, or just based on the variable identifier. :retur...
angr/knowledge_plugins/variables/variable_manager.py
def get_variable_accesses(self, variable, same_name=False): """ Get a list of all references to the given variable. :param SimVariable variable: The variable. :param bool same_name: Whether to include all variables with the same variable name, or just ...
def get_variable_accesses(self, variable, same_name=False): """ Get a list of all references to the given variable. :param SimVariable variable: The variable. :param bool same_name: Whether to include all variables with the same variable name, or just ...
[ "Get", "a", "list", "of", "all", "references", "to", "the", "given", "variable", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/variables/variable_manager.py#L405-L423
[ "def", "get_variable_accesses", "(", "self", ",", "variable", ",", "same_name", "=", "False", ")", ":", "if", "variable", ".", "region", "==", "'global'", ":", "return", "self", ".", "global_manager", ".", "get_variable_accesses", "(", "variable", ",", "same_n...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
Callable.call_c
Call this Callable with a string of C-style arguments. :param str c_args: C-style arguments. :return: The return value from the call. :rtype: claripy.Ast
angr/callable.py
def call_c(self, c_args): """ Call this Callable with a string of C-style arguments. :param str c_args: C-style arguments. :return: The return value from the call. :rtype: claripy.Ast """ c_args = c_args.strip() if c_args[0] != "(...
def call_c(self, c_args): """ Call this Callable with a string of C-style arguments. :param str c_args: C-style arguments. :return: The return value from the call. :rtype: claripy.Ast """ c_args = c_args.strip() if c_args[0] != "(...
[ "Call", "this", "Callable", "with", "a", "string", "of", "C", "-", "style", "arguments", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/callable.py#L84-L125
[ "def", "call_c", "(", "self", ",", "c_args", ")", ":", "c_args", "=", "c_args", ".", "strip", "(", ")", "if", "c_args", "[", "0", "]", "!=", "\"(\"", ":", "c_args", "=", "\"(\"", "+", "c_args", "if", "c_args", "[", "-", "1", "]", "!=", "\")\"", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimStateHistory.trim
Discard the ancestry of this state.
angr/state_plugins/history.py
def trim(self): """ Discard the ancestry of this state. """ new_hist = self.copy({}) new_hist.parent = None self.state.register_plugin('history', new_hist)
def trim(self): """ Discard the ancestry of this state. """ new_hist = self.copy({}) new_hist.parent = None self.state.register_plugin('history', new_hist)
[ "Discard", "the", "ancestry", "of", "this", "state", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/history.py#L147-L153
[ "def", "trim", "(", "self", ")", ":", "new_hist", "=", "self", ".", "copy", "(", "{", "}", ")", "new_hist", ".", "parent", "=", "None", "self", ".", "state", ".", "register_plugin", "(", "'history'", ",", "new_hist", ")" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimStateHistory.filter_actions
Filter self.actions based on some common parameters. :param block_addr: Only return actions generated in blocks starting at this address. :param block_stmt: Only return actions generated in the nth statement of each block. :param insn_addr: Only return actions generated in the assembly inst...
angr/state_plugins/history.py
def filter_actions(self, block_addr=None, block_stmt=None, insn_addr=None, read_from=None, write_to=None): """ Filter self.actions based on some common parameters. :param block_addr: Only return actions generated in blocks starting at this address. :param block_stmt: Only return actio...
def filter_actions(self, block_addr=None, block_stmt=None, insn_addr=None, read_from=None, write_to=None): """ Filter self.actions based on some common parameters. :param block_addr: Only return actions generated in blocks starting at this address. :param block_stmt: Only return actio...
[ "Filter", "self", ".", "actions", "based", "on", "some", "common", "parameters", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/history.py#L155-L253
[ "def", "filter_actions", "(", "self", ",", "block_addr", "=", "None", ",", "block_stmt", "=", "None", ",", "insn_addr", "=", "None", ",", "read_from", "=", "None", ",", "write_to", "=", "None", ")", ":", "if", "read_from", "is", "not", "None", ":", "if...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimStateHistory.closest_common_ancestor
Find the common ancestor between this history node and 'other'. :param other: the PathHistory to find a common ancestor with. :return: the common ancestor SimStateHistory, or None if there isn't one
angr/state_plugins/history.py
def closest_common_ancestor(self, other): """ Find the common ancestor between this history node and 'other'. :param other: the PathHistory to find a common ancestor with. :return: the common ancestor SimStateHistory, or None if there isn't one """ our_history_...
def closest_common_ancestor(self, other): """ Find the common ancestor between this history node and 'other'. :param other: the PathHistory to find a common ancestor with. :return: the common ancestor SimStateHistory, or None if there isn't one """ our_history_...
[ "Find", "the", "common", "ancestor", "between", "this", "history", "node", "and", "other", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/history.py#L382-L419
[ "def", "closest_common_ancestor", "(", "self", ",", "other", ")", ":", "our_history_iter", "=", "reversed", "(", "HistoryIter", "(", "self", ")", ")", "their_history_iter", "=", "reversed", "(", "HistoryIter", "(", "other", ")", ")", "sofar", "=", "set", "("...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
SimStateHistory.constraints_since
Returns the constraints that have been accumulated since `other`. :param other: a prior PathHistory object :returns: a list of constraints
angr/state_plugins/history.py
def constraints_since(self, other): """ Returns the constraints that have been accumulated since `other`. :param other: a prior PathHistory object :returns: a list of constraints """ constraints = [ ] cur = self while cur is not other and cur is not None...
def constraints_since(self, other): """ Returns the constraints that have been accumulated since `other`. :param other: a prior PathHistory object :returns: a list of constraints """ constraints = [ ] cur = self while cur is not other and cur is not None...
[ "Returns", "the", "constraints", "that", "have", "been", "accumulated", "since", "other", "." ]
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/history.py#L421-L434
[ "def", "constraints_since", "(", "self", ",", "other", ")", ":", "constraints", "=", "[", "]", "cur", "=", "self", "while", "cur", "is", "not", "other", "and", "cur", "is", "not", "None", ":", "constraints", ".", "extend", "(", "cur", ".", "recent_cons...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
train
TreeIter.count
Count occurrences of value v in the entire history. Note that the subclass must implement the __reversed__ method, otherwise an exception will be thrown. :param object v: The value to look for :return: The number of occurrences :rtype: int
angr/state_plugins/history.py
def count(self, v): """ Count occurrences of value v in the entire history. Note that the subclass must implement the __reversed__ method, otherwise an exception will be thrown. :param object v: The value to look for :return: The number of occurrences :rtype: int ...
def count(self, v): """ Count occurrences of value v in the entire history. Note that the subclass must implement the __reversed__ method, otherwise an exception will be thrown. :param object v: The value to look for :return: The number of occurrences :rtype: int ...
[ "Count", "occurrences", "of", "value", "v", "in", "the", "entire", "history", ".", "Note", "that", "the", "subclass", "must", "implement", "the", "__reversed__", "method", "otherwise", "an", "exception", "will", "be", "thrown", ".", ":", "param", "object", "...
angr/angr
python
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/history.py#L478-L490
[ "def", "count", "(", "self", ",", "v", ")", ":", "ctr", "=", "0", "for", "item", "in", "reversed", "(", "self", ")", ":", "if", "item", "==", "v", ":", "ctr", "+=", "1", "return", "ctr" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40