repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
angr/angr
angr/engines/vex/engine.py
SimEngineVEX._first_stoppoint
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 ...
python
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", ")", ":", "if", "self", ".", "_stop_points", "is", "None", "and", "extra_stop_points", "is", "None", "and", "self", ".", "project", "is", "None", ":", "return", "No...
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.
[ "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", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/vex/engine.py#L712-L732
train
angr/angr
angr/knowledge_plugins/functions/function_manager.py
FunctionManager._genenare_callmap_sif
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...
python
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", ")", ":", "with", "open", "(", "filepath", ",", "\"wb\"", ")", "as", "f", ":", "for", "src", ",", "dst", "in", "self", ".", "callgraph", ".", "edges", "(", ")", ":", "f", ".", "write", "...
Generate a sif file from the call map. :param filepath: Path of the sif file :return: None
[ "Generate", "a", "sif", "file", "from", "the", "call", "map", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function_manager.py#L91-L100
train
angr/angr
angr/knowledge_plugins/functions/function_manager.py
FunctionManager.ceiling_func
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 ...
python
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", ")", ":", "try", ":", "next_addr", "=", "self", ".", "_function_map", ".", "ceiling_addr", "(", "addr", ")", "return", "self", ".", "_function_map", ".", "get", "(", "next_addr", ")", "except", "KeyError", ...
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
[ "Return", "the", "function", "who", "has", "the", "least", "address", "that", "is", "greater", "than", "or", "equal", "to", "addr", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function_manager.py#L287-L301
train
angr/angr
angr/knowledge_plugins/functions/function_manager.py
FunctionManager.floor_func
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...
python
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", ")", ":", "try", ":", "prev_addr", "=", "self", ".", "_function_map", ".", "floor_addr", "(", "addr", ")", "return", "self", ".", "_function_map", "[", "prev_addr", "]", "except", "KeyError", ":", "return", ...
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
[ "Return", "the", "function", "who", "has", "the", "greatest", "address", "that", "is", "less", "than", "or", "equal", "to", "addr", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function_manager.py#L303-L317
train
angr/angr
angr/knowledge_plugins/functions/function_manager.py
FunctionManager.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. ...
python
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", ")", ":", "if", "addr", "is", "not", "None", ":", "try", ":", "f", "=", "sel...
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. ...
[ "Get", "a", "function", "object", "from", "the", "function", "manager", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function_manager.py#L319-L354
train
angr/angr
angr/analyses/cdg.py
CDG.get_dependants
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 []
python
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", ")", ":", "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
[ "Return", "a", "list", "of", "nodes", "that", "are", "control", "dependent", "on", "the", "given", "node", "in", "the", "control", "dependence", "graph" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cdg.py#L62-L69
train
angr/angr
angr/analyses/cdg.py
CDG.get_guardians
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 []
python
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", ")", ":", "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
[ "Return", "a", "list", "of", "nodes", "on", "whom", "the", "specific", "node", "is", "control", "dependent", "in", "the", "control", "dependence", "graph" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cdg.py#L71-L78
train
angr/angr
angr/analyses/cdg.py
CDG._construct
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...
python
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", ")", ":", "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...
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.
[ "Construct", "a", "control", "dependence", "graph", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cdg.py#L84-L112
train
angr/angr
angr/analyses/cdg.py
CDG._pre_process_cfg
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...
python
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", ")", ":", "for", "_", ",", "dst", ",", "data", "in", "self", ".", "_acyclic_cfg", ".", "graph", ".", "edges", "(", "data", "=", "True", ")", ":", "if", "'jumpkind'", "in", "data", "and", "data", "[", "'jumpkind...
Pre-process the acyclic CFG. - Change all FakeRet edges to normal edges when necessary (e.g. the normal/expected return edge does not exist)
[ "Pre", "-", "process", "the", "acyclic", "CFG", ".", "-", "Change", "all", "FakeRet", "edges", "to", "normal", "edges", "when", "necessary", "(", "e", ".", "g", ".", "the", "normal", "/", "expected", "return", "edge", "does", "not", "exist", ")" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cdg.py#L116-L128
train
angr/angr
angr/analyses/cdg.py
CDG._post_process
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. ...
python
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", ")", ":", "# TODO: Verify its correctness", "loop_back_edges", "=", "self", ".", "_cfg", ".", "get_loop_back_edges", "(", ")", "for", "b1", ",", "b2", "in", "loop_back_edges", ":", "self", ".", "_graph", ".", "add_edge", "(...
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...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cdg.py#L130-L140
train
angr/angr
angr/analyses/cdg.py
CDG._pd_post_process
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...
python
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", ")", ":", "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...
Take care of those loop headers/tails where we manually broke their connection to the next BBL
[ "Take", "care", "of", "those", "loop", "headers", "/", "tails", "where", "we", "manually", "broke", "their", "connection", "to", "the", "next", "BBL" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cdg.py#L171-L188
train
angr/angr
angr/knowledge_plugins/variables/variable_manager.py
VariableManagerInternal.make_phi_node
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...
python
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", ")", ":", "existing_phis", "=", "set", "(", ")", "non_phis", "=", "set", "(", ")", "for", "var", "in", "variables", ":", "if", "self", ".", "is_phi_variable", "(", "var", ")...
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.
[ "Create", "a", "phi", "variable", "for", "variables", "at", "block", "block_addr", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/variables/variable_manager.py#L125-L168
train
angr/angr
angr/knowledge_plugins/variables/variable_manager.py
VariableManagerInternal.get_variables
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...
python
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", ")", ":", "variables", "=", "[", "]", "if", "collapse_same_ident", ":", "raise", "NotImplementedError", "(", ")", "for", "var", "in", "self", ".", "_va...
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
[ "Get", "a", "list", "of", "variables", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/variables/variable_manager.py#L253-L275
train
angr/angr
angr/knowledge_plugins/variables/variable_manager.py
VariableManagerInternal.get_phi_subvariables
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 """ ...
python
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", ")", ":", "if", "not", "self", ".", "is_phi_variable", "(", "var", ")", ":", "return", "set", "(", ")", "return", "self", ".", "_phi_variables", "[", "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", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/variables/variable_manager.py#L288-L299
train
angr/angr
angr/knowledge_plugins/variables/variable_manager.py
VariableManagerInternal.get_phi_variables
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: ...
python
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", ")", ":", "if", "block_addr", "not", "in", "self", ".", "_phi_variables_by_block", ":", "return", "dict", "(", ")", "variables", "=", "{", "}", "for", "phi", "in", "self", ".", "_phi_variables_by_bl...
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
[ "Get", "a", "dict", "of", "phi", "variables", "and", "their", "corresponding", "variables", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/variables/variable_manager.py#L301-L315
train
angr/angr
angr/knowledge_plugins/variables/variable_manager.py
VariableManagerInternal.input_variables
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') ...
python
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", ")", ":", "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. :return: A list of variables that are never written to.
[ "Get", "all", "variables", "that", "have", "never", "been", "written", "to", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/variables/variable_manager.py#L317-L337
train
angr/angr
angr/knowledge_plugins/variables/variable_manager.py
VariableManagerInternal.assign_variable_names
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...
python
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", ")", ":", "for", "var", "in", "self", ".", "_variables", ":", "if", "isinstance", "(", "var", ",", "SimStackVariable", ")", ":", "if", "var", ".", "name", "is", "not", "None", ":", "continue", "if", "var", "...
Assign default names to all variables. :return: None
[ "Assign", "default", "names", "to", "all", "variables", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/variables/variable_manager.py#L339-L358
train
angr/angr
angr/knowledge_plugins/variables/variable_manager.py
VariableManager.get_variable_accesses
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 ...
python
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", ")", ":", "if", "variable", ".", "region", "==", "'global'", ":", "return", "self", ".", "global_manager", ".", "get_variable_accesses", "(", "variable", ",", "same_n...
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...
[ "Get", "a", "list", "of", "all", "references", "to", "the", "given", "variable", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/variables/variable_manager.py#L405-L423
train
angr/angr
angr/callable.py
Callable.call_c
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] != "(...
python
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", ")", ":", "c_args", "=", "c_args", ".", "strip", "(", ")", "if", "c_args", "[", "0", "]", "!=", "\"(\"", ":", "c_args", "=", "\"(\"", "+", "c_args", "if", "c_args", "[", "-", "1", "]", "!=", "\")\"", ...
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
[ "Call", "this", "Callable", "with", "a", "string", "of", "C", "-", "style", "arguments", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/callable.py#L84-L125
train
angr/angr
angr/state_plugins/history.py
SimStateHistory.trim
def trim(self): """ Discard the ancestry of this state. """ new_hist = self.copy({}) new_hist.parent = None self.state.register_plugin('history', new_hist)
python
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", ")", ":", "new_hist", "=", "self", ".", "copy", "(", "{", "}", ")", "new_hist", ".", "parent", "=", "None", "self", ".", "state", ".", "register_plugin", "(", "'history'", ",", "new_hist", ")" ]
Discard the ancestry of this state.
[ "Discard", "the", "ancestry", "of", "this", "state", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/history.py#L147-L153
train
angr/angr
angr/state_plugins/history.py
SimStateHistory.filter_actions
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...
python
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", ")", ":", "if", "read_from", "is", "not", "None", ":", "if...
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...
[ "Filter", "self", ".", "actions", "based", "on", "some", "common", "parameters", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/history.py#L155-L253
train
angr/angr
angr/state_plugins/history.py
SimStateHistory.closest_common_ancestor
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_...
python
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", ")", ":", "our_history_iter", "=", "reversed", "(", "HistoryIter", "(", "self", ")", ")", "their_history_iter", "=", "reversed", "(", "HistoryIter", "(", "other", ")", ")", "sofar", "=", "set", "("...
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
[ "Find", "the", "common", "ancestor", "between", "this", "history", "node", "and", "other", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/history.py#L382-L419
train
angr/angr
angr/state_plugins/history.py
SimStateHistory.constraints_since
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...
python
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", ")", ":", "constraints", "=", "[", "]", "cur", "=", "self", "while", "cur", "is", "not", "other", "and", "cur", "is", "not", "None", ":", "constraints", ".", "extend", "(", "cur", ".", "recent_cons...
Returns the constraints that have been accumulated since `other`. :param other: a prior PathHistory object :returns: a list of constraints
[ "Returns", "the", "constraints", "that", "have", "been", "accumulated", "since", "other", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/history.py#L421-L434
train
angr/angr
angr/state_plugins/history.py
TreeIter.count
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 ...
python
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", ")", ":", "ctr", "=", "0", "for", "item", "in", "reversed", "(", "self", ")", ":", "if", "item", "==", "v", ":", "ctr", "+=", "1", "return", "ctr" ]
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", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/history.py#L478-L490
train
angr/angr
angr/analyses/decompiler/region_identifier.py
RegionIdentifier.slice_graph
def slice_graph(graph, node, frontier, include_frontier=False): """ Generate a slice of the graph from the head node to the given frontier. :param networkx.DiGraph graph: The graph to work on. :param node: The starting node in the graph. :param frontier: A list of frontier nodes...
python
def slice_graph(graph, node, frontier, include_frontier=False): """ Generate a slice of the graph from the head node to the given frontier. :param networkx.DiGraph graph: The graph to work on. :param node: The starting node in the graph. :param frontier: A list of frontier nodes...
[ "def", "slice_graph", "(", "graph", ",", "node", ",", "frontier", ",", "include_frontier", "=", "False", ")", ":", "subgraph", "=", "networkx", ".", "DiGraph", "(", ")", "for", "frontier_node", "in", "frontier", ":", "for", "simple_path", "in", "networkx", ...
Generate a slice of the graph from the head node to the given frontier. :param networkx.DiGraph graph: The graph to work on. :param node: The starting node in the graph. :param frontier: A list of frontier nodes. :param bool include_frontier: Whether the frontier nodes are included in t...
[ "Generate", "a", "slice", "of", "the", "graph", "from", "the", "head", "node", "to", "the", "given", "frontier", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/decompiler/region_identifier.py#L159-L183
train
angr/angr
angr/exploration_techniques/common.py
condition_to_lambda
def condition_to_lambda(condition, default=False): """ Translates an integer, set, list or function into a lambda that checks if state's current basic block matches some condition. :param condition: An integer, set, list or lambda to convert to a lambda. :param default: The default return val...
python
def condition_to_lambda(condition, default=False): """ Translates an integer, set, list or function into a lambda that checks if state's current basic block matches some condition. :param condition: An integer, set, list or lambda to convert to a lambda. :param default: The default return val...
[ "def", "condition_to_lambda", "(", "condition", ",", "default", "=", "False", ")", ":", "if", "condition", "is", "None", ":", "condition_function", "=", "lambda", "state", ":", "default", "static_addrs", "=", "set", "(", ")", "elif", "isinstance", "(", "cond...
Translates an integer, set, list or function into a lambda that checks if state's current basic block matches some condition. :param condition: An integer, set, list or lambda to convert to a lambda. :param default: The default return value of the lambda (in case condition is None). Default: false. ...
[ "Translates", "an", "integer", "set", "list", "or", "function", "into", "a", "lambda", "that", "checks", "if", "state", "s", "current", "basic", "block", "matches", "some", "condition", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/common.py#L5-L49
train
angr/angr
angr/vaults.py
Vault._get_persistent_id
def _get_persistent_id(self, o): """ Determines a persistent ID for an object. Does NOT do stores. """ if type(o) in self.hash_dedup: oid = o.__class__.__name__ + "-" + str(hash(o)) self._object_cache[oid] = o return oid if any(isinsta...
python
def _get_persistent_id(self, o): """ Determines a persistent ID for an object. Does NOT do stores. """ if type(o) in self.hash_dedup: oid = o.__class__.__name__ + "-" + str(hash(o)) self._object_cache[oid] = o return oid if any(isinsta...
[ "def", "_get_persistent_id", "(", "self", ",", "o", ")", ":", "if", "type", "(", "o", ")", "in", "self", ".", "hash_dedup", ":", "oid", "=", "o", ".", "__class__", ".", "__name__", "+", "\"-\"", "+", "str", "(", "hash", "(", "o", ")", ")", "self"...
Determines a persistent ID for an object. Does NOT do stores.
[ "Determines", "a", "persistent", "ID", "for", "an", "object", ".", "Does", "NOT", "do", "stores", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/vaults.py#L90-L118
train
angr/angr
angr/vaults.py
Vault.is_stored
def is_stored(self, i): """ Checks if the provided id is already in the vault. """ if i in self.stored: return True try: with self._read_context(i): return True except (AngrVaultError, EOFError): return False
python
def is_stored(self, i): """ Checks if the provided id is already in the vault. """ if i in self.stored: return True try: with self._read_context(i): return True except (AngrVaultError, EOFError): return False
[ "def", "is_stored", "(", "self", ",", "i", ")", ":", "if", "i", "in", "self", ".", "stored", ":", "return", "True", "try", ":", "with", "self", ".", "_read_context", "(", "i", ")", ":", "return", "True", "except", "(", "AngrVaultError", ",", "EOFErro...
Checks if the provided id is already in the vault.
[ "Checks", "if", "the", "provided", "id", "is", "already", "in", "the", "vault", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/vaults.py#L124-L135
train
angr/angr
angr/vaults.py
Vault.load
def load(self, id): #pylint:disable=redefined-builtin """ Retrieves one object from the pickler with the provided id. :param id: an ID to use """ l.debug("LOAD: %s", id) try: l.debug("... trying cached") return self._object_cache[id] excep...
python
def load(self, id): #pylint:disable=redefined-builtin """ Retrieves one object from the pickler with the provided id. :param id: an ID to use """ l.debug("LOAD: %s", id) try: l.debug("... trying cached") return self._object_cache[id] excep...
[ "def", "load", "(", "self", ",", "id", ")", ":", "#pylint:disable=redefined-builtin", "l", ".", "debug", "(", "\"LOAD: %s\"", ",", "id", ")", "try", ":", "l", ".", "debug", "(", "\"... trying cached\"", ")", "return", "self", ".", "_object_cache", "[", "id...
Retrieves one object from the pickler with the provided id. :param id: an ID to use
[ "Retrieves", "one", "object", "from", "the", "pickler", "with", "the", "provided", "id", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/vaults.py#L137-L150
train
angr/angr
angr/vaults.py
Vault.store
def store(self, o, id=None): #pylint:disable=redefined-builtin """ Stores an object and returns its ID. :param o: the object :param id: an ID to use """ actual_id = id or self._get_persistent_id(o) or "TMP-"+str(uuid.uuid4()) l.debug("STORE: %s %s", o, actual_id...
python
def store(self, o, id=None): #pylint:disable=redefined-builtin """ Stores an object and returns its ID. :param o: the object :param id: an ID to use """ actual_id = id or self._get_persistent_id(o) or "TMP-"+str(uuid.uuid4()) l.debug("STORE: %s %s", o, actual_id...
[ "def", "store", "(", "self", ",", "o", ",", "id", "=", "None", ")", ":", "#pylint:disable=redefined-builtin", "actual_id", "=", "id", "or", "self", ".", "_get_persistent_id", "(", "o", ")", "or", "\"TMP-\"", "+", "str", "(", "uuid", ".", "uuid4", "(", ...
Stores an object and returns its ID. :param o: the object :param id: an ID to use
[ "Stores", "an", "object", "and", "returns", "its", "ID", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/vaults.py#L152-L176
train
angr/angr
angr/vaults.py
Vault.dumps
def dumps(self, o): """ Returns a serialized string representing the object, post-deduplication. :param o: the object """ f = io.BytesIO() VaultPickler(self, f).dump(o) f.seek(0) return f.read()
python
def dumps(self, o): """ Returns a serialized string representing the object, post-deduplication. :param o: the object """ f = io.BytesIO() VaultPickler(self, f).dump(o) f.seek(0) return f.read()
[ "def", "dumps", "(", "self", ",", "o", ")", ":", "f", "=", "io", ".", "BytesIO", "(", ")", "VaultPickler", "(", "self", ",", "f", ")", ".", "dump", "(", "o", ")", "f", ".", "seek", "(", "0", ")", "return", "f", ".", "read", "(", ")" ]
Returns a serialized string representing the object, post-deduplication. :param o: the object
[ "Returns", "a", "serialized", "string", "representing", "the", "object", "post", "-", "deduplication", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/vaults.py#L178-L187
train
angr/angr
angr/vaults.py
Vault.loads
def loads(self, s): """ Deserializes a string representation of the object. :param s: the string """ f = io.BytesIO(s) return VaultUnpickler(self, f).load()
python
def loads(self, s): """ Deserializes a string representation of the object. :param s: the string """ f = io.BytesIO(s) return VaultUnpickler(self, f).load()
[ "def", "loads", "(", "self", ",", "s", ")", ":", "f", "=", "io", ".", "BytesIO", "(", "s", ")", "return", "VaultUnpickler", "(", "self", ",", "f", ")", ".", "load", "(", ")" ]
Deserializes a string representation of the object. :param s: the string
[ "Deserializes", "a", "string", "representation", "of", "the", "object", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/vaults.py#L189-L196
train
angr/angr
angr/analyses/identifier/identify.py
Identifier.get_reg_name
def get_reg_name(arch, reg_offset): """ :param arch: the architecture :param reg_offset: Tries to find the name of a register given the offset in the registers. :return: The register name """ # todo does this make sense if reg_offset is None: return No...
python
def get_reg_name(arch, reg_offset): """ :param arch: the architecture :param reg_offset: Tries to find the name of a register given the offset in the registers. :return: The register name """ # todo does this make sense if reg_offset is None: return No...
[ "def", "get_reg_name", "(", "arch", ",", "reg_offset", ")", ":", "# todo does this make sense", "if", "reg_offset", "is", "None", ":", "return", "None", "original_offset", "=", "reg_offset", "while", "reg_offset", ">=", "0", "and", "reg_offset", ">=", "original_of...
:param arch: the architecture :param reg_offset: Tries to find the name of a register given the offset in the registers. :return: The register name
[ ":", "param", "arch", ":", "the", "architecture", ":", "param", "reg_offset", ":", "Tries", "to", "find", "the", "name", "of", "a", "register", "given", "the", "offset", "in", "the", "registers", ".", ":", "return", ":", "The", "register", "name" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/identifier/identify.py#L412-L428
train
angr/angr
angr/analyses/identifier/identify.py
Identifier._make_regs_symbolic
def _make_regs_symbolic(input_state, reg_list, project): """ converts an input state into a state with symbolic registers :return: the symbolic state """ state = input_state.copy() # overwrite all registers for reg in reg_list: state.registers.store(re...
python
def _make_regs_symbolic(input_state, reg_list, project): """ converts an input state into a state with symbolic registers :return: the symbolic state """ state = input_state.copy() # overwrite all registers for reg in reg_list: state.registers.store(re...
[ "def", "_make_regs_symbolic", "(", "input_state", ",", "reg_list", ",", "project", ")", ":", "state", "=", "input_state", ".", "copy", "(", ")", "# overwrite all registers", "for", "reg", "in", "reg_list", ":", "state", ".", "registers", ".", "store", "(", "...
converts an input state into a state with symbolic registers :return: the symbolic state
[ "converts", "an", "input", "state", "into", "a", "state", "with", "symbolic", "registers", ":", "return", ":", "the", "symbolic", "state" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/identifier/identify.py#L431-L444
train
angr/angr
angr/analyses/identifier/identify.py
Identifier.make_initial_state
def make_initial_state(project, stack_length): """ :return: an initial state with a symbolic stack and good options for rop """ initial_state = project.factory.blank_state( add_options={options.AVOID_MULTIVALUED_READS, options.AVOID_MULTIVALUED_WRITES, ...
python
def make_initial_state(project, stack_length): """ :return: an initial state with a symbolic stack and good options for rop """ initial_state = project.factory.blank_state( add_options={options.AVOID_MULTIVALUED_READS, options.AVOID_MULTIVALUED_WRITES, ...
[ "def", "make_initial_state", "(", "project", ",", "stack_length", ")", ":", "initial_state", "=", "project", ".", "factory", ".", "blank_state", "(", "add_options", "=", "{", "options", ".", "AVOID_MULTIVALUED_READS", ",", "options", ".", "AVOID_MULTIVALUED_WRITES",...
:return: an initial state with a symbolic stack and good options for rop
[ ":", "return", ":", "an", "initial", "state", "with", "a", "symbolic", "stack", "and", "good", "options", "for", "rop" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/identifier/identify.py#L795-L812
train
angr/angr
angr/analyses/identifier/identify.py
Identifier.make_symbolic_state
def make_symbolic_state(project, reg_list, stack_length=80): """ converts an input state into a state with symbolic registers :return: the symbolic state """ input_state = Identifier.make_initial_state(project, stack_length) symbolic_state = input_state.copy() # o...
python
def make_symbolic_state(project, reg_list, stack_length=80): """ converts an input state into a state with symbolic registers :return: the symbolic state """ input_state = Identifier.make_initial_state(project, stack_length) symbolic_state = input_state.copy() # o...
[ "def", "make_symbolic_state", "(", "project", ",", "reg_list", ",", "stack_length", "=", "80", ")", ":", "input_state", "=", "Identifier", ".", "make_initial_state", "(", "project", ",", "stack_length", ")", "symbolic_state", "=", "input_state", ".", "copy", "("...
converts an input state into a state with symbolic registers :return: the symbolic state
[ "converts", "an", "input", "state", "into", "a", "state", "with", "symbolic", "registers", ":", "return", ":", "the", "symbolic", "state" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/identifier/identify.py#L815-L829
train
angr/angr
angr/analyses/congruency_check.py
CongruencyCheck.set_state_options
def set_state_options(self, left_add_options=None, left_remove_options=None, right_add_options=None, right_remove_options=None): """ Checks that the specified state options result in the same states over the next `depth` states. """ s_right = self.project.factory.full_init_state( ...
python
def set_state_options(self, left_add_options=None, left_remove_options=None, right_add_options=None, right_remove_options=None): """ Checks that the specified state options result in the same states over the next `depth` states. """ s_right = self.project.factory.full_init_state( ...
[ "def", "set_state_options", "(", "self", ",", "left_add_options", "=", "None", ",", "left_remove_options", "=", "None", ",", "right_add_options", "=", "None", ",", "right_remove_options", "=", "None", ")", ":", "s_right", "=", "self", ".", "project", ".", "fac...
Checks that the specified state options result in the same states over the next `depth` states.
[ "Checks", "that", "the", "specified", "state", "options", "result", "in", "the", "same", "states", "over", "the", "next", "depth", "states", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/congruency_check.py#L26-L39
train
angr/angr
angr/analyses/congruency_check.py
CongruencyCheck.set_states
def set_states(self, left_state, right_state): """ Checks that the specified paths stay the same over the next `depth` states. """ simgr = self.project.factory.simulation_manager(right_state) simgr.stash(to_stash='right') simgr.active.append(left_state) simgr.sta...
python
def set_states(self, left_state, right_state): """ Checks that the specified paths stay the same over the next `depth` states. """ simgr = self.project.factory.simulation_manager(right_state) simgr.stash(to_stash='right') simgr.active.append(left_state) simgr.sta...
[ "def", "set_states", "(", "self", ",", "left_state", ",", "right_state", ")", ":", "simgr", "=", "self", ".", "project", ".", "factory", ".", "simulation_manager", "(", "right_state", ")", "simgr", ".", "stash", "(", "to_stash", "=", "'right'", ")", "simgr...
Checks that the specified paths stay the same over the next `depth` states.
[ "Checks", "that", "the", "specified", "paths", "stay", "the", "same", "over", "the", "next", "depth", "states", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/congruency_check.py#L41-L53
train
angr/angr
angr/analyses/congruency_check.py
CongruencyCheck._validate_incongruency
def _validate_incongruency(self): """ Checks that a detected incongruency is not caused by translation backends having a different idea of what constitutes a basic block. """ ot = self._throw try: self._throw = False l.debug("Validating incongrue...
python
def _validate_incongruency(self): """ Checks that a detected incongruency is not caused by translation backends having a different idea of what constitutes a basic block. """ ot = self._throw try: self._throw = False l.debug("Validating incongrue...
[ "def", "_validate_incongruency", "(", "self", ")", ":", "ot", "=", "self", ".", "_throw", "try", ":", "self", ".", "_throw", "=", "False", "l", ".", "debug", "(", "\"Validating incongruency.\"", ")", "if", "(", "\"UNICORN\"", "in", "self", ".", "simgr", ...
Checks that a detected incongruency is not caused by translation backends having a different idea of what constitutes a basic block.
[ "Checks", "that", "a", "detected", "incongruency", "is", "not", "caused", "by", "translation", "backends", "having", "a", "different", "idea", "of", "what", "constitutes", "a", "basic", "block", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/congruency_check.py#L102-L179
train
angr/angr
angr/analyses/congruency_check.py
CongruencyCheck.run
def run(self, depth=None): """ Checks that the paths in the specified path group stay the same over the next `depth` bytes. The path group should have a "left" and a "right" stash, each with a single path. """ #pg_history = [ ] if len(self.simgr.right) !=...
python
def run(self, depth=None): """ Checks that the paths in the specified path group stay the same over the next `depth` bytes. The path group should have a "left" and a "right" stash, each with a single path. """ #pg_history = [ ] if len(self.simgr.right) !=...
[ "def", "run", "(", "self", ",", "depth", "=", "None", ")", ":", "#pg_history = [ ]", "if", "len", "(", "self", ".", "simgr", ".", "right", ")", "!=", "1", "or", "len", "(", "self", ".", "simgr", ".", "left", ")", "!=", "1", ":", "self", ".", "_...
Checks that the paths in the specified path group stay the same over the next `depth` bytes. The path group should have a "left" and a "right" stash, each with a single path.
[ "Checks", "that", "the", "paths", "in", "the", "specified", "path", "group", "stay", "the", "same", "over", "the", "next", "depth", "bytes", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/congruency_check.py#L186-L259
train
angr/angr
angr/analyses/congruency_check.py
CongruencyCheck.compare_states
def compare_states(self, sl, sr): """ Compares two states for similarity. """ joint_solver = claripy.Solver() # make sure the canonicalized constraints are the same n_map, n_counter, n_canon_constraint = claripy.And(*sr.solver.constraints).canonicalize() #pylint:disable=...
python
def compare_states(self, sl, sr): """ Compares two states for similarity. """ joint_solver = claripy.Solver() # make sure the canonicalized constraints are the same n_map, n_counter, n_canon_constraint = claripy.And(*sr.solver.constraints).canonicalize() #pylint:disable=...
[ "def", "compare_states", "(", "self", ",", "sl", ",", "sr", ")", ":", "joint_solver", "=", "claripy", ".", "Solver", "(", ")", "# make sure the canonicalized constraints are the same", "n_map", ",", "n_counter", ",", "n_canon_constraint", "=", "claripy", ".", "And...
Compares two states for similarity.
[ "Compares", "two", "states", "for", "similarity", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/congruency_check.py#L281-L342
train
angr/angr
angr/state_plugins/inspect.py
BP.check
def check(self, state, when): """ Checks state `state` to see if the breakpoint should fire. :param state: The state. :param when: Whether the check is happening before or after the event. :return: A boolean representing whether the checkpoint should fire. ""...
python
def check(self, state, when): """ Checks state `state` to see if the breakpoint should fire. :param state: The state. :param when: Whether the check is happening before or after the event. :return: A boolean representing whether the checkpoint should fire. ""...
[ "def", "check", "(", "self", ",", "state", ",", "when", ")", ":", "ok", "=", "self", ".", "enabled", "and", "(", "when", "==", "self", ".", "when", "or", "self", ".", "when", "==", "BP_BOTH", ")", "if", "not", "ok", ":", "return", "ok", "l", "....
Checks state `state` to see if the breakpoint should fire. :param state: The state. :param when: Whether the check is happening before or after the event. :return: A boolean representing whether the checkpoint should fire.
[ "Checks", "state", "state", "to", "see", "if", "the", "breakpoint", "should", "fire", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/inspect.py#L138-L184
train
angr/angr
angr/state_plugins/inspect.py
BP.fire
def fire(self, state): """ Trigger the breakpoint. :param state: The state. """ if self.action is None or self.action == BP_IPDB: import ipdb; ipdb.set_trace() #pylint:disable=F0401 elif self.action == BP_IPYTHON: import IPython shel...
python
def fire(self, state): """ Trigger the breakpoint. :param state: The state. """ if self.action is None or self.action == BP_IPDB: import ipdb; ipdb.set_trace() #pylint:disable=F0401 elif self.action == BP_IPYTHON: import IPython shel...
[ "def", "fire", "(", "self", ",", "state", ")", ":", "if", "self", ".", "action", "is", "None", "or", "self", ".", "action", "==", "BP_IPDB", ":", "import", "ipdb", "ipdb", ".", "set_trace", "(", ")", "#pylint:disable=F0401", "elif", "self", ".", "actio...
Trigger the breakpoint. :param state: The state.
[ "Trigger", "the", "breakpoint", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/inspect.py#L186-L201
train
angr/angr
angr/state_plugins/inspect.py
SimInspector.action
def action(self, event_type, when, **kwargs): """ Called from within SimuVEX when events happens. This function checks all breakpoints registered for that event and fires the ones whose conditions match. """ l.debug("Event %s (%s) firing...", event_type, when) for k,v in ...
python
def action(self, event_type, when, **kwargs): """ Called from within SimuVEX when events happens. This function checks all breakpoints registered for that event and fires the ones whose conditions match. """ l.debug("Event %s (%s) firing...", event_type, when) for k,v in ...
[ "def", "action", "(", "self", ",", "event_type", ",", "when", ",", "*", "*", "kwargs", ")", ":", "l", ".", "debug", "(", "\"Event %s (%s) firing...\"", ",", "event_type", ",", "when", ")", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")",...
Called from within SimuVEX when events happens. This function checks all breakpoints registered for that event and fires the ones whose conditions match.
[ "Called", "from", "within", "SimuVEX", "when", "events", "happens", ".", "This", "function", "checks", "all", "breakpoints", "registered", "for", "that", "event", "and", "fires", "the", "ones", "whose", "conditions", "match", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/inspect.py#L232-L249
train
angr/angr
angr/state_plugins/inspect.py
SimInspector.make_breakpoint
def make_breakpoint(self, event_type, *args, **kwargs): """ Creates and adds a breakpoint which would trigger on `event_type`. Additional arguments are passed to the :class:`BP` constructor. :return: The created breakpoint, so that it can be removed later. """ bp = BP...
python
def make_breakpoint(self, event_type, *args, **kwargs): """ Creates and adds a breakpoint which would trigger on `event_type`. Additional arguments are passed to the :class:`BP` constructor. :return: The created breakpoint, so that it can be removed later. """ bp = BP...
[ "def", "make_breakpoint", "(", "self", ",", "event_type", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "bp", "=", "BP", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "add_breakpoint", "(", "event_type", ",", "bp", ")", "retur...
Creates and adds a breakpoint which would trigger on `event_type`. Additional arguments are passed to the :class:`BP` constructor. :return: The created breakpoint, so that it can be removed later.
[ "Creates", "and", "adds", "a", "breakpoint", "which", "would", "trigger", "on", "event_type", ".", "Additional", "arguments", "are", "passed", "to", "the", ":", "class", ":", "BP", "constructor", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/inspect.py#L251-L260
train
angr/angr
angr/state_plugins/inspect.py
SimInspector.add_breakpoint
def add_breakpoint(self, event_type, bp): """ Adds a breakpoint which would trigger on `event_type`. :param event_type: The event type to trigger on :param bp: The breakpoint :return: The created breakpoint. """ if event_type not in event_typ...
python
def add_breakpoint(self, event_type, bp): """ Adds a breakpoint which would trigger on `event_type`. :param event_type: The event type to trigger on :param bp: The breakpoint :return: The created breakpoint. """ if event_type not in event_typ...
[ "def", "add_breakpoint", "(", "self", ",", "event_type", ",", "bp", ")", ":", "if", "event_type", "not", "in", "event_types", ":", "raise", "ValueError", "(", "\"Invalid event type %s passed in. Should be one of: %s\"", "%", "(", "event_type", ",", "\", \"", ".", ...
Adds a breakpoint which would trigger on `event_type`. :param event_type: The event type to trigger on :param bp: The breakpoint :return: The created breakpoint.
[ "Adds", "a", "breakpoint", "which", "would", "trigger", "on", "event_type", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/inspect.py#L264-L276
train
angr/angr
angr/state_plugins/inspect.py
SimInspector.remove_breakpoint
def remove_breakpoint(self, event_type, bp=None, filter_func=None): """ Removes a breakpoint. :param bp: The breakpoint to remove. :param filter_func: A filter function to specify whether each breakpoint should be removed or not. """ if bp is None and filter_func is No...
python
def remove_breakpoint(self, event_type, bp=None, filter_func=None): """ Removes a breakpoint. :param bp: The breakpoint to remove. :param filter_func: A filter function to specify whether each breakpoint should be removed or not. """ if bp is None and filter_func is No...
[ "def", "remove_breakpoint", "(", "self", ",", "event_type", ",", "bp", "=", "None", ",", "filter_func", "=", "None", ")", ":", "if", "bp", "is", "None", "and", "filter_func", "is", "None", ":", "raise", "ValueError", "(", "'remove_breakpoint(): You must specif...
Removes a breakpoint. :param bp: The breakpoint to remove. :param filter_func: A filter function to specify whether each breakpoint should be removed or not.
[ "Removes", "a", "breakpoint", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/inspect.py#L278-L296
train
angr/angr
angr/state_plugins/inspect.py
SimInspector.downsize
def downsize(self): """ Remove previously stored attributes from this plugin instance to save memory. This method is supposed to be called by breakpoint implementors. A typical workflow looks like the following : >>> # Add `attr0` and `attr1` to `self.state.inspect` >>> self.sta...
python
def downsize(self): """ Remove previously stored attributes from this plugin instance to save memory. This method is supposed to be called by breakpoint implementors. A typical workflow looks like the following : >>> # Add `attr0` and `attr1` to `self.state.inspect` >>> self.sta...
[ "def", "downsize", "(", "self", ")", ":", "for", "k", "in", "inspect_attributes", ":", "if", "hasattr", "(", "self", ",", "k", ")", ":", "setattr", "(", "self", ",", "k", ",", "None", ")" ]
Remove previously stored attributes from this plugin instance to save memory. This method is supposed to be called by breakpoint implementors. A typical workflow looks like the following : >>> # Add `attr0` and `attr1` to `self.state.inspect` >>> self.state.inspect(xxxxxx, attr0=yyyy, attr1=zzz...
[ "Remove", "previously", "stored", "attributes", "from", "this", "plugin", "instance", "to", "save", "memory", ".", "This", "method", "is", "supposed", "to", "be", "called", "by", "breakpoint", "implementors", ".", "A", "typical", "workflow", "looks", "like", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/inspect.py#L308-L323
train
angr/angr
angr/simos/userland.py
SimUserland.syscall
def syscall(self, state, allow_unsupported=True): """ Given a state, return the procedure corresponding to the current syscall. This procedure will have .syscall_number, .display_name, and .addr set. :param state: The state to get the syscall number from :param all...
python
def syscall(self, state, allow_unsupported=True): """ Given a state, return the procedure corresponding to the current syscall. This procedure will have .syscall_number, .display_name, and .addr set. :param state: The state to get the syscall number from :param all...
[ "def", "syscall", "(", "self", ",", "state", ",", "allow_unsupported", "=", "True", ")", ":", "abi", "=", "self", ".", "syscall_abi", "(", "state", ")", "if", "state", ".", "os_name", "in", "SYSCALL_CC", "[", "state", ".", "arch", ".", "name", "]", "...
Given a state, return the procedure corresponding to the current syscall. This procedure will have .syscall_number, .display_name, and .addr set. :param state: The state to get the syscall number from :param allow_unsupported: Whether to return a "dummy" sycall instead of raisin...
[ "Given", "a", "state", "return", "the", "procedure", "corresponding", "to", "the", "current", "syscall", ".", "This", "procedure", "will", "have", ".", "syscall_number", ".", "display_name", "and", ".", "addr", "set", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/userland.py#L47-L78
train
angr/angr
angr/simos/userland.py
SimUserland.is_syscall_addr
def is_syscall_addr(self, addr): """ Return whether or not the given address corresponds to a syscall implementation. """ if self.kernel_base is None or addr < self.kernel_base: return False addr -= self.kernel_base if addr % self.syscall_addr_alignment != 0...
python
def is_syscall_addr(self, addr): """ Return whether or not the given address corresponds to a syscall implementation. """ if self.kernel_base is None or addr < self.kernel_base: return False addr -= self.kernel_base if addr % self.syscall_addr_alignment != 0...
[ "def", "is_syscall_addr", "(", "self", ",", "addr", ")", ":", "if", "self", ".", "kernel_base", "is", "None", "or", "addr", "<", "self", ".", "kernel_base", ":", "return", "False", "addr", "-=", "self", ".", "kernel_base", "if", "addr", "%", "self", "....
Return whether or not the given address corresponds to a syscall implementation.
[ "Return", "whether", "or", "not", "the", "given", "address", "corresponds", "to", "a", "syscall", "implementation", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/userland.py#L86-L99
train
angr/angr
angr/simos/userland.py
SimUserland.syscall_from_addr
def syscall_from_addr(self, addr, allow_unsupported=True): """ Get a syscall SimProcedure from an address. :param addr: The address to convert to a syscall SimProcedure :param allow_unsupported: Whether to return a dummy procedure for an unsupported syscall instead of raising an ...
python
def syscall_from_addr(self, addr, allow_unsupported=True): """ Get a syscall SimProcedure from an address. :param addr: The address to convert to a syscall SimProcedure :param allow_unsupported: Whether to return a dummy procedure for an unsupported syscall instead of raising an ...
[ "def", "syscall_from_addr", "(", "self", ",", "addr", ",", "allow_unsupported", "=", "True", ")", ":", "if", "not", "self", ".", "is_syscall_addr", "(", "addr", ")", ":", "return", "None", "number", "=", "(", "addr", "-", "self", ".", "kernel_base", ")",...
Get a syscall SimProcedure from an address. :param addr: The address to convert to a syscall SimProcedure :param allow_unsupported: Whether to return a dummy procedure for an unsupported syscall instead of raising an exception. :return: The SimProcedure for the...
[ "Get", "a", "syscall", "SimProcedure", "from", "an", "address", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/userland.py#L101-L122
train
angr/angr
angr/simos/userland.py
SimUserland.syscall_from_number
def syscall_from_number(self, number, allow_unsupported=True, abi=None): """ Get a syscall SimProcedure from its number. :param number: The syscall number :param allow_unsupported: Whether to return a "stub" syscall for unsupported numbers instead of throwing an error ...
python
def syscall_from_number(self, number, allow_unsupported=True, abi=None): """ Get a syscall SimProcedure from its number. :param number: The syscall number :param allow_unsupported: Whether to return a "stub" syscall for unsupported numbers instead of throwing an error ...
[ "def", "syscall_from_number", "(", "self", ",", "number", ",", "allow_unsupported", "=", "True", ",", "abi", "=", "None", ")", ":", "abilist", "=", "self", ".", "syscall_abis", "if", "abi", "is", "None", "else", "[", "abi", "]", "if", "self", ".", "sys...
Get a syscall SimProcedure from its number. :param number: The syscall number :param allow_unsupported: Whether to return a "stub" syscall for unsupported numbers instead of throwing an error :param abi: The name of the abi to use. If None, will assume that the ab...
[ "Get", "a", "syscall", "SimProcedure", "from", "its", "number", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/userland.py#L124-L152
train
angr/angr
angr/procedures/win32/VirtualAlloc.py
convert_prot
def convert_prot(prot): """ Convert from a windows memory protection constant to an angr bitmask """ # https://msdn.microsoft.com/en-us/library/windows/desktop/aa366786(v=vs.85).aspx if prot & 0x10: return 4 if prot & 0x20: return 5 if prot & 0x40: return 7 if pro...
python
def convert_prot(prot): """ Convert from a windows memory protection constant to an angr bitmask """ # https://msdn.microsoft.com/en-us/library/windows/desktop/aa366786(v=vs.85).aspx if prot & 0x10: return 4 if prot & 0x20: return 5 if prot & 0x40: return 7 if pro...
[ "def", "convert_prot", "(", "prot", ")", ":", "# https://msdn.microsoft.com/en-us/library/windows/desktop/aa366786(v=vs.85).aspx", "if", "prot", "&", "0x10", ":", "return", "4", "if", "prot", "&", "0x20", ":", "return", "5", "if", "prot", "&", "0x40", ":", "return...
Convert from a windows memory protection constant to an angr bitmask
[ "Convert", "from", "a", "windows", "memory", "protection", "constant", "to", "an", "angr", "bitmask" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/win32/VirtualAlloc.py#L6-L27
train
angr/angr
angr/analyses/ddg.py
LiveDefinitions.copy
def copy(self): """ Make a hard copy of `self`. :return: A new LiveDefinition instance. :rtype: angr.analyses.ddg.LiveDefinitions """ ld = LiveDefinitions() ld._memory_map = self._memory_map.copy() ld._register_map = self._register_map.copy() ld....
python
def copy(self): """ Make a hard copy of `self`. :return: A new LiveDefinition instance. :rtype: angr.analyses.ddg.LiveDefinitions """ ld = LiveDefinitions() ld._memory_map = self._memory_map.copy() ld._register_map = self._register_map.copy() ld....
[ "def", "copy", "(", "self", ")", ":", "ld", "=", "LiveDefinitions", "(", ")", "ld", ".", "_memory_map", "=", "self", ".", "_memory_map", ".", "copy", "(", ")", "ld", ".", "_register_map", "=", "self", ".", "_register_map", ".", "copy", "(", ")", "ld"...
Make a hard copy of `self`. :return: A new LiveDefinition instance. :rtype: angr.analyses.ddg.LiveDefinitions
[ "Make", "a", "hard", "copy", "of", "self", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L137-L150
train
angr/angr
angr/analyses/ddg.py
LiveDefinitions.add_def
def add_def(self, variable, location, size_threshold=32): """ Add a new definition of variable. :param SimVariable variable: The variable being defined. :param CodeLocation location: Location of the varaible being defined. :param int size_threshold: The maximum bytes to consider...
python
def add_def(self, variable, location, size_threshold=32): """ Add a new definition of variable. :param SimVariable variable: The variable being defined. :param CodeLocation location: Location of the varaible being defined. :param int size_threshold: The maximum bytes to consider...
[ "def", "add_def", "(", "self", ",", "variable", ",", "location", ",", "size_threshold", "=", "32", ")", ":", "new_defs_added", "=", "False", "if", "isinstance", "(", "variable", ",", "SimRegisterVariable", ")", ":", "if", "variable", ".", "reg", "is", "Non...
Add a new definition of variable. :param SimVariable variable: The variable being defined. :param CodeLocation location: Location of the varaible being defined. :param int size_threshold: The maximum bytes to consider for the variable. :return: True if the definition was new, False othe...
[ "Add", "a", "new", "definition", "of", "variable", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L152-L194
train
angr/angr
angr/analyses/ddg.py
LiveDefinitions.add_defs
def add_defs(self, variable, locations, size_threshold=32): """ Add a collection of new definitions of a variable. :param SimVariable variable: The variable being defined. :param iterable locations: A collection of locations where the variable was defined. :param int size_thresh...
python
def add_defs(self, variable, locations, size_threshold=32): """ Add a collection of new definitions of a variable. :param SimVariable variable: The variable being defined. :param iterable locations: A collection of locations where the variable was defined. :param int size_thresh...
[ "def", "add_defs", "(", "self", ",", "variable", ",", "locations", ",", "size_threshold", "=", "32", ")", ":", "new_defs_added", "=", "False", "for", "loc", "in", "locations", ":", "new_defs_added", "|=", "self", ".", "add_def", "(", "variable", ",", "loc"...
Add a collection of new definitions of a variable. :param SimVariable variable: The variable being defined. :param iterable locations: A collection of locations where the variable was defined. :param int size_threshold: The maximum bytes to consider for the variable. :return: True if an...
[ "Add", "a", "collection", "of", "new", "definitions", "of", "a", "variable", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L196-L212
train
angr/angr
angr/analyses/ddg.py
LiveDefinitions.kill_def
def kill_def(self, variable, location, size_threshold=32): """ Add a new definition for variable and kill all previous definitions. :param SimVariable variable: The variable to kill. :param CodeLocation location: The location where this variable is defined. :param int size_thres...
python
def kill_def(self, variable, location, size_threshold=32): """ Add a new definition for variable and kill all previous definitions. :param SimVariable variable: The variable to kill. :param CodeLocation location: The location where this variable is defined. :param int size_thres...
[ "def", "kill_def", "(", "self", ",", "variable", ",", "location", ",", "size_threshold", "=", "32", ")", ":", "if", "isinstance", "(", "variable", ",", "SimRegisterVariable", ")", ":", "if", "variable", ".", "reg", "is", "None", ":", "l", ".", "warning",...
Add a new definition for variable and kill all previous definitions. :param SimVariable variable: The variable to kill. :param CodeLocation location: The location where this variable is defined. :param int size_threshold: The maximum bytes to consider for the variable. :return: None
[ "Add", "a", "new", "definition", "for", "variable", "and", "kill", "all", "previous", "definitions", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L214-L247
train
angr/angr
angr/analyses/ddg.py
LiveDefinitions.lookup_defs
def lookup_defs(self, variable, size_threshold=32): """ Find all definitions of the varaible :param SimVariable variable: The variable to lookup for. :param int size_threshold: The maximum bytes to consider for the variable. For example, if the variable is 100 ...
python
def lookup_defs(self, variable, size_threshold=32): """ Find all definitions of the varaible :param SimVariable variable: The variable to lookup for. :param int size_threshold: The maximum bytes to consider for the variable. For example, if the variable is 100 ...
[ "def", "lookup_defs", "(", "self", ",", "variable", ",", "size_threshold", "=", "32", ")", ":", "live_def_locs", "=", "set", "(", ")", "if", "isinstance", "(", "variable", ",", "SimRegisterVariable", ")", ":", "if", "variable", ".", "reg", "is", "None", ...
Find all definitions of the varaible :param SimVariable variable: The variable to lookup for. :param int size_threshold: The maximum bytes to consider for the variable. For example, if the variable is 100 byte long, only the first `size_threshold` bytes are considered...
[ "Find", "all", "definitions", "of", "the", "varaible" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L249-L287
train
angr/angr
angr/analyses/ddg.py
DDGViewItem._to_viewitem
def _to_viewitem(self, prog_var): """ Convert a ProgramVariable instance to a DDGViewItem object. :param ProgramVariable prog_var: The ProgramVariable object to convert. :return: The converted DDGViewItem object. :rtype: DDGViewIt...
python
def _to_viewitem(self, prog_var): """ Convert a ProgramVariable instance to a DDGViewItem object. :param ProgramVariable prog_var: The ProgramVariable object to convert. :return: The converted DDGViewItem object. :rtype: DDGViewIt...
[ "def", "_to_viewitem", "(", "self", ",", "prog_var", ")", ":", "return", "DDGViewItem", "(", "self", ".", "_ddg", ",", "prog_var", ",", "simplified", "=", "self", ".", "_simplified", ")" ]
Convert a ProgramVariable instance to a DDGViewItem object. :param ProgramVariable prog_var: The ProgramVariable object to convert. :return: The converted DDGViewItem object. :rtype: DDGViewItem
[ "Convert", "a", "ProgramVariable", "instance", "to", "a", "DDGViewItem", "object", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L342-L351
train
angr/angr
angr/analyses/ddg.py
DDGViewInstruction.definitions
def definitions(self): """ Get all definitions located at the current instruction address. :return: A list of ProgramVariable instances. :rtype: list """ defs = set() if self._simplified: graph = self._ddg.simplified_data_graph else: ...
python
def definitions(self): """ Get all definitions located at the current instruction address. :return: A list of ProgramVariable instances. :rtype: list """ defs = set() if self._simplified: graph = self._ddg.simplified_data_graph else: ...
[ "def", "definitions", "(", "self", ")", ":", "defs", "=", "set", "(", ")", "if", "self", ".", "_simplified", ":", "graph", "=", "self", ".", "_ddg", ".", "simplified_data_graph", "else", ":", "graph", "=", "self", ".", "_ddg", ".", "data_graph", "for",...
Get all definitions located at the current instruction address. :return: A list of ProgramVariable instances. :rtype: list
[ "Get", "all", "definitions", "located", "at", "the", "current", "instruction", "address", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L404-L423
train
angr/angr
angr/analyses/ddg.py
DDG.pp
def pp(self): """ Pretty printing. """ # TODO: make it prettier for src, dst, data in self.graph.edges(data=True): print("%s <-- %s, %s" % (src, dst, data))
python
def pp(self): """ Pretty printing. """ # TODO: make it prettier for src, dst, data in self.graph.edges(data=True): print("%s <-- %s, %s" % (src, dst, data))
[ "def", "pp", "(", "self", ")", ":", "# TODO: make it prettier", "for", "src", ",", "dst", ",", "data", "in", "self", ".", "graph", ".", "edges", "(", "data", "=", "True", ")", ":", "print", "(", "\"%s <-- %s, %s\"", "%", "(", "src", ",", "dst", ",", ...
Pretty printing.
[ "Pretty", "printing", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L549-L555
train
angr/angr
angr/analyses/ddg.py
DDG.function_dependency_graph
def function_dependency_graph(self, func): """ Get a dependency graph for the function `func`. :param func: The Function object in CFG.function_manager. :returns: A networkx.DiGraph instance. """ if self._function_data_dependencies is None: self._bu...
python
def function_dependency_graph(self, func): """ Get a dependency graph for the function `func`. :param func: The Function object in CFG.function_manager. :returns: A networkx.DiGraph instance. """ if self._function_data_dependencies is None: self._bu...
[ "def", "function_dependency_graph", "(", "self", ",", "func", ")", ":", "if", "self", ".", "_function_data_dependencies", "is", "None", ":", "self", ".", "_build_function_dependency_graphs", "(", ")", "if", "func", "in", "self", ".", "_function_data_dependencies", ...
Get a dependency graph for the function `func`. :param func: The Function object in CFG.function_manager. :returns: A networkx.DiGraph instance.
[ "Get", "a", "dependency", "graph", "for", "the", "function", "func", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L584-L599
train
angr/angr
angr/analyses/ddg.py
DDG.data_sub_graph
def data_sub_graph(self, pv, simplified=True, killing_edges=False, excluding_types=None): """ Get a subgraph from the data graph or the simplified data graph that starts from node pv. :param ProgramVariable pv: The starting point of the subgraph. :param bool simplified: When True, the s...
python
def data_sub_graph(self, pv, simplified=True, killing_edges=False, excluding_types=None): """ Get a subgraph from the data graph or the simplified data graph that starts from node pv. :param ProgramVariable pv: The starting point of the subgraph. :param bool simplified: When True, the s...
[ "def", "data_sub_graph", "(", "self", ",", "pv", ",", "simplified", "=", "True", ",", "killing_edges", "=", "False", ",", "excluding_types", "=", "None", ")", ":", "result", "=", "networkx", ".", "MultiDiGraph", "(", ")", "result", ".", "add_node", "(", ...
Get a subgraph from the data graph or the simplified data graph that starts from node pv. :param ProgramVariable pv: The starting point of the subgraph. :param bool simplified: When True, the simplified data graph is used, otherwise the data graph is used. :param bool killing_edges: Are killing...
[ "Get", "a", "subgraph", "from", "the", "data", "graph", "or", "the", "simplified", "data", "graph", "that", "starts", "from", "node", "pv", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L601-L647
train
angr/angr
angr/analyses/ddg.py
DDG._construct
def _construct(self): """ Construct the data dependence graph. We track the following types of dependence: - (Intra-IRSB) temporary variable dependencies - Register dependencies - Memory dependencies, although it's very limited. See below. We track the following...
python
def _construct(self): """ Construct the data dependence graph. We track the following types of dependence: - (Intra-IRSB) temporary variable dependencies - Register dependencies - Memory dependencies, although it's very limited. See below. We track the following...
[ "def", "_construct", "(", "self", ")", ":", "worklist", "=", "[", "]", "worklist_set", "=", "set", "(", ")", "# Initialize the worklist", "if", "self", ".", "_start", "is", "None", ":", "# initial nodes are those nodes in CFG that has no in-degrees", "for", "n", "...
Construct the data dependence graph. We track the following types of dependence: - (Intra-IRSB) temporary variable dependencies - Register dependencies - Memory dependencies, although it's very limited. See below. We track the following types of memory access: - (Intra-...
[ "Construct", "the", "data", "dependence", "graph", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L653-L791
train
angr/angr
angr/analyses/ddg.py
DDG._track
def _track(self, state, live_defs, statements): """ Given all live definitions prior to this program point, track the changes, and return a new list of live definitions. We scan through the action list of the new state to track the changes. :param state: The input state at tha...
python
def _track(self, state, live_defs, statements): """ Given all live definitions prior to this program point, track the changes, and return a new list of live definitions. We scan through the action list of the new state to track the changes. :param state: The input state at tha...
[ "def", "_track", "(", "self", ",", "state", ",", "live_defs", ",", "statements", ")", ":", "# Make a copy of live_defs", "self", ".", "_live_defs", "=", "live_defs", ".", "copy", "(", ")", "action_list", "=", "list", "(", "state", ".", "history", ".", "rec...
Given all live definitions prior to this program point, track the changes, and return a new list of live definitions. We scan through the action list of the new state to track the changes. :param state: The input state at that program point. :param live_defs: All live definition...
[ "Given", "all", "live", "definitions", "prior", "to", "this", "program", "point", "track", "the", "changes", "and", "return", "a", "new", "list", "of", "live", "definitions", ".", "We", "scan", "through", "the", "action", "list", "of", "the", "new", "state...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L793-L853
train
angr/angr
angr/analyses/ddg.py
DDG._def_lookup
def _def_lookup(self, variable): # pylint:disable=no-self-use """ This is a backward lookup in the previous defs. Note that, as we are using VSA, it is possible that `variable` is affected by several definitions. :param angr.analyses.ddg.LiveDefinitions live_defs: ...
python
def _def_lookup(self, variable): # pylint:disable=no-self-use """ This is a backward lookup in the previous defs. Note that, as we are using VSA, it is possible that `variable` is affected by several definitions. :param angr.analyses.ddg.LiveDefinitions live_defs: ...
[ "def", "_def_lookup", "(", "self", ",", "variable", ")", ":", "# pylint:disable=no-self-use", "prevdefs", "=", "{", "}", "for", "code_loc", "in", "self", ".", "_live_defs", ".", "lookup_defs", "(", "variable", ")", ":", "# Label edges with cardinality or actual sets...
This is a backward lookup in the previous defs. Note that, as we are using VSA, it is possible that `variable` is affected by several definitions. :param angr.analyses.ddg.LiveDefinitions live_defs: The collection of live definitions. :param SimVariable: The variable...
[ "This", "is", "a", "backward", "lookup", "in", "the", "previous", "defs", ".", "Note", "that", "as", "we", "are", "using", "VSA", "it", "is", "possible", "that", "variable", "is", "affected", "by", "several", "definitions", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L855-L883
train
angr/angr
angr/analyses/ddg.py
DDG._kill
def _kill(self, variable, code_loc): # pylint:disable=no-self-use """ Kill previous defs. addr_list is a list of normalized addresses. """ # Case 1: address perfectly match, we kill # Case 2: a is a subset of the original address # Case 3: a is a superset of the origina...
python
def _kill(self, variable, code_loc): # pylint:disable=no-self-use """ Kill previous defs. addr_list is a list of normalized addresses. """ # Case 1: address perfectly match, we kill # Case 2: a is a subset of the original address # Case 3: a is a superset of the origina...
[ "def", "_kill", "(", "self", ",", "variable", ",", "code_loc", ")", ":", "# pylint:disable=no-self-use", "# Case 1: address perfectly match, we kill", "# Case 2: a is a subset of the original address", "# Case 3: a is a superset of the original address", "# the previous definition is kil...
Kill previous defs. addr_list is a list of normalized addresses.
[ "Kill", "previous", "defs", ".", "addr_list", "is", "a", "list", "of", "normalized", "addresses", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L885-L901
train
angr/angr
angr/analyses/ddg.py
DDG._get_register_size
def _get_register_size(self, reg_offset): """ Get the size of a register. :param int reg_offset: Offset of the register. :return: Size in bytes. :rtype: int """ # TODO: support registers that are not aligned if reg_offset in self.project.arch.register_na...
python
def _get_register_size(self, reg_offset): """ Get the size of a register. :param int reg_offset: Offset of the register. :return: Size in bytes. :rtype: int """ # TODO: support registers that are not aligned if reg_offset in self.project.arch.register_na...
[ "def", "_get_register_size", "(", "self", ",", "reg_offset", ")", ":", "# TODO: support registers that are not aligned", "if", "reg_offset", "in", "self", ".", "project", ".", "arch", ".", "register_names", ":", "reg_name", "=", "self", ".", "project", ".", "arch"...
Get the size of a register. :param int reg_offset: Offset of the register. :return: Size in bytes. :rtype: int
[ "Get", "the", "size", "of", "a", "register", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L903-L920
train
angr/angr
angr/analyses/ddg.py
DDG._get_actual_addrs
def _get_actual_addrs(action, state): """ For memory actions, get a list of addresses it operates on. :param SimAction action: The action object to work with. :return: A list of addresses that are accessed with that action. :rtype: list "...
python
def _get_actual_addrs(action, state): """ For memory actions, get a list of addresses it operates on. :param SimAction action: The action object to work with. :return: A list of addresses that are accessed with that action. :rtype: list "...
[ "def", "_get_actual_addrs", "(", "action", ",", "state", ")", ":", "if", "action", ".", "actual_addrs", "is", "None", ":", "# For now, mem reads don't necessarily have actual_addrs set properly", "try", ":", "addr_list", "=", "{", "state", ".", "solver", ".", "eval"...
For memory actions, get a list of addresses it operates on. :param SimAction action: The action object to work with. :return: A list of addresses that are accessed with that action. :rtype: list
[ "For", "memory", "actions", "get", "a", "list", "of", "addresses", "it", "operates", "on", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L927-L948
train
angr/angr
angr/analyses/ddg.py
DDG._create_memory_variable
def _create_memory_variable(self, action, addr, addrs): """ Create a SimStackVariable or SimMemoryVariable based on action objects and its address. :param SimAction action: The action to work with. :param int addr: The address of the memory variable in creation. :param l...
python
def _create_memory_variable(self, action, addr, addrs): """ Create a SimStackVariable or SimMemoryVariable based on action objects and its address. :param SimAction action: The action to work with. :param int addr: The address of the memory variable in creation. :param l...
[ "def", "_create_memory_variable", "(", "self", ",", "action", ",", "addr", ",", "addrs", ")", ":", "variable", "=", "None", "if", "len", "(", "addrs", ")", "==", "1", "and", "len", "(", "action", ".", "addr", ".", "tmp_deps", ")", "==", "1", ":", "...
Create a SimStackVariable or SimMemoryVariable based on action objects and its address. :param SimAction action: The action to work with. :param int addr: The address of the memory variable in creation. :param list addrs: A list of all addresses that the action was effective on. ...
[ "Create", "a", "SimStackVariable", "or", "SimMemoryVariable", "based", "on", "action", "objects", "and", "its", "address", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L950-L971
train
angr/angr
angr/analyses/ddg.py
DDG._data_graph_add_edge
def _data_graph_add_edge(self, src, dst, **edge_labels): """ Add an edge in the data dependence graph. :param ProgramVariable src: Source node. :param ProgramVariable dst: Destination node. :param edge_labels: All labels associated with the edge. :return: None ""...
python
def _data_graph_add_edge(self, src, dst, **edge_labels): """ Add an edge in the data dependence graph. :param ProgramVariable src: Source node. :param ProgramVariable dst: Destination node. :param edge_labels: All labels associated with the edge. :return: None ""...
[ "def", "_data_graph_add_edge", "(", "self", ",", "src", ",", "dst", ",", "*", "*", "edge_labels", ")", ":", "if", "src", "in", "self", ".", "_data_graph", "and", "dst", "in", "self", ".", "_data_graph", "[", "src", "]", ":", "return", "self", ".", "_...
Add an edge in the data dependence graph. :param ProgramVariable src: Source node. :param ProgramVariable dst: Destination node. :param edge_labels: All labels associated with the edge. :return: None
[ "Add", "an", "edge", "in", "the", "data", "dependence", "graph", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1299-L1314
train
angr/angr
angr/analyses/ddg.py
DDG._stmt_graph_add_edge
def _stmt_graph_add_edge(self, src, dst, **edge_labels): """ Add an edge in the statement dependence graph from a program location `src` to another program location `dst`. :param CodeLocation src: Source node. :param CodeLocation dst: Destination node. :param edge_labels: All la...
python
def _stmt_graph_add_edge(self, src, dst, **edge_labels): """ Add an edge in the statement dependence graph from a program location `src` to another program location `dst`. :param CodeLocation src: Source node. :param CodeLocation dst: Destination node. :param edge_labels: All la...
[ "def", "_stmt_graph_add_edge", "(", "self", ",", "src", ",", "dst", ",", "*", "*", "edge_labels", ")", ":", "# Is that edge already in the graph ?", "# If at least one is new, then we are not redoing the same path again", "if", "src", "in", "self", ".", "_stmt_graph", "an...
Add an edge in the statement dependence graph from a program location `src` to another program location `dst`. :param CodeLocation src: Source node. :param CodeLocation dst: Destination node. :param edge_labels: All labels associated with the edge. :returns: None
[ "Add", "an", "edge", "in", "the", "statement", "dependence", "graph", "from", "a", "program", "location", "src", "to", "another", "program", "location", "dst", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1316-L1331
train
angr/angr
angr/analyses/ddg.py
DDG._stmt_graph_annotate_edges
def _stmt_graph_annotate_edges(self, edges_to_annotate, **new_labels): """ Add new annotations to edges in the statement dependence graph. :param list edges_to_annotate: A list of edges to annotate. :param new_labels: New labels to be added to those edges. :returns: None ...
python
def _stmt_graph_annotate_edges(self, edges_to_annotate, **new_labels): """ Add new annotations to edges in the statement dependence graph. :param list edges_to_annotate: A list of edges to annotate. :param new_labels: New labels to be added to those edges. :returns: None ...
[ "def", "_stmt_graph_annotate_edges", "(", "self", ",", "edges_to_annotate", ",", "*", "*", "new_labels", ")", ":", "graph", "=", "self", ".", "graph", "for", "src", ",", "dst", "in", "edges_to_annotate", ":", "if", "src", "not", "in", "graph", ":", "contin...
Add new annotations to edges in the statement dependence graph. :param list edges_to_annotate: A list of edges to annotate. :param new_labels: New labels to be added to those edges. :returns: None
[ "Add", "new", "annotations", "to", "edges", "in", "the", "statement", "dependence", "graph", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1333-L1359
train
angr/angr
angr/analyses/ddg.py
DDG._simplify_data_graph
def _simplify_data_graph(self, data_graph): # pylint:disable=no-self-use """ Simplify a data graph by removing all temp variable nodes on the graph. :param networkx.DiGraph data_graph: The data dependence graph to simplify. :return: The simplified graph. :rtype: networkx.MultiD...
python
def _simplify_data_graph(self, data_graph): # pylint:disable=no-self-use """ Simplify a data graph by removing all temp variable nodes on the graph. :param networkx.DiGraph data_graph: The data dependence graph to simplify. :return: The simplified graph. :rtype: networkx.MultiD...
[ "def", "_simplify_data_graph", "(", "self", ",", "data_graph", ")", ":", "# pylint:disable=no-self-use", "graph", "=", "networkx", ".", "MultiDiGraph", "(", "data_graph", ")", "all_nodes", "=", "[", "n", "for", "n", "in", "graph", ".", "nodes", "(", ")", "if...
Simplify a data graph by removing all temp variable nodes on the graph. :param networkx.DiGraph data_graph: The data dependence graph to simplify. :return: The simplified graph. :rtype: networkx.MultiDiGraph
[ "Simplify", "a", "data", "graph", "by", "removing", "all", "temp", "variable", "nodes", "on", "the", "graph", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1361-L1394
train
angr/angr
angr/analyses/ddg.py
DDG._worklist_append
def _worklist_append(self, node_wrapper, worklist, worklist_set): """ Append a CFGNode and its successors into the work-list, and respect the call-depth limit :param node_wrapper: The NodeWrapper instance to insert. :param worklist: The work-list, which is a list. :par...
python
def _worklist_append(self, node_wrapper, worklist, worklist_set): """ Append a CFGNode and its successors into the work-list, and respect the call-depth limit :param node_wrapper: The NodeWrapper instance to insert. :param worklist: The work-list, which is a list. :par...
[ "def", "_worklist_append", "(", "self", ",", "node_wrapper", ",", "worklist", ",", "worklist_set", ")", ":", "if", "node_wrapper", ".", "cfg_node", "in", "worklist_set", ":", "# It's already in the work-list", "return", "worklist", ".", "append", "(", "node_wrapper"...
Append a CFGNode and its successors into the work-list, and respect the call-depth limit :param node_wrapper: The NodeWrapper instance to insert. :param worklist: The work-list, which is a list. :param worklist_set: A set of all CFGNodes that are inside the work-list, just for the ...
[ "Append", "a", "CFGNode", "and", "its", "successors", "into", "the", "work", "-", "list", "and", "respect", "the", "call", "-", "depth", "limit" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1396-L1452
train
angr/angr
angr/analyses/ddg.py
DDG._build_function_dependency_graphs
def _build_function_dependency_graphs(self): """ Build dependency graphs for each function, and save them in self._function_data_dependencies. """ # This is a map between functions and its corresponding dependencies self._function_data_dependencies = defaultdict(networkx.DiGraph...
python
def _build_function_dependency_graphs(self): """ Build dependency graphs for each function, and save them in self._function_data_dependencies. """ # This is a map between functions and its corresponding dependencies self._function_data_dependencies = defaultdict(networkx.DiGraph...
[ "def", "_build_function_dependency_graphs", "(", "self", ")", ":", "# This is a map between functions and its corresponding dependencies", "self", ".", "_function_data_dependencies", "=", "defaultdict", "(", "networkx", ".", "DiGraph", ")", "# Group all dependencies first", "bloc...
Build dependency graphs for each function, and save them in self._function_data_dependencies.
[ "Build", "dependency", "graphs", "for", "each", "function", "and", "save", "them", "in", "self", ".", "_function_data_dependencies", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1454-L1478
train
angr/angr
angr/analyses/ddg.py
DDG._filter_defs_at_call_sites
def _filter_defs_at_call_sites(self, defs): """ If we are not tracing into the function that are called in a real execution, we should properly filter the defs to account for the behavior of the skipped function at this call site. This function is a WIP. See TODOs inside. :para...
python
def _filter_defs_at_call_sites(self, defs): """ If we are not tracing into the function that are called in a real execution, we should properly filter the defs to account for the behavior of the skipped function at this call site. This function is a WIP. See TODOs inside. :para...
[ "def", "_filter_defs_at_call_sites", "(", "self", ",", "defs", ")", ":", "# TODO: make definition killing architecture independent and calling convention independent", "# TODO: use information from a calling convention analysis", "filtered_defs", "=", "LiveDefinitions", "(", ")", "for"...
If we are not tracing into the function that are called in a real execution, we should properly filter the defs to account for the behavior of the skipped function at this call site. This function is a WIP. See TODOs inside. :param defs: :return:
[ "If", "we", "are", "not", "tracing", "into", "the", "function", "that", "are", "called", "in", "a", "real", "execution", "we", "should", "properly", "filter", "the", "defs", "to", "account", "for", "the", "behavior", "of", "the", "skipped", "function", "at...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1484-L1508
train
angr/angr
angr/analyses/ddg.py
DDG.find_definitions
def find_definitions(self, variable, location=None, simplified_graph=True): """ Find all definitions of the given variable. :param SimVariable variable: :param bool simplified_graph: True if you just want to search in the simplified graph instead of the normal ...
python
def find_definitions(self, variable, location=None, simplified_graph=True): """ Find all definitions of the given variable. :param SimVariable variable: :param bool simplified_graph: True if you just want to search in the simplified graph instead of the normal ...
[ "def", "find_definitions", "(", "self", ",", "variable", ",", "location", "=", "None", ",", "simplified_graph", "=", "True", ")", ":", "if", "simplified_graph", ":", "graph", "=", "self", ".", "simplified_data_graph", "else", ":", "graph", "=", "self", ".", ...
Find all definitions of the given variable. :param SimVariable variable: :param bool simplified_graph: True if you just want to search in the simplified graph instead of the normal graph. Usually the simplified graph suffices for finding definitions of register ...
[ "Find", "all", "definitions", "of", "the", "given", "variable", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1510-L1538
train
angr/angr
angr/analyses/ddg.py
DDG.find_consumers
def find_consumers(self, var_def, simplified_graph=True): """ Find all consumers to the specified variable definition. :param ProgramVariable var_def: The variable definition. :param bool simplified_graph: True if we want to search in the simplified graph, False otherwise. :retu...
python
def find_consumers(self, var_def, simplified_graph=True): """ Find all consumers to the specified variable definition. :param ProgramVariable var_def: The variable definition. :param bool simplified_graph: True if we want to search in the simplified graph, False otherwise. :retu...
[ "def", "find_consumers", "(", "self", ",", "var_def", ",", "simplified_graph", "=", "True", ")", ":", "if", "simplified_graph", ":", "graph", "=", "self", ".", "simplified_data_graph", "else", ":", "graph", "=", "self", ".", "data_graph", "if", "var_def", "n...
Find all consumers to the specified variable definition. :param ProgramVariable var_def: The variable definition. :param bool simplified_graph: True if we want to search in the simplified graph, False otherwise. :return: A collection of all consumers to the specified variable definition. ...
[ "Find", "all", "consumers", "to", "the", "specified", "variable", "definition", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1541-L1578
train
angr/angr
angr/analyses/ddg.py
DDG.find_killers
def find_killers(self, var_def, simplified_graph=True): """ Find all killers to the specified variable definition. :param ProgramVariable var_def: The variable definition. :param bool simplified_graph: True if we want to search in the simplified graph, False otherwise. :return: ...
python
def find_killers(self, var_def, simplified_graph=True): """ Find all killers to the specified variable definition. :param ProgramVariable var_def: The variable definition. :param bool simplified_graph: True if we want to search in the simplified graph, False otherwise. :return: ...
[ "def", "find_killers", "(", "self", ",", "var_def", ",", "simplified_graph", "=", "True", ")", ":", "if", "simplified_graph", ":", "graph", "=", "self", ".", "simplified_data_graph", "else", ":", "graph", "=", "self", ".", "data_graph", "if", "var_def", "not...
Find all killers to the specified variable definition. :param ProgramVariable var_def: The variable definition. :param bool simplified_graph: True if we want to search in the simplified graph, False otherwise. :return: A collection of all killers to the specified variable definition. :r...
[ "Find", "all", "killers", "to", "the", "specified", "variable", "definition", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1581-L1605
train
angr/angr
angr/analyses/ddg.py
DDG.find_sources
def find_sources(self, var_def, simplified_graph=True): """ Find all sources to the specified variable definition. :param ProgramVariable var_def: The variable definition. :param bool simplified_graph: True if we want to search in the simplified graph, False otherwise. :return: ...
python
def find_sources(self, var_def, simplified_graph=True): """ Find all sources to the specified variable definition. :param ProgramVariable var_def: The variable definition. :param bool simplified_graph: True if we want to search in the simplified graph, False otherwise. :return: ...
[ "def", "find_sources", "(", "self", ",", "var_def", ",", "simplified_graph", "=", "True", ")", ":", "if", "simplified_graph", ":", "graph", "=", "self", ".", "simplified_data_graph", "else", ":", "graph", "=", "self", ".", "data_graph", "if", "var_def", "not...
Find all sources to the specified variable definition. :param ProgramVariable var_def: The variable definition. :param bool simplified_graph: True if we want to search in the simplified graph, False otherwise. :return: A collection of all sources to the specified variable definition. :r...
[ "Find", "all", "sources", "to", "the", "specified", "variable", "definition", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1608-L1644
train
angr/angr
angr/engines/soot/expressions/newMultiArray.py
SimSootExpr_NewMultiArray.new_array
def new_array(state, element_type, size, default_value_generator=None): """ Allocates a new multi array in memory and returns the reference to the base. """ size_bounded = SimSootExpr_NewMultiArray._bound_multi_array_size(state, size) # return the reference of the array base ...
python
def new_array(state, element_type, size, default_value_generator=None): """ Allocates a new multi array in memory and returns the reference to the base. """ size_bounded = SimSootExpr_NewMultiArray._bound_multi_array_size(state, size) # return the reference of the array base ...
[ "def", "new_array", "(", "state", ",", "element_type", ",", "size", ",", "default_value_generator", "=", "None", ")", ":", "size_bounded", "=", "SimSootExpr_NewMultiArray", ".", "_bound_multi_array_size", "(", "state", ",", "size", ")", "# return the reference of the ...
Allocates a new multi array in memory and returns the reference to the base.
[ "Allocates", "a", "new", "multi", "array", "in", "memory", "and", "returns", "the", "reference", "to", "the", "base", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/soot/expressions/newMultiArray.py#L21-L31
train
angr/angr
angr/concretization_strategies/__init__.py
SimConcretizationStrategy._min
def _min(self, memory, addr, **kwargs): """ Gets the minimum solution of an address. """ return memory.state.solver.min(addr, exact=kwargs.pop('exact', self._exact), **kwargs)
python
def _min(self, memory, addr, **kwargs): """ Gets the minimum solution of an address. """ return memory.state.solver.min(addr, exact=kwargs.pop('exact', self._exact), **kwargs)
[ "def", "_min", "(", "self", ",", "memory", ",", "addr", ",", "*", "*", "kwargs", ")", ":", "return", "memory", ".", "state", ".", "solver", ".", "min", "(", "addr", ",", "exact", "=", "kwargs", ".", "pop", "(", "'exact'", ",", "self", ".", "_exac...
Gets the minimum solution of an address.
[ "Gets", "the", "minimum", "solution", "of", "an", "address", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/concretization_strategies/__init__.py#L21-L25
train
angr/angr
angr/concretization_strategies/__init__.py
SimConcretizationStrategy._max
def _max(self, memory, addr, **kwargs): """ Gets the maximum solution of an address. """ return memory.state.solver.max(addr, exact=kwargs.pop('exact', self._exact), **kwargs)
python
def _max(self, memory, addr, **kwargs): """ Gets the maximum solution of an address. """ return memory.state.solver.max(addr, exact=kwargs.pop('exact', self._exact), **kwargs)
[ "def", "_max", "(", "self", ",", "memory", ",", "addr", ",", "*", "*", "kwargs", ")", ":", "return", "memory", ".", "state", ".", "solver", ".", "max", "(", "addr", ",", "exact", "=", "kwargs", ".", "pop", "(", "'exact'", ",", "self", ".", "_exac...
Gets the maximum solution of an address.
[ "Gets", "the", "maximum", "solution", "of", "an", "address", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/concretization_strategies/__init__.py#L27-L31
train
angr/angr
angr/concretization_strategies/__init__.py
SimConcretizationStrategy._any
def _any(self, memory, addr, **kwargs): """ Gets any solution of an address. """ return memory.state.solver.eval(addr, exact=kwargs.pop('exact', self._exact), **kwargs)
python
def _any(self, memory, addr, **kwargs): """ Gets any solution of an address. """ return memory.state.solver.eval(addr, exact=kwargs.pop('exact', self._exact), **kwargs)
[ "def", "_any", "(", "self", ",", "memory", ",", "addr", ",", "*", "*", "kwargs", ")", ":", "return", "memory", ".", "state", ".", "solver", ".", "eval", "(", "addr", ",", "exact", "=", "kwargs", ".", "pop", "(", "'exact'", ",", "self", ".", "_exa...
Gets any solution of an address.
[ "Gets", "any", "solution", "of", "an", "address", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/concretization_strategies/__init__.py#L33-L37
train
angr/angr
angr/concretization_strategies/__init__.py
SimConcretizationStrategy._eval
def _eval(self, memory, addr, n, **kwargs): """ Gets n solutions for an address. """ return memory.state.solver.eval_upto(addr, n, exact=kwargs.pop('exact', self._exact), **kwargs)
python
def _eval(self, memory, addr, n, **kwargs): """ Gets n solutions for an address. """ return memory.state.solver.eval_upto(addr, n, exact=kwargs.pop('exact', self._exact), **kwargs)
[ "def", "_eval", "(", "self", ",", "memory", ",", "addr", ",", "n", ",", "*", "*", "kwargs", ")", ":", "return", "memory", ".", "state", ".", "solver", ".", "eval_upto", "(", "addr", ",", "n", ",", "exact", "=", "kwargs", ".", "pop", "(", "'exact'...
Gets n solutions for an address.
[ "Gets", "n", "solutions", "for", "an", "address", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/concretization_strategies/__init__.py#L39-L43
train
angr/angr
angr/concretization_strategies/__init__.py
SimConcretizationStrategy._range
def _range(self, memory, addr, **kwargs): """ Gets the (min, max) range of solutions for an address. """ return (self._min(memory, addr, **kwargs), self._max(memory, addr, **kwargs))
python
def _range(self, memory, addr, **kwargs): """ Gets the (min, max) range of solutions for an address. """ return (self._min(memory, addr, **kwargs), self._max(memory, addr, **kwargs))
[ "def", "_range", "(", "self", ",", "memory", ",", "addr", ",", "*", "*", "kwargs", ")", ":", "return", "(", "self", ".", "_min", "(", "memory", ",", "addr", ",", "*", "*", "kwargs", ")", ",", "self", ".", "_max", "(", "memory", ",", "addr", ","...
Gets the (min, max) range of solutions for an address.
[ "Gets", "the", "(", "min", "max", ")", "range", "of", "solutions", "for", "an", "address", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/concretization_strategies/__init__.py#L45-L49
train
angr/angr
angr/concretization_strategies/__init__.py
SimConcretizationStrategy.concretize
def concretize(self, memory, addr): """ Concretizes the address into a list of values. If this strategy cannot handle this address, returns None. """ if self._filter is None or self._filter(memory, addr): return self._concretize(memory, addr)
python
def concretize(self, memory, addr): """ Concretizes the address into a list of values. If this strategy cannot handle this address, returns None. """ if self._filter is None or self._filter(memory, addr): return self._concretize(memory, addr)
[ "def", "concretize", "(", "self", ",", "memory", ",", "addr", ")", ":", "if", "self", ".", "_filter", "is", "None", "or", "self", ".", "_filter", "(", "memory", ",", "addr", ")", ":", "return", "self", ".", "_concretize", "(", "memory", ",", "addr", ...
Concretizes the address into a list of values. If this strategy cannot handle this address, returns None.
[ "Concretizes", "the", "address", "into", "a", "list", "of", "values", ".", "If", "this", "strategy", "cannot", "handle", "this", "address", "returns", "None", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/concretization_strategies/__init__.py#L51-L57
train
angr/angr
angr/analyses/cfg/cfg_utils.py
CFGUtils.find_merge_points
def find_merge_points(function_addr, function_endpoints, graph): # pylint:disable=unused-argument """ Given a local transition graph of a function, find all merge points inside, and then perform a quasi-topological sort of those merge points. A merge point might be one of the following...
python
def find_merge_points(function_addr, function_endpoints, graph): # pylint:disable=unused-argument """ Given a local transition graph of a function, find all merge points inside, and then perform a quasi-topological sort of those merge points. A merge point might be one of the following...
[ "def", "find_merge_points", "(", "function_addr", ",", "function_endpoints", ",", "graph", ")", ":", "# pylint:disable=unused-argument", "merge_points", "=", "set", "(", ")", "for", "node", "in", "graph", ".", "nodes", "(", ")", ":", "if", "graph", ".", "in_de...
Given a local transition graph of a function, find all merge points inside, and then perform a quasi-topological sort of those merge points. A merge point might be one of the following cases: - two or more paths come together, and ends at the same address. - end of the current function ...
[ "Given", "a", "local", "transition", "graph", "of", "a", "function", "find", "all", "merge", "points", "inside", "and", "then", "perform", "a", "quasi", "-", "topological", "sort", "of", "those", "merge", "points", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_utils.py#L25-L50
train
angr/angr
angr/analyses/cfg/cfg_utils.py
CFGUtils.find_widening_points
def find_widening_points(function_addr, function_endpoints, graph): # pylint: disable=unused-argument """ Given a local transition graph of a function, find all widening points inside. Correctly choosing widening points is very important in order to not lose too much information during static ...
python
def find_widening_points(function_addr, function_endpoints, graph): # pylint: disable=unused-argument """ Given a local transition graph of a function, find all widening points inside. Correctly choosing widening points is very important in order to not lose too much information during static ...
[ "def", "find_widening_points", "(", "function_addr", ",", "function_endpoints", ",", "graph", ")", ":", "# pylint: disable=unused-argument", "sccs", "=", "networkx", ".", "strongly_connected_components", "(", "graph", ")", "widening_addrs", "=", "set", "(", ")", "for"...
Given a local transition graph of a function, find all widening points inside. Correctly choosing widening points is very important in order to not lose too much information during static analysis. We mainly consider merge points that has at least one loop back edges coming in as widening points. ...
[ "Given", "a", "local", "transition", "graph", "of", "a", "function", "find", "all", "widening", "points", "inside", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_utils.py#L53-L84
train
angr/angr
angr/analyses/cfg/cfg_utils.py
CFGUtils.reverse_post_order_sort_nodes
def reverse_post_order_sort_nodes(graph, nodes=None): """ Sort a given set of nodes in reverse post ordering. :param networkx.DiGraph graph: A local transition graph of a function. :param iterable nodes: A collection of nodes to sort. :return: A list of sorted nodes. :rt...
python
def reverse_post_order_sort_nodes(graph, nodes=None): """ Sort a given set of nodes in reverse post ordering. :param networkx.DiGraph graph: A local transition graph of a function. :param iterable nodes: A collection of nodes to sort. :return: A list of sorted nodes. :rt...
[ "def", "reverse_post_order_sort_nodes", "(", "graph", ",", "nodes", "=", "None", ")", ":", "post_order", "=", "networkx", ".", "dfs_postorder_nodes", "(", "graph", ")", "if", "nodes", "is", "None", ":", "return", "reversed", "(", "list", "(", "post_order", "...
Sort a given set of nodes in reverse post ordering. :param networkx.DiGraph graph: A local transition graph of a function. :param iterable nodes: A collection of nodes to sort. :return: A list of sorted nodes. :rtype: list
[ "Sort", "a", "given", "set", "of", "nodes", "in", "reverse", "post", "ordering", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_utils.py#L87-L105
train
angr/angr
angr/analyses/cfg/cfg_utils.py
CFGUtils.quasi_topological_sort_nodes
def quasi_topological_sort_nodes(graph, nodes=None): """ Sort a given set of nodes from a graph based on the following rules: # - if A -> B and not B -> A, then we have A < B # - if A -> B and B -> A, then the ordering is undefined Following the above rules gives us a quasi-top...
python
def quasi_topological_sort_nodes(graph, nodes=None): """ Sort a given set of nodes from a graph based on the following rules: # - if A -> B and not B -> A, then we have A < B # - if A -> B and B -> A, then the ordering is undefined Following the above rules gives us a quasi-top...
[ "def", "quasi_topological_sort_nodes", "(", "graph", ",", "nodes", "=", "None", ")", ":", "# fast path for single node graphs", "if", "graph", ".", "number_of_nodes", "(", ")", "==", "1", ":", "return", "graph", ".", "nodes", "(", ")", "# make a copy to the graph ...
Sort a given set of nodes from a graph based on the following rules: # - if A -> B and not B -> A, then we have A < B # - if A -> B and B -> A, then the ordering is undefined Following the above rules gives us a quasi-topological sorting of nodes in the graph. It also works for cyclic ...
[ "Sort", "a", "given", "set", "of", "nodes", "from", "a", "graph", "based", "on", "the", "following", "rules", ":" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_utils.py#L108-L171
train
angr/angr
angr/analyses/cfg/cfg_utils.py
CFGUtils._append_scc
def _append_scc(graph, ordered_nodes, scc): """ Append all nodes from a strongly connected component to a list of ordered nodes and ensure the topological order. :param networkx.DiGraph graph: The graph where all nodes belong to. :param list ordered_nodes: Ordered nodes. ...
python
def _append_scc(graph, ordered_nodes, scc): """ Append all nodes from a strongly connected component to a list of ordered nodes and ensure the topological order. :param networkx.DiGraph graph: The graph where all nodes belong to. :param list ordered_nodes: Ordered nodes. ...
[ "def", "_append_scc", "(", "graph", ",", "ordered_nodes", ",", "scc", ")", ":", "# find the first node in the strongly connected component that is the successor to any node in ordered_nodes", "loop_head", "=", "None", "for", "parent_node", "in", "reversed", "(", "ordered_nodes"...
Append all nodes from a strongly connected component to a list of ordered nodes and ensure the topological order. :param networkx.DiGraph graph: The graph where all nodes belong to. :param list ordered_nodes: Ordered nodes. :param iterable scc: A set of nodes that forms a ...
[ "Append", "all", "nodes", "from", "a", "strongly", "connected", "component", "to", "a", "list", "of", "ordered", "nodes", "and", "ensure", "the", "topological", "order", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_utils.py#L182-L212
train
angr/angr
angr/sim_manager.py
SimulationManager.mulpyplex
def mulpyplex(self, *stashes): """ Mulpyplex across several stashes. :param stashes: the stashes to mulpyplex :return: a mulpyplexed list of states from the stashes in question, in the specified order """ return mulpyplexer.MP(list(itertools.chain.from_iterable(self._st...
python
def mulpyplex(self, *stashes): """ Mulpyplex across several stashes. :param stashes: the stashes to mulpyplex :return: a mulpyplexed list of states from the stashes in question, in the specified order """ return mulpyplexer.MP(list(itertools.chain.from_iterable(self._st...
[ "def", "mulpyplex", "(", "self", ",", "*", "stashes", ")", ":", "return", "mulpyplexer", ".", "MP", "(", "list", "(", "itertools", ".", "chain", ".", "from_iterable", "(", "self", ".", "_stashes", "[", "s", "]", "for", "s", "in", "stashes", ")", ")",...
Mulpyplex across several stashes. :param stashes: the stashes to mulpyplex :return: a mulpyplexed list of states from the stashes in question, in the specified order
[ "Mulpyplex", "across", "several", "stashes", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L144-L152
train
angr/angr
angr/sim_manager.py
SimulationManager.copy
def copy(self, deep=False): # pylint: disable=arguments-differ """ Make a copy of this simulation manager. Pass ``deep=True`` to copy all the states in it as well. """ simgr = SimulationManager(self._project, stashes=self._copy_stashes(deep=deep), ...
python
def copy(self, deep=False): # pylint: disable=arguments-differ """ Make a copy of this simulation manager. Pass ``deep=True`` to copy all the states in it as well. """ simgr = SimulationManager(self._project, stashes=self._copy_stashes(deep=deep), ...
[ "def", "copy", "(", "self", ",", "deep", "=", "False", ")", ":", "# pylint: disable=arguments-differ", "simgr", "=", "SimulationManager", "(", "self", ".", "_project", ",", "stashes", "=", "self", ".", "_copy_stashes", "(", "deep", "=", "deep", ")", ",", "...
Make a copy of this simulation manager. Pass ``deep=True`` to copy all the states in it as well.
[ "Make", "a", "copy", "of", "this", "simulation", "manager", ".", "Pass", "deep", "=", "True", "to", "copy", "all", "the", "states", "in", "it", "as", "well", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L154-L165
train
angr/angr
angr/sim_manager.py
SimulationManager.use_technique
def use_technique(self, tech): """ Use an exploration technique with this SimulationManager. Techniques can be found in :mod:`angr.exploration_techniques`. :param tech: An ExplorationTechnique object that contains code to modify this SimulationManager's behav...
python
def use_technique(self, tech): """ Use an exploration technique with this SimulationManager. Techniques can be found in :mod:`angr.exploration_techniques`. :param tech: An ExplorationTechnique object that contains code to modify this SimulationManager's behav...
[ "def", "use_technique", "(", "self", ",", "tech", ")", ":", "if", "not", "isinstance", "(", "tech", ",", "ExplorationTechnique", ")", ":", "raise", "SimulationManagerError", "# XXX: as promised", "tech", ".", "project", "=", "self", ".", "_project", "tech", "....
Use an exploration technique with this SimulationManager. Techniques can be found in :mod:`angr.exploration_techniques`. :param tech: An ExplorationTechnique object that contains code to modify this SimulationManager's behavior. :type tech: ExplorationTechnique ...
[ "Use", "an", "exploration", "technique", "with", "this", "SimulationManager", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L171-L191
train
angr/angr
angr/sim_manager.py
SimulationManager.remove_technique
def remove_technique(self, tech): """ Remove an exploration technique from a list of active techniques. :param tech: An ExplorationTechnique object. :type tech: ExplorationTechnique """ if not isinstance(tech, ExplorationTechnique): raise SimulationMan...
python
def remove_technique(self, tech): """ Remove an exploration technique from a list of active techniques. :param tech: An ExplorationTechnique object. :type tech: ExplorationTechnique """ if not isinstance(tech, ExplorationTechnique): raise SimulationMan...
[ "def", "remove_technique", "(", "self", ",", "tech", ")", ":", "if", "not", "isinstance", "(", "tech", ",", "ExplorationTechnique", ")", ":", "raise", "SimulationManagerError", "def", "_is_overriden", "(", "name", ")", ":", "return", "getattr", "(", "tech", ...
Remove an exploration technique from a list of active techniques. :param tech: An ExplorationTechnique object. :type tech: ExplorationTechnique
[ "Remove", "an", "exploration", "technique", "from", "a", "list", "of", "active", "techniques", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L193-L211
train
angr/angr
angr/sim_manager.py
SimulationManager.explore
def explore(self, stash='active', n=None, find=None, avoid=None, find_stash='found', avoid_stash='avoid', cfg=None, num_find=1, **kwargs): """ Tick stash "stash" forward (up to "n" times or until "num_find" states are found), looking for condition "find", avoiding condition "avoi...
python
def explore(self, stash='active', n=None, find=None, avoid=None, find_stash='found', avoid_stash='avoid', cfg=None, num_find=1, **kwargs): """ Tick stash "stash" forward (up to "n" times or until "num_find" states are found), looking for condition "find", avoiding condition "avoi...
[ "def", "explore", "(", "self", ",", "stash", "=", "'active'", ",", "n", "=", "None", ",", "find", "=", "None", ",", "avoid", "=", "None", ",", "find_stash", "=", "'found'", ",", "avoid_stash", "=", "'avoid'", ",", "cfg", "=", "None", ",", "num_find",...
Tick stash "stash" forward (up to "n" times or until "num_find" states are found), looking for condition "find", avoiding condition "avoid". Stores found states into "find_stash' and avoided states into "avoid_stash". The "find" and "avoid" parameters may be any of: - An address to find ...
[ "Tick", "stash", "stash", "forward", "(", "up", "to", "n", "times", "or", "until", "num_find", "states", "are", "found", ")", "looking", "for", "condition", "find", "avoiding", "condition", "avoid", ".", "Stores", "found", "states", "into", "find_stash", "an...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L217-L241
train
angr/angr
angr/sim_manager.py
SimulationManager.run
def run(self, stash='active', n=None, until=None, **kwargs): """ Run until the SimulationManager has reached a completed state, according to the current exploration techniques. If no exploration techniques that define a completion state are being used, run until there is nothing left to ...
python
def run(self, stash='active', n=None, until=None, **kwargs): """ Run until the SimulationManager has reached a completed state, according to the current exploration techniques. If no exploration techniques that define a completion state are being used, run until there is nothing left to ...
[ "def", "run", "(", "self", ",", "stash", "=", "'active'", ",", "n", "=", "None", ",", "until", "=", "None", ",", "*", "*", "kwargs", ")", ":", "for", "_", "in", "(", "itertools", ".", "count", "(", ")", "if", "n", "is", "None", "else", "range",...
Run until the SimulationManager has reached a completed state, according to the current exploration techniques. If no exploration techniques that define a completion state are being used, run until there is nothing left to run. :param stash: Operate on this stash :param n: ...
[ "Run", "until", "the", "SimulationManager", "has", "reached", "a", "completed", "state", "according", "to", "the", "current", "exploration", "techniques", ".", "If", "no", "exploration", "techniques", "that", "define", "a", "completion", "state", "are", "being", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L243-L263
train
angr/angr
angr/sim_manager.py
SimulationManager.complete
def complete(self): """ Returns whether or not this manager has reached a "completed" state. """ if not self._techniques: return False if not any(tech._is_overriden('complete') for tech in self._techniques): return False return self.completion_mode...
python
def complete(self): """ Returns whether or not this manager has reached a "completed" state. """ if not self._techniques: return False if not any(tech._is_overriden('complete') for tech in self._techniques): return False return self.completion_mode...
[ "def", "complete", "(", "self", ")", ":", "if", "not", "self", ".", "_techniques", ":", "return", "False", "if", "not", "any", "(", "tech", ".", "_is_overriden", "(", "'complete'", ")", "for", "tech", "in", "self", ".", "_techniques", ")", ":", "return...
Returns whether or not this manager has reached a "completed" state.
[ "Returns", "whether", "or", "not", "this", "manager", "has", "reached", "a", "completed", "state", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L265-L273
train