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/sim_manager.py
SimulationManager.step
def step(self, stash='active', n=None, selector_func=None, step_func=None, successor_func=None, until=None, filter_func=None, **run_args): """ Step a stash of states forward and categorize the successors appropriately. The parameters to this function allow you to control everything...
python
def step(self, stash='active', n=None, selector_func=None, step_func=None, successor_func=None, until=None, filter_func=None, **run_args): """ Step a stash of states forward and categorize the successors appropriately. The parameters to this function allow you to control everything...
[ "def", "step", "(", "self", ",", "stash", "=", "'active'", ",", "n", "=", "None", ",", "selector_func", "=", "None", ",", "step_func", "=", "None", ",", "successor_func", "=", "None", ",", "until", "=", "None", ",", "filter_func", "=", "None", ",", "...
Step a stash of states forward and categorize the successors appropriately. The parameters to this function allow you to control everything about the stepping and categorization process. :param stash: The name of the stash to step (default: 'active') :param selector_func: I...
[ "Step", "a", "stash", "of", "states", "forward", "and", "categorize", "the", "successors", "appropriately", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L275-L374
train
angr/angr
angr/sim_manager.py
SimulationManager.step_state
def step_state(self, state, successor_func=None, **run_args): """ Don't use this function manually - it is meant to interface with exploration techniques. """ try: successors = self.successors(state, successor_func=successor_func, **run_args) stashes = {None: succ...
python
def step_state(self, state, successor_func=None, **run_args): """ Don't use this function manually - it is meant to interface with exploration techniques. """ try: successors = self.successors(state, successor_func=successor_func, **run_args) stashes = {None: succ...
[ "def", "step_state", "(", "self", ",", "state", ",", "successor_func", "=", "None", ",", "*", "*", "run_args", ")", ":", "try", ":", "successors", "=", "self", ".", "successors", "(", "state", ",", "successor_func", "=", "successor_func", ",", "*", "*", ...
Don't use this function manually - it is meant to interface with exploration techniques.
[ "Don", "t", "use", "this", "function", "manually", "-", "it", "is", "meant", "to", "interface", "with", "exploration", "techniques", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L376-L396
train
angr/angr
angr/sim_manager.py
SimulationManager.successors
def successors(self, state, successor_func=None, **run_args): """ Don't use this function manually - it is meant to interface with exploration techniques. """ if successor_func is not None: return successor_func(state, **run_args) return self._project.factory.successo...
python
def successors(self, state, successor_func=None, **run_args): """ Don't use this function manually - it is meant to interface with exploration techniques. """ if successor_func is not None: return successor_func(state, **run_args) return self._project.factory.successo...
[ "def", "successors", "(", "self", ",", "state", ",", "successor_func", "=", "None", ",", "*", "*", "run_args", ")", ":", "if", "successor_func", "is", "not", "None", ":", "return", "successor_func", "(", "state", ",", "*", "*", "run_args", ")", "return",...
Don't use this function manually - it is meant to interface with exploration techniques.
[ "Don", "t", "use", "this", "function", "manually", "-", "it", "is", "meant", "to", "interface", "with", "exploration", "techniques", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L414-L420
train
angr/angr
angr/sim_manager.py
SimulationManager.prune
def prune(self, filter_func=None, from_stash='active', to_stash='pruned'): """ Prune unsatisfiable states from a stash. This function will move all unsatisfiable states in the given stash into a different stash. :param filter_func: Only prune states that match this filter. :par...
python
def prune(self, filter_func=None, from_stash='active', to_stash='pruned'): """ Prune unsatisfiable states from a stash. This function will move all unsatisfiable states in the given stash into a different stash. :param filter_func: Only prune states that match this filter. :par...
[ "def", "prune", "(", "self", ",", "filter_func", "=", "None", ",", "from_stash", "=", "'active'", ",", "to_stash", "=", "'pruned'", ")", ":", "def", "_prune_filter", "(", "state", ")", ":", "to_prune", "=", "not", "filter_func", "or", "filter_func", "(", ...
Prune unsatisfiable states from a stash. This function will move all unsatisfiable states in the given stash into a different stash. :param filter_func: Only prune states that match this filter. :param from_stash: Prune states from this stash. (default: 'active') :param to_stash: P...
[ "Prune", "unsatisfiable", "states", "from", "a", "stash", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L426-L449
train
angr/angr
angr/sim_manager.py
SimulationManager.move
def move(self, from_stash, to_stash, filter_func=None): """ Move states from one stash to another. :param from_stash: Take matching states from this stash. :param to_stash: Put matching states into this stash. :param filter_func: Stash states that match this filter. Should b...
python
def move(self, from_stash, to_stash, filter_func=None): """ Move states from one stash to another. :param from_stash: Take matching states from this stash. :param to_stash: Put matching states into this stash. :param filter_func: Stash states that match this filter. Should b...
[ "def", "move", "(", "self", ",", "from_stash", ",", "to_stash", ",", "filter_func", "=", "None", ")", ":", "filter_func", "=", "filter_func", "or", "(", "lambda", "s", ":", "True", ")", "stash_splitter", "=", "lambda", "states", ":", "reversed", "(", "se...
Move states from one stash to another. :param from_stash: Take matching states from this stash. :param to_stash: Put matching states into this stash. :param filter_func: Stash states that match this filter. Should be a function that takes a state and returns True...
[ "Move", "states", "from", "one", "stash", "to", "another", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L461-L475
train
angr/angr
angr/sim_manager.py
SimulationManager.stash
def stash(self, filter_func=None, from_stash='active', to_stash='stashed'): """ Stash some states. This is an alias for move(), with defaults for the stashes. :param filter_func: Stash states that match this filter. Should be a function that takes a state and returns...
python
def stash(self, filter_func=None, from_stash='active', to_stash='stashed'): """ Stash some states. This is an alias for move(), with defaults for the stashes. :param filter_func: Stash states that match this filter. Should be a function that takes a state and returns...
[ "def", "stash", "(", "self", ",", "filter_func", "=", "None", ",", "from_stash", "=", "'active'", ",", "to_stash", "=", "'stashed'", ")", ":", "return", "self", ".", "move", "(", "from_stash", ",", "to_stash", ",", "filter_func", "=", "filter_func", ")" ]
Stash some states. This is an alias for move(), with defaults for the stashes. :param filter_func: Stash states that match this filter. Should be a function that takes a state and returns True or False. (default: stash all states) :param from_stash: Take matching states fro...
[ "Stash", "some", "states", ".", "This", "is", "an", "alias", "for", "move", "()", "with", "defaults", "for", "the", "stashes", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L477-L489
train
angr/angr
angr/sim_manager.py
SimulationManager.unstash
def unstash(self, filter_func=None, to_stash='active', from_stash='stashed'): """ Unstash some states. This is an alias for move(), with defaults for the stashes. :param filter_func: Unstash states that match this filter. Should be a function that takes a state and r...
python
def unstash(self, filter_func=None, to_stash='active', from_stash='stashed'): """ Unstash some states. This is an alias for move(), with defaults for the stashes. :param filter_func: Unstash states that match this filter. Should be a function that takes a state and r...
[ "def", "unstash", "(", "self", ",", "filter_func", "=", "None", ",", "to_stash", "=", "'active'", ",", "from_stash", "=", "'stashed'", ")", ":", "return", "self", ".", "move", "(", "from_stash", ",", "to_stash", ",", "filter_func", "=", "filter_func", ")" ...
Unstash some states. This is an alias for move(), with defaults for the stashes. :param filter_func: Unstash states that match this filter. Should be a function that takes a state and returns True or False. (default: unstash all states) :param from_stash: take matching stat...
[ "Unstash", "some", "states", ".", "This", "is", "an", "alias", "for", "move", "()", "with", "defaults", "for", "the", "stashes", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L491-L503
train
angr/angr
angr/sim_manager.py
SimulationManager.drop
def drop(self, filter_func=None, stash='active'): """ Drops states from a stash. This is an alias for move(), with defaults for the stashes. :param filter_func: Drop states that match this filter. Should be a function that takes a state and returns True or False. (de...
python
def drop(self, filter_func=None, stash='active'): """ Drops states from a stash. This is an alias for move(), with defaults for the stashes. :param filter_func: Drop states that match this filter. Should be a function that takes a state and returns True or False. (de...
[ "def", "drop", "(", "self", ",", "filter_func", "=", "None", ",", "stash", "=", "'active'", ")", ":", "return", "self", ".", "move", "(", "stash", ",", "self", ".", "DROP", ",", "filter_func", "=", "filter_func", ")" ]
Drops states from a stash. This is an alias for move(), with defaults for the stashes. :param filter_func: Drop states that match this filter. Should be a function that takes a state and returns True or False. (default: drop all states) :param stash: Drop matching stat...
[ "Drops", "states", "from", "a", "stash", ".", "This", "is", "an", "alias", "for", "move", "()", "with", "defaults", "for", "the", "stashes", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L505-L516
train
angr/angr
angr/sim_manager.py
SimulationManager.apply
def apply(self, state_func=None, stash_func=None, stash='active', to_stash=None): """ Applies a given function to a given stash. :param state_func: A function to apply to every state. Should take a state and return a state. The returned state will take the place of ...
python
def apply(self, state_func=None, stash_func=None, stash='active', to_stash=None): """ Applies a given function to a given stash. :param state_func: A function to apply to every state. Should take a state and return a state. The returned state will take the place of ...
[ "def", "apply", "(", "self", ",", "state_func", "=", "None", ",", "stash_func", "=", "None", ",", "stash", "=", "'active'", ",", "to_stash", "=", "None", ")", ":", "to_stash", "=", "to_stash", "or", "stash", "def", "_stash_splitter", "(", "states", ")", ...
Applies a given function to a given stash. :param state_func: A function to apply to every state. Should take a state and return a state. The returned state will take the place of the old state. If the function *doesn't* return a state, the old state wil...
[ "Applies", "a", "given", "function", "to", "a", "given", "stash", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L518-L555
train
angr/angr
angr/sim_manager.py
SimulationManager.split
def split(self, stash_splitter=None, stash_ranker=None, state_ranker=None, limit=8, from_stash='active', to_stash='stashed'): """ Split a stash of states into two stashes depending on the specified options. The stash from_stash will be split into two stashes depending on the other...
python
def split(self, stash_splitter=None, stash_ranker=None, state_ranker=None, limit=8, from_stash='active', to_stash='stashed'): """ Split a stash of states into two stashes depending on the specified options. The stash from_stash will be split into two stashes depending on the other...
[ "def", "split", "(", "self", ",", "stash_splitter", "=", "None", ",", "stash_ranker", "=", "None", ",", "state_ranker", "=", "None", ",", "limit", "=", "8", ",", "from_stash", "=", "'active'", ",", "to_stash", "=", "'stashed'", ")", ":", "states", "=", ...
Split a stash of states into two stashes depending on the specified options. The stash from_stash will be split into two stashes depending on the other options passed in. If to_stash is provided, the second stash will be written there. stash_splitter overrides stash_ranker, which in turn overr...
[ "Split", "a", "stash", "of", "states", "into", "two", "stashes", "depending", "on", "the", "specified", "options", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L557-L602
train
angr/angr
angr/sim_manager.py
SimulationManager.merge
def merge(self, merge_func=None, merge_key=None, stash='active'): """ Merge the states in a given stash. :param stash: The stash (default: 'active') :param merge_func: If provided, instead of using state.merge, call this function with the states as the...
python
def merge(self, merge_func=None, merge_key=None, stash='active'): """ Merge the states in a given stash. :param stash: The stash (default: 'active') :param merge_func: If provided, instead of using state.merge, call this function with the states as the...
[ "def", "merge", "(", "self", ",", "merge_func", "=", "None", ",", "merge_key", "=", "None", ",", "stash", "=", "'active'", ")", ":", "self", ".", "prune", "(", "from_stash", "=", "stash", ")", "to_merge", "=", "self", ".", "_fetch_states", "(", "stash"...
Merge the states in a given stash. :param stash: The stash (default: 'active') :param merge_func: If provided, instead of using state.merge, call this function with the states as the argument. Should return the merged state. :param merge_key: If provided, sh...
[ "Merge", "the", "states", "in", "a", "given", "stash", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L610-L648
train
angr/angr
angr/sim_manager.py
SimulationManager._merge_states
def _merge_states(self, states): """ Merges a list of states. :param states: the states to merge :returns SimState: the resulting state """ if self._hierarchy: optimal, common_history, others = self._hierarchy.most_mergeable(states) else: ...
python
def _merge_states(self, states): """ Merges a list of states. :param states: the states to merge :returns SimState: the resulting state """ if self._hierarchy: optimal, common_history, others = self._hierarchy.most_mergeable(states) else: ...
[ "def", "_merge_states", "(", "self", ",", "states", ")", ":", "if", "self", ".", "_hierarchy", ":", "optimal", ",", "common_history", ",", "others", "=", "self", ".", "_hierarchy", ".", "most_mergeable", "(", "states", ")", "else", ":", "optimal", ",", "...
Merges a list of states. :param states: the states to merge :returns SimState: the resulting state
[ "Merges", "a", "list", "of", "states", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L684-L726
train
angr/angr
angr/sim_manager.py
ErrorRecord.debug
def debug(self): """ Launch a postmortem debug shell at the site of the error. """ try: __import__('ipdb').post_mortem(self.traceback) except ImportError: __import__('pdb').post_mortem(self.traceback)
python
def debug(self): """ Launch a postmortem debug shell at the site of the error. """ try: __import__('ipdb').post_mortem(self.traceback) except ImportError: __import__('pdb').post_mortem(self.traceback)
[ "def", "debug", "(", "self", ")", ":", "try", ":", "__import__", "(", "'ipdb'", ")", ".", "post_mortem", "(", "self", ".", "traceback", ")", "except", "ImportError", ":", "__import__", "(", "'pdb'", ")", ".", "post_mortem", "(", "self", ".", "traceback",...
Launch a postmortem debug shell at the site of the error.
[ "Launch", "a", "postmortem", "debug", "shell", "at", "the", "site", "of", "the", "error", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L787-L794
train
angr/angr
angr/sim_variable.py
SimVariableSet.complement
def complement(self, other): """ Calculate the complement of `self` and `other`. :param other: Another SimVariableSet instance. :return: The complement result. """ s = SimVariableSet() s.register_variables = self.register_variables - other.register_vari...
python
def complement(self, other): """ Calculate the complement of `self` and `other`. :param other: Another SimVariableSet instance. :return: The complement result. """ s = SimVariableSet() s.register_variables = self.register_variables - other.register_vari...
[ "def", "complement", "(", "self", ",", "other", ")", ":", "s", "=", "SimVariableSet", "(", ")", "s", ".", "register_variables", "=", "self", ".", "register_variables", "-", "other", ".", "register_variables", "s", ".", "register_variable_offsets", "=", "self",...
Calculate the complement of `self` and `other`. :param other: Another SimVariableSet instance. :return: The complement result.
[ "Calculate", "the", "complement", "of", "self", "and", "other", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_variable.py#L314-L328
train
angr/angr
angr/exploration_techniques/director.py
BaseGoal._get_cfg_node
def _get_cfg_node(cfg, state): """ Get the CFGNode object on the control flow graph given an angr state. :param angr.analyses.CFGEmulated cfg: An instance of CFGEmulated. :param angr.SimState state: The current state. :return: A CFGNode instance if the node exists,...
python
def _get_cfg_node(cfg, state): """ Get the CFGNode object on the control flow graph given an angr state. :param angr.analyses.CFGEmulated cfg: An instance of CFGEmulated. :param angr.SimState state: The current state. :return: A CFGNode instance if the node exists,...
[ "def", "_get_cfg_node", "(", "cfg", ",", "state", ")", ":", "call_stack_suffix", "=", "state", ".", "callstack", ".", "stack_suffix", "(", "cfg", ".", "context_sensitivity_level", ")", "is_syscall", "=", "state", ".", "history", ".", "jumpkind", "is", "not", ...
Get the CFGNode object on the control flow graph given an angr state. :param angr.analyses.CFGEmulated cfg: An instance of CFGEmulated. :param angr.SimState state: The current state. :return: A CFGNode instance if the node exists, or None if the node cannot be found. :rtyp...
[ "Get", "the", "CFGNode", "object", "on", "the", "control", "flow", "graph", "given", "an", "angr", "state", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/director.py#L61-L76
train
angr/angr
angr/exploration_techniques/director.py
BaseGoal._dfs_edges
def _dfs_edges(graph, source, max_steps=None): """ Perform a depth-first search on the given DiGraph, with a limit on maximum steps. :param networkx.DiGraph graph: The graph to traverse. :param Any source: The source to begin traversal. :param int max_steps: ...
python
def _dfs_edges(graph, source, max_steps=None): """ Perform a depth-first search on the given DiGraph, with a limit on maximum steps. :param networkx.DiGraph graph: The graph to traverse. :param Any source: The source to begin traversal. :param int max_steps: ...
[ "def", "_dfs_edges", "(", "graph", ",", "source", ",", "max_steps", "=", "None", ")", ":", "if", "max_steps", "is", "None", ":", "yield", "networkx", ".", "dfs_edges", "(", "graph", ",", "source", ")", "else", ":", "steps_map", "=", "defaultdict", "(", ...
Perform a depth-first search on the given DiGraph, with a limit on maximum steps. :param networkx.DiGraph graph: The graph to traverse. :param Any source: The source to begin traversal. :param int max_steps: Maximum steps of the traversal, or None if not limiting steps. ...
[ "Perform", "a", "depth", "-", "first", "search", "on", "the", "given", "DiGraph", "with", "a", "limit", "on", "maximum", "steps", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/director.py#L79-L112
train
angr/angr
angr/exploration_techniques/director.py
ExecuteAddressGoal.check
def check(self, cfg, state, peek_blocks): """ Check if the specified address will be executed :param cfg: :param state: :param int peek_blocks: :return: :rtype: bool """ # Get the current CFGNode from the CFG node = self._get_cfg_node(cfg...
python
def check(self, cfg, state, peek_blocks): """ Check if the specified address will be executed :param cfg: :param state: :param int peek_blocks: :return: :rtype: bool """ # Get the current CFGNode from the CFG node = self._get_cfg_node(cfg...
[ "def", "check", "(", "self", ",", "cfg", ",", "state", ",", "peek_blocks", ")", ":", "# Get the current CFGNode from the CFG", "node", "=", "self", ".", "_get_cfg_node", "(", "cfg", ",", "state", ")", "if", "node", "is", "None", ":", "# Umm it doesn't exist on...
Check if the specified address will be executed :param cfg: :param state: :param int peek_blocks: :return: :rtype: bool
[ "Check", "if", "the", "specified", "address", "will", "be", "executed" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/director.py#L128-L154
train
angr/angr
angr/exploration_techniques/director.py
CallFunctionGoal.check
def check(self, cfg, state, peek_blocks): """ Check if the specified function will be reached with certain arguments. :param cfg: :param state: :param peek_blocks: :return: """ # Get the current CFGNode node = self._get_cfg_node(cfg, state) ...
python
def check(self, cfg, state, peek_blocks): """ Check if the specified function will be reached with certain arguments. :param cfg: :param state: :param peek_blocks: :return: """ # Get the current CFGNode node = self._get_cfg_node(cfg, state) ...
[ "def", "check", "(", "self", ",", "cfg", ",", "state", ",", "peek_blocks", ")", ":", "# Get the current CFGNode", "node", "=", "self", ".", "_get_cfg_node", "(", "cfg", ",", "state", ")", "if", "node", "is", "None", ":", "l", ".", "error", "(", "\"Fail...
Check if the specified function will be reached with certain arguments. :param cfg: :param state: :param peek_blocks: :return:
[ "Check", "if", "the", "specified", "function", "will", "be", "reached", "with", "certain", "arguments", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/director.py#L206-L247
train
angr/angr
angr/exploration_techniques/director.py
CallFunctionGoal.check_state
def check_state(self, state): """ Check if the specific function is reached with certain arguments :param angr.SimState state: The state to check :return: True if the function is reached with certain arguments, False otherwise. :rtype: bool """ if state.addr == ...
python
def check_state(self, state): """ Check if the specific function is reached with certain arguments :param angr.SimState state: The state to check :return: True if the function is reached with certain arguments, False otherwise. :rtype: bool """ if state.addr == ...
[ "def", "check_state", "(", "self", ",", "state", ")", ":", "if", "state", ".", "addr", "==", "self", ".", "function", ".", "addr", ":", "arch", "=", "state", ".", "arch", "if", "self", ".", "_check_arguments", "(", "arch", ",", "state", ")", ":", "...
Check if the specific function is reached with certain arguments :param angr.SimState state: The state to check :return: True if the function is reached with certain arguments, False otherwise. :rtype: bool
[ "Check", "if", "the", "specific", "function", "is", "reached", "with", "certain", "arguments" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/director.py#L249-L263
train
angr/angr
angr/exploration_techniques/director.py
Director._peek_forward
def _peek_forward(self, simgr): """ Make sure all current basic block on each state shows up in the CFG. For blocks that are not in the CFG, start CFG recovery from them with a maximum basic block depth of 100. :param simgr: :return: """ if self._cfg is None: ...
python
def _peek_forward(self, simgr): """ Make sure all current basic block on each state shows up in the CFG. For blocks that are not in the CFG, start CFG recovery from them with a maximum basic block depth of 100. :param simgr: :return: """ if self._cfg is None: ...
[ "def", "_peek_forward", "(", "self", ",", "simgr", ")", ":", "if", "self", ".", "_cfg", "is", "None", ":", "starts", "=", "list", "(", "simgr", ".", "active", ")", "self", ".", "_cfg_kb", "=", "KnowledgeBase", "(", "self", ".", "project", ")", "self"...
Make sure all current basic block on each state shows up in the CFG. For blocks that are not in the CFG, start CFG recovery from them with a maximum basic block depth of 100. :param simgr: :return:
[ "Make", "sure", "all", "current", "basic", "block", "on", "each", "state", "shows", "up", "in", "the", "CFG", ".", "For", "blocks", "that", "are", "not", "in", "the", "CFG", "start", "CFG", "recovery", "from", "them", "with", "a", "maximum", "basic", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/director.py#L434-L456
train
angr/angr
angr/exploration_techniques/director.py
Director._load_fallback_states
def _load_fallback_states(self, pg): """ Load the last N deprioritized states will be extracted from the "deprioritized" stash and put to "active" stash. N is controlled by 'num_fallback_states'. :param SimulationManager pg: The simulation manager. :return: None """ ...
python
def _load_fallback_states(self, pg): """ Load the last N deprioritized states will be extracted from the "deprioritized" stash and put to "active" stash. N is controlled by 'num_fallback_states'. :param SimulationManager pg: The simulation manager. :return: None """ ...
[ "def", "_load_fallback_states", "(", "self", ",", "pg", ")", ":", "# take back some of the deprioritized states", "l", ".", "debug", "(", "\"No more active states. Load some deprioritized states to 'active' stash.\"", ")", "if", "'deprioritized'", "in", "pg", ".", "stashes", ...
Load the last N deprioritized states will be extracted from the "deprioritized" stash and put to "active" stash. N is controlled by 'num_fallback_states'. :param SimulationManager pg: The simulation manager. :return: None
[ "Load", "the", "last", "N", "deprioritized", "states", "will", "be", "extracted", "from", "the", "deprioritized", "stash", "and", "put", "to", "active", "stash", ".", "N", "is", "controlled", "by", "num_fallback_states", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/director.py#L458-L471
train
angr/angr
angr/exploration_techniques/director.py
Director._categorize_states
def _categorize_states(self, simgr): """ Categorize all states into two different groups: reaching the destination within the peek depth, and not reaching the destination within the peek depth. :param SimulationManager simgr: The simulation manager that contains states. All active st...
python
def _categorize_states(self, simgr): """ Categorize all states into two different groups: reaching the destination within the peek depth, and not reaching the destination within the peek depth. :param SimulationManager simgr: The simulation manager that contains states. All active st...
[ "def", "_categorize_states", "(", "self", ",", "simgr", ")", ":", "past_active_states", "=", "len", "(", "simgr", ".", "active", ")", "# past_deprioritized_states = len(simgr.deprioritized)", "for", "goal", "in", "self", ".", "_goals", ":", "for", "p", "in", "si...
Categorize all states into two different groups: reaching the destination within the peek depth, and not reaching the destination within the peek depth. :param SimulationManager simgr: The simulation manager that contains states. All active states (state belonging to "active" stash) ...
[ "Categorize", "all", "states", "into", "two", "different", "groups", ":", "reaching", "the", "destination", "within", "the", "peek", "depth", "and", "not", "reaching", "the", "destination", "within", "the", "peek", "depth", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/director.py#L473-L510
train
angr/angr
angr/analyses/code_tagging.py
CodeTagging.has_xor
def has_xor(self): """ Detects if there is any xor operation in the function. :return: Tags """ def _has_xor(expr): return isinstance(expr, pyvex.IRExpr.Binop) and expr.op.startswith("Iop_Xor") found_xor = False for block in self._function.blocks: ...
python
def has_xor(self): """ Detects if there is any xor operation in the function. :return: Tags """ def _has_xor(expr): return isinstance(expr, pyvex.IRExpr.Binop) and expr.op.startswith("Iop_Xor") found_xor = False for block in self._function.blocks: ...
[ "def", "has_xor", "(", "self", ")", ":", "def", "_has_xor", "(", "expr", ")", ":", "return", "isinstance", "(", "expr", ",", "pyvex", ".", "IRExpr", ".", "Binop", ")", "and", "expr", ".", "op", ".", "startswith", "(", "\"Iop_Xor\"", ")", "found_xor", ...
Detects if there is any xor operation in the function. :return: Tags
[ "Detects", "if", "there", "is", "any", "xor", "operation", "in", "the", "function", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/code_tagging.py#L36-L61
train
angr/angr
angr/analyses/code_tagging.py
CodeTagging.has_bitshifts
def has_bitshifts(self): """ Detects if there is any bitwise operation in the function. :return: Tags. """ def _has_bitshifts(expr): if isinstance(expr, pyvex.IRExpr.Binop): return expr.op.startswith("Iop_Shl") or expr.op.startswith("Iop_Shr") \ ...
python
def has_bitshifts(self): """ Detects if there is any bitwise operation in the function. :return: Tags. """ def _has_bitshifts(expr): if isinstance(expr, pyvex.IRExpr.Binop): return expr.op.startswith("Iop_Shl") or expr.op.startswith("Iop_Shr") \ ...
[ "def", "has_bitshifts", "(", "self", ")", ":", "def", "_has_bitshifts", "(", "expr", ")", ":", "if", "isinstance", "(", "expr", ",", "pyvex", ".", "IRExpr", ".", "Binop", ")", ":", "return", "expr", ".", "op", ".", "startswith", "(", "\"Iop_Shl\"", ")"...
Detects if there is any bitwise operation in the function. :return: Tags.
[ "Detects", "if", "there", "is", "any", "bitwise", "operation", "in", "the", "function", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/code_tagging.py#L63-L92
train
angr/angr
angr/keyed_region.py
KeyedRegion.merge
def merge(self, other, replacements=None): """ Merge another KeyedRegion into this KeyedRegion. :param KeyedRegion other: The other instance to merge with. :return: None """ # TODO: is the current solution not optimal enough? for _, item in other._storage.items(...
python
def merge(self, other, replacements=None): """ Merge another KeyedRegion into this KeyedRegion. :param KeyedRegion other: The other instance to merge with. :return: None """ # TODO: is the current solution not optimal enough? for _, item in other._storage.items(...
[ "def", "merge", "(", "self", ",", "other", ",", "replacements", "=", "None", ")", ":", "# TODO: is the current solution not optimal enough?", "for", "_", ",", "item", "in", "other", ".", "_storage", ".", "items", "(", ")", ":", "# type: RegionObject", "for", "...
Merge another KeyedRegion into this KeyedRegion. :param KeyedRegion other: The other instance to merge with. :return: None
[ "Merge", "another", "KeyedRegion", "into", "this", "KeyedRegion", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/keyed_region.py#L172-L188
train
angr/angr
angr/keyed_region.py
KeyedRegion.replace
def replace(self, replacements): """ Replace variables with other variables. :param dict replacements: A dict of variable replacements. :return: self """ for old_var, new_var in replacements.items(): old_var_id = id(old_var) ...
python
def replace(self, replacements): """ Replace variables with other variables. :param dict replacements: A dict of variable replacements. :return: self """ for old_var, new_var in replacements.items(): old_var_id = id(old_var) ...
[ "def", "replace", "(", "self", ",", "replacements", ")", ":", "for", "old_var", ",", "new_var", "in", "replacements", ".", "items", "(", ")", ":", "old_var_id", "=", "id", "(", "old_var", ")", "if", "old_var_id", "in", "self", ".", "_object_mapping", ":"...
Replace variables with other variables. :param dict replacements: A dict of variable replacements. :return: self
[ "Replace", "variables", "with", "other", "variables", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/keyed_region.py#L190-L205
train
angr/angr
angr/keyed_region.py
KeyedRegion.dbg_repr
def dbg_repr(self): """ Get a debugging representation of this keyed region. :return: A string of debugging output. """ keys = self._storage.keys() offset_to_vars = { } for key in sorted(keys): ro = self._storage[key] variables = [ obj.obj...
python
def dbg_repr(self): """ Get a debugging representation of this keyed region. :return: A string of debugging output. """ keys = self._storage.keys() offset_to_vars = { } for key in sorted(keys): ro = self._storage[key] variables = [ obj.obj...
[ "def", "dbg_repr", "(", "self", ")", ":", "keys", "=", "self", ".", "_storage", ".", "keys", "(", ")", "offset_to_vars", "=", "{", "}", "for", "key", "in", "sorted", "(", "keys", ")", ":", "ro", "=", "self", ".", "_storage", "[", "key", "]", "var...
Get a debugging representation of this keyed region. :return: A string of debugging output.
[ "Get", "a", "debugging", "representation", "of", "this", "keyed", "region", ".", ":", "return", ":", "A", "string", "of", "debugging", "output", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/keyed_region.py#L207-L223
train
angr/angr
angr/keyed_region.py
KeyedRegion.add_variable
def add_variable(self, start, variable): """ Add a variable to this region at the given offset. :param int start: :param SimVariable variable: :return: None """ size = variable.size if variable.size is not None else 1 self.add_object(start, variable, si...
python
def add_variable(self, start, variable): """ Add a variable to this region at the given offset. :param int start: :param SimVariable variable: :return: None """ size = variable.size if variable.size is not None else 1 self.add_object(start, variable, si...
[ "def", "add_variable", "(", "self", ",", "start", ",", "variable", ")", ":", "size", "=", "variable", ".", "size", "if", "variable", ".", "size", "is", "not", "None", "else", "1", "self", ".", "add_object", "(", "start", ",", "variable", ",", "size", ...
Add a variable to this region at the given offset. :param int start: :param SimVariable variable: :return: None
[ "Add", "a", "variable", "to", "this", "region", "at", "the", "given", "offset", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/keyed_region.py#L225-L236
train
angr/angr
angr/keyed_region.py
KeyedRegion.add_object
def add_object(self, start, obj, object_size): """ Add/Store an object to this region at the given offset. :param start: :param obj: :param int object_size: Size of the object :return: """ self._store(start, obj, object_size, overwrite=False)
python
def add_object(self, start, obj, object_size): """ Add/Store an object to this region at the given offset. :param start: :param obj: :param int object_size: Size of the object :return: """ self._store(start, obj, object_size, overwrite=False)
[ "def", "add_object", "(", "self", ",", "start", ",", "obj", ",", "object_size", ")", ":", "self", ".", "_store", "(", "start", ",", "obj", ",", "object_size", ",", "overwrite", "=", "False", ")" ]
Add/Store an object to this region at the given offset. :param start: :param obj: :param int object_size: Size of the object :return:
[ "Add", "/", "Store", "an", "object", "to", "this", "region", "at", "the", "given", "offset", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/keyed_region.py#L238-L248
train
angr/angr
angr/keyed_region.py
KeyedRegion.set_variable
def set_variable(self, start, variable): """ Add a variable to this region at the given offset, and remove all other variables that are fully covered by this variable. :param int start: :param SimVariable variable: :return: None """ size = variable.size ...
python
def set_variable(self, start, variable): """ Add a variable to this region at the given offset, and remove all other variables that are fully covered by this variable. :param int start: :param SimVariable variable: :return: None """ size = variable.size ...
[ "def", "set_variable", "(", "self", ",", "start", ",", "variable", ")", ":", "size", "=", "variable", ".", "size", "if", "variable", ".", "size", "is", "not", "None", "else", "1", "self", ".", "set_object", "(", "start", ",", "variable", ",", "size", ...
Add a variable to this region at the given offset, and remove all other variables that are fully covered by this variable. :param int start: :param SimVariable variable: :return: None
[ "Add", "a", "variable", "to", "this", "region", "at", "the", "given", "offset", "and", "remove", "all", "other", "variables", "that", "are", "fully", "covered", "by", "this", "variable", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/keyed_region.py#L250-L262
train
angr/angr
angr/keyed_region.py
KeyedRegion.set_object
def set_object(self, start, obj, object_size): """ Add an object to this region at the given offset, and remove all other objects that are fully covered by this object. :param start: :param obj: :param object_size: :return: """ self._store(start,...
python
def set_object(self, start, obj, object_size): """ Add an object to this region at the given offset, and remove all other objects that are fully covered by this object. :param start: :param obj: :param object_size: :return: """ self._store(start,...
[ "def", "set_object", "(", "self", ",", "start", ",", "obj", ",", "object_size", ")", ":", "self", ".", "_store", "(", "start", ",", "obj", ",", "object_size", ",", "overwrite", "=", "True", ")" ]
Add an object to this region at the given offset, and remove all other objects that are fully covered by this object. :param start: :param obj: :param object_size: :return:
[ "Add", "an", "object", "to", "this", "region", "at", "the", "given", "offset", "and", "remove", "all", "other", "objects", "that", "are", "fully", "covered", "by", "this", "object", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/keyed_region.py#L264-L275
train
angr/angr
angr/keyed_region.py
KeyedRegion.get_base_addr
def get_base_addr(self, addr): """ Get the base offset (the key we are using to index objects covering the given offset) of a specific offset. :param int addr: :return: :rtype: int or None """ base_addr, container = self._get_container(addr) if containe...
python
def get_base_addr(self, addr): """ Get the base offset (the key we are using to index objects covering the given offset) of a specific offset. :param int addr: :return: :rtype: int or None """ base_addr, container = self._get_container(addr) if containe...
[ "def", "get_base_addr", "(", "self", ",", "addr", ")", ":", "base_addr", ",", "container", "=", "self", ".", "_get_container", "(", "addr", ")", "if", "container", "is", "None", ":", "return", "None", "else", ":", "return", "base_addr" ]
Get the base offset (the key we are using to index objects covering the given offset) of a specific offset. :param int addr: :return: :rtype: int or None
[ "Get", "the", "base", "offset", "(", "the", "key", "we", "are", "using", "to", "index", "objects", "covering", "the", "given", "offset", ")", "of", "a", "specific", "offset", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/keyed_region.py#L277-L290
train
angr/angr
angr/keyed_region.py
KeyedRegion.get_variables_by_offset
def get_variables_by_offset(self, start): """ Find variables covering the given region offset. :param int start: :return: A list of stack variables. :rtype: set """ _, container = self._get_container(start) if container is None: return [] ...
python
def get_variables_by_offset(self, start): """ Find variables covering the given region offset. :param int start: :return: A list of stack variables. :rtype: set """ _, container = self._get_container(start) if container is None: return [] ...
[ "def", "get_variables_by_offset", "(", "self", ",", "start", ")", ":", "_", ",", "container", "=", "self", ".", "_get_container", "(", "start", ")", "if", "container", "is", "None", ":", "return", "[", "]", "else", ":", "return", "container", ".", "inter...
Find variables covering the given region offset. :param int start: :return: A list of stack variables. :rtype: set
[ "Find", "variables", "covering", "the", "given", "region", "offset", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/keyed_region.py#L292-L305
train
angr/angr
angr/keyed_region.py
KeyedRegion.get_objects_by_offset
def get_objects_by_offset(self, start): """ Find objects covering the given region offset. :param start: :return: """ _, container = self._get_container(start) if container is None: return set() else: return container.internal_obj...
python
def get_objects_by_offset(self, start): """ Find objects covering the given region offset. :param start: :return: """ _, container = self._get_container(start) if container is None: return set() else: return container.internal_obj...
[ "def", "get_objects_by_offset", "(", "self", ",", "start", ")", ":", "_", ",", "container", "=", "self", ".", "_get_container", "(", "start", ")", "if", "container", "is", "None", ":", "return", "set", "(", ")", "else", ":", "return", "container", ".", ...
Find objects covering the given region offset. :param start: :return:
[ "Find", "objects", "covering", "the", "given", "region", "offset", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/keyed_region.py#L307-L319
train
angr/angr
angr/keyed_region.py
KeyedRegion._store
def _store(self, start, obj, size, overwrite=False): """ Store a variable into the storage. :param int start: The beginning address of the variable. :param obj: The object to store. :param int size: Size of the object to store. :param bool overwrite: Whether existing obj...
python
def _store(self, start, obj, size, overwrite=False): """ Store a variable into the storage. :param int start: The beginning address of the variable. :param obj: The object to store. :param int size: Size of the object to store. :param bool overwrite: Whether existing obj...
[ "def", "_store", "(", "self", ",", "start", ",", "obj", ",", "size", ",", "overwrite", "=", "False", ")", ":", "stored_object", "=", "StoredObject", "(", "start", ",", "obj", ",", "size", ")", "self", ".", "_object_mapping", "[", "stored_object", ".", ...
Store a variable into the storage. :param int start: The beginning address of the variable. :param obj: The object to store. :param int size: Size of the object to store. :param bool overwrite: Whether existing objects should be overwritten or not. :return: None
[ "Store", "a", "variable", "into", "the", "storage", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/keyed_region.py#L325-L338
train
angr/angr
angr/keyed_region.py
KeyedRegion.__store
def __store(self, stored_object, overwrite=False): """ Store a variable into the storage. :param StoredObject stored_object: The descriptor describing start address and the variable. :param bool overwrite: Whether existing objects should be overwritten or not. True to make a strong upd...
python
def __store(self, stored_object, overwrite=False): """ Store a variable into the storage. :param StoredObject stored_object: The descriptor describing start address and the variable. :param bool overwrite: Whether existing objects should be overwritten or not. True to make a strong upd...
[ "def", "__store", "(", "self", ",", "stored_object", ",", "overwrite", "=", "False", ")", ":", "start", "=", "stored_object", ".", "start", "object_size", "=", "stored_object", ".", "size", "end", "=", "start", "+", "object_size", "# region items in the middle",...
Store a variable into the storage. :param StoredObject stored_object: The descriptor describing start address and the variable. :param bool overwrite: Whether existing objects should be overwritten or not. True to make a strong update, False to make a weak update. ...
[ "Store", "a", "variable", "into", "the", "storage", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/keyed_region.py#L340-L402
train
angr/angr
angr/analyses/analysis.py
Analysis._initialize_progressbar
def _initialize_progressbar(self): """ Initialize the progressbar. :return: None """ self._progressbar = progressbar.ProgressBar(widgets=Analysis._PROGRESS_WIDGETS, maxval=10000 * 100).start()
python
def _initialize_progressbar(self): """ Initialize the progressbar. :return: None """ self._progressbar = progressbar.ProgressBar(widgets=Analysis._PROGRESS_WIDGETS, maxval=10000 * 100).start()
[ "def", "_initialize_progressbar", "(", "self", ")", ":", "self", ".", "_progressbar", "=", "progressbar", ".", "ProgressBar", "(", "widgets", "=", "Analysis", ".", "_PROGRESS_WIDGETS", ",", "maxval", "=", "10000", "*", "100", ")", ".", "start", "(", ")" ]
Initialize the progressbar. :return: None
[ "Initialize", "the", "progressbar", ".", ":", "return", ":", "None" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/analysis.py#L163-L169
train
angr/angr
angr/analyses/analysis.py
Analysis._update_progress
def _update_progress(self, percentage, **kwargs): """ Update the progress with a percentage, including updating the progressbar as well as calling the progress callback. :param float percentage: Percentage of the progressbar. from 0.0 to 100.0. :param kwargs: Oth...
python
def _update_progress(self, percentage, **kwargs): """ Update the progress with a percentage, including updating the progressbar as well as calling the progress callback. :param float percentage: Percentage of the progressbar. from 0.0 to 100.0. :param kwargs: Oth...
[ "def", "_update_progress", "(", "self", ",", "percentage", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_show_progressbar", ":", "if", "self", ".", "_progressbar", "is", "None", ":", "self", ".", "_initialize_progressbar", "(", ")", "self", ".", ...
Update the progress with a percentage, including updating the progressbar as well as calling the progress callback. :param float percentage: Percentage of the progressbar. from 0.0 to 100.0. :param kwargs: Other parameters that will be passed to the progress_callback handler. ...
[ "Update", "the", "progress", "with", "a", "percentage", "including", "updating", "the", "progressbar", "as", "well", "as", "calling", "the", "progress", "callback", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/analysis.py#L171-L188
train
angr/angr
angr/analyses/analysis.py
Analysis._finish_progress
def _finish_progress(self): """ Mark the progressbar as finished. :return: None """ if self._show_progressbar: if self._progressbar is None: self._initialize_progressbar() if self._progressbar is not None: self._progressbar...
python
def _finish_progress(self): """ Mark the progressbar as finished. :return: None """ if self._show_progressbar: if self._progressbar is None: self._initialize_progressbar() if self._progressbar is not None: self._progressbar...
[ "def", "_finish_progress", "(", "self", ")", ":", "if", "self", ".", "_show_progressbar", ":", "if", "self", ".", "_progressbar", "is", "None", ":", "self", ".", "_initialize_progressbar", "(", ")", "if", "self", ".", "_progressbar", "is", "not", "None", "...
Mark the progressbar as finished. :return: None
[ "Mark", "the", "progressbar", "as", "finished", ".", ":", "return", ":", "None" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/analysis.py#L190-L203
train
angr/angr
angr/analyses/variable_recovery/variable_recovery.py
VariableRecoveryState.merge
def merge(self, other, successor=None): """ Merge two abstract states. :param VariableRecoveryState other: The other abstract state to merge. :return: The merged abstract state. :rtype: VariableRecoveryState """ ...
python
def merge(self, other, successor=None): """ Merge two abstract states. :param VariableRecoveryState other: The other abstract state to merge. :return: The merged abstract state. :rtype: VariableRecoveryState """ ...
[ "def", "merge", "(", "self", ",", "other", ",", "successor", "=", "None", ")", ":", "replacements", "=", "{", "}", "if", "successor", "in", "self", ".", "dominance_frontiers", ":", "replacements", "=", "self", ".", "_make_phi_variables", "(", "successor", ...
Merge two abstract states. :param VariableRecoveryState other: The other abstract state to merge. :return: The merged abstract state. :rtype: VariableRecoveryState
[ "Merge", "two", "abstract", "states", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/variable_recovery/variable_recovery.py#L94-L118
train
angr/angr
angr/analyses/variable_recovery/variable_recovery.py
VariableRecoveryState._addr_to_stack_offset
def _addr_to_stack_offset(self, addr): """ Convert an address to a stack offset. :param claripy.ast.Base addr: The address to convert from. :return: A stack offset if the addr comes from the stack pointer, or None if the address ...
python
def _addr_to_stack_offset(self, addr): """ Convert an address to a stack offset. :param claripy.ast.Base addr: The address to convert from. :return: A stack offset if the addr comes from the stack pointer, or None if the address ...
[ "def", "_addr_to_stack_offset", "(", "self", ",", "addr", ")", ":", "def", "_parse", "(", "addr", ")", ":", "if", "addr", ".", "op", "==", "'__add__'", ":", "# __add__ might have multiple arguments", "parsed", "=", "[", "_parse", "(", "arg", ")", "for", "a...
Convert an address to a stack offset. :param claripy.ast.Base addr: The address to convert from. :return: A stack offset if the addr comes from the stack pointer, or None if the address does not come from the stack pointer.
[ "Convert", "an", "address", "to", "a", "stack", "offset", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/variable_recovery/variable_recovery.py#L325-L372
train
angr/angr
angr/analyses/variable_recovery/variable_recovery.py
VariableRecovery._run_on_node
def _run_on_node(self, node, state): """ Take an input abstract state, execute the node, and derive an output state. :param angr.Block node: The node to work on. :param VariableRecoveryState state: The input state. :return: A tuple of (chan...
python
def _run_on_node(self, node, state): """ Take an input abstract state, execute the node, and derive an output state. :param angr.Block node: The node to work on. :param VariableRecoveryState state: The input state. :return: A tuple of (chan...
[ "def", "_run_on_node", "(", "self", ",", "node", ",", "state", ")", ":", "l", ".", "debug", "(", "'Analyzing block %#x, iteration %d.'", ",", "node", ".", "addr", ",", "self", ".", "_node_iterations", "[", "node", "]", ")", "concrete_state", "=", "state", ...
Take an input abstract state, execute the node, and derive an output state. :param angr.Block node: The node to work on. :param VariableRecoveryState state: The input state. :return: A tuple of (changed, new output state). :rtype: ...
[ "Take", "an", "input", "abstract", "state", "execute", "the", "node", "and", "derive", "an", "output", "state", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/variable_recovery/variable_recovery.py#L451-L493
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._initialize_cfg
def _initialize_cfg(self): """ Re-create the DiGraph """ self.kb.functions = FunctionManager(self.kb) self._jobs_to_analyze_per_function = defaultdict(set) self._completed_functions = set()
python
def _initialize_cfg(self): """ Re-create the DiGraph """ self.kb.functions = FunctionManager(self.kb) self._jobs_to_analyze_per_function = defaultdict(set) self._completed_functions = set()
[ "def", "_initialize_cfg", "(", "self", ")", ":", "self", ".", "kb", ".", "functions", "=", "FunctionManager", "(", "self", ".", "kb", ")", "self", ".", "_jobs_to_analyze_per_function", "=", "defaultdict", "(", "set", ")", "self", ".", "_completed_functions", ...
Re-create the DiGraph
[ "Re", "-", "create", "the", "DiGraph" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L207-L215
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase.make_copy
def make_copy(self, copy_to): """ Copy self attributes to the new object. :param CFGBase copy_to: The target to copy to. :return: None """ for attr, value in self.__dict__.items(): if attr.startswith('__') and attr.endswith('__'): continue ...
python
def make_copy(self, copy_to): """ Copy self attributes to the new object. :param CFGBase copy_to: The target to copy to. :return: None """ for attr, value in self.__dict__.items(): if attr.startswith('__') and attr.endswith('__'): continue ...
[ "def", "make_copy", "(", "self", ",", "copy_to", ")", ":", "for", "attr", ",", "value", "in", "self", ".", "__dict__", ".", "items", "(", ")", ":", "if", "attr", ".", "startswith", "(", "'__'", ")", "and", "attr", ".", "endswith", "(", "'__'", ")",...
Copy self attributes to the new object. :param CFGBase copy_to: The target to copy to. :return: None
[ "Copy", "self", "attributes", "to", "the", "new", "object", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L229-L240
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._merge_cfgnodes
def _merge_cfgnodes(self, cfgnode_0, cfgnode_1): """ Merge two adjacent CFGNodes into one. :param CFGNode cfgnode_0: The first CFGNode. :param CFGNode cfgnode_1: The second CFGNode. :return: None """ assert cfgnode_0.addr + cfgnode_0.size ...
python
def _merge_cfgnodes(self, cfgnode_0, cfgnode_1): """ Merge two adjacent CFGNodes into one. :param CFGNode cfgnode_0: The first CFGNode. :param CFGNode cfgnode_1: The second CFGNode. :return: None """ assert cfgnode_0.addr + cfgnode_0.size ...
[ "def", "_merge_cfgnodes", "(", "self", ",", "cfgnode_0", ",", "cfgnode_1", ")", ":", "assert", "cfgnode_0", ".", "addr", "+", "cfgnode_0", ".", "size", "==", "cfgnode_1", ".", "addr", "addr0", ",", "addr1", "=", "cfgnode_0", ".", "addr", ",", "cfgnode_1", ...
Merge two adjacent CFGNodes into one. :param CFGNode cfgnode_0: The first CFGNode. :param CFGNode cfgnode_1: The second CFGNode. :return: None
[ "Merge", "two", "adjacent", "CFGNodes", "into", "one", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L326-L365
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._to_snippet
def _to_snippet(self, cfg_node=None, addr=None, size=None, thumb=False, jumpkind=None, base_state=None): """ Convert a CFGNode instance to a CodeNode object. :param angr.analyses.CFGNode cfg_node: The CFGNode instance. :param int addr: Address of the node. Only used when `cfg_node` is N...
python
def _to_snippet(self, cfg_node=None, addr=None, size=None, thumb=False, jumpkind=None, base_state=None): """ Convert a CFGNode instance to a CodeNode object. :param angr.analyses.CFGNode cfg_node: The CFGNode instance. :param int addr: Address of the node. Only used when `cfg_node` is N...
[ "def", "_to_snippet", "(", "self", ",", "cfg_node", "=", "None", ",", "addr", "=", "None", ",", "size", "=", "None", ",", "thumb", "=", "False", ",", "jumpkind", "=", "None", ",", "base_state", "=", "None", ")", ":", "if", "cfg_node", "is", "not", ...
Convert a CFGNode instance to a CodeNode object. :param angr.analyses.CFGNode cfg_node: The CFGNode instance. :param int addr: Address of the node. Only used when `cfg_node` is None. :param bool thumb: Whether this is in THUMB mode or not. Only used for ARM code and when `cfg_node` is None. ...
[ "Convert", "a", "CFGNode", "instance", "to", "a", "CodeNode", "object", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L367-L401
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._arm_thumb_filter_jump_successors
def _arm_thumb_filter_jump_successors(self, addr, size, successors, get_ins_addr, get_exit_stmt_idx): """ Filter successors for THUMB mode basic blocks, and remove those successors that won't be taken normally. :param int addr: Address of the basic block / SimIRSB. :param int size: Size...
python
def _arm_thumb_filter_jump_successors(self, addr, size, successors, get_ins_addr, get_exit_stmt_idx): """ Filter successors for THUMB mode basic blocks, and remove those successors that won't be taken normally. :param int addr: Address of the basic block / SimIRSB. :param int size: Size...
[ "def", "_arm_thumb_filter_jump_successors", "(", "self", ",", "addr", ",", "size", ",", "successors", ",", "get_ins_addr", ",", "get_exit_stmt_idx", ")", ":", "if", "not", "successors", ":", "return", "[", "]", "it_counter", "=", "0", "conc_temps", "=", "{", ...
Filter successors for THUMB mode basic blocks, and remove those successors that won't be taken normally. :param int addr: Address of the basic block / SimIRSB. :param int size: Size of the basic block. :param list successors: A list of successors. :param func get_ins_addr: A callable th...
[ "Filter", "successors", "for", "THUMB", "mode", "basic", "blocks", "and", "remove", "those", "successors", "that", "won", "t", "be", "taken", "normally", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L406-L461
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._is_region_extremely_sparse
def _is_region_extremely_sparse(self, start, end, base_state=None): """ Check whether the given memory region is extremely sparse, i.e., all bytes are the same value. :param int start: The beginning of the region. :param int end: The end of the region. :param base_state: The b...
python
def _is_region_extremely_sparse(self, start, end, base_state=None): """ Check whether the given memory region is extremely sparse, i.e., all bytes are the same value. :param int start: The beginning of the region. :param int end: The end of the region. :param base_state: The b...
[ "def", "_is_region_extremely_sparse", "(", "self", ",", "start", ",", "end", ",", "base_state", "=", "None", ")", ":", "all_bytes", "=", "None", "if", "base_state", "is", "not", "None", ":", "all_bytes", "=", "base_state", ".", "memory", ".", "load", "(", ...
Check whether the given memory region is extremely sparse, i.e., all bytes are the same value. :param int start: The beginning of the region. :param int end: The end of the region. :param base_state: The base state (optional). :return: True if the region is extremely sparse,...
[ "Check", "whether", "the", "given", "memory", "region", "is", "extremely", "sparse", "i", ".", "e", ".", "all", "bytes", "are", "the", "same", "value", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L463-L505
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._should_skip_region
def _should_skip_region(self, region_start): """ Some regions usually do not contain any executable code, but are still marked as executable. We should skip those regions by default. :param int region_start: Address of the beginning of the region. :return: True/F...
python
def _should_skip_region(self, region_start): """ Some regions usually do not contain any executable code, but are still marked as executable. We should skip those regions by default. :param int region_start: Address of the beginning of the region. :return: True/F...
[ "def", "_should_skip_region", "(", "self", ",", "region_start", ")", ":", "obj", "=", "self", ".", "project", ".", "loader", ".", "find_object_containing", "(", "region_start", ",", "membership_check", "=", "False", ")", "if", "obj", "is", "None", ":", "retu...
Some regions usually do not contain any executable code, but are still marked as executable. We should skip those regions by default. :param int region_start: Address of the beginning of the region. :return: True/False :rtype: bool
[ "Some", "regions", "usually", "do", "not", "contain", "any", "executable", "code", "but", "are", "still", "marked", "as", "executable", ".", "We", "should", "skip", "those", "regions", "by", "default", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L507-L527
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._executable_memory_regions
def _executable_memory_regions(self, objects=None, force_segment=False): """ Get all executable memory regions from the binaries :param objects: A collection of binary objects to collect regions from. If None, regions from all project binary objects are used. :pa...
python
def _executable_memory_regions(self, objects=None, force_segment=False): """ Get all executable memory regions from the binaries :param objects: A collection of binary objects to collect regions from. If None, regions from all project binary objects are used. :pa...
[ "def", "_executable_memory_regions", "(", "self", ",", "objects", "=", "None", ",", "force_segment", "=", "False", ")", ":", "if", "objects", "is", "None", ":", "binaries", "=", "self", ".", "project", ".", "loader", ".", "all_objects", "else", ":", "binar...
Get all executable memory regions from the binaries :param objects: A collection of binary objects to collect regions from. If None, regions from all project binary objects are used. :param bool force_segment: Rely on binary segments instead of sections. :return: A sorte...
[ "Get", "all", "executable", "memory", "regions", "from", "the", "binaries" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L529-L598
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._addr_in_exec_memory_regions
def _addr_in_exec_memory_regions(self, addr): """ Test if the address belongs to an executable memory region. :param int addr: The address to test :return: True if the address belongs to an exectubale memory region, False otherwise :rtype: bool """ for start, en...
python
def _addr_in_exec_memory_regions(self, addr): """ Test if the address belongs to an executable memory region. :param int addr: The address to test :return: True if the address belongs to an exectubale memory region, False otherwise :rtype: bool """ for start, en...
[ "def", "_addr_in_exec_memory_regions", "(", "self", ",", "addr", ")", ":", "for", "start", ",", "end", "in", "self", ".", "_exec_mem_regions", ":", "if", "start", "<=", "addr", "<", "end", ":", "return", "True", "return", "False" ]
Test if the address belongs to an executable memory region. :param int addr: The address to test :return: True if the address belongs to an exectubale memory region, False otherwise :rtype: bool
[ "Test", "if", "the", "address", "belongs", "to", "an", "executable", "memory", "region", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L600-L612
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._addrs_belong_to_same_section
def _addrs_belong_to_same_section(self, addr_a, addr_b): """ Test if two addresses belong to the same section. :param int addr_a: The first address to test. :param int addr_b: The second address to test. :return: True if the two addresses belong to the same section ...
python
def _addrs_belong_to_same_section(self, addr_a, addr_b): """ Test if two addresses belong to the same section. :param int addr_a: The first address to test. :param int addr_b: The second address to test. :return: True if the two addresses belong to the same section ...
[ "def", "_addrs_belong_to_same_section", "(", "self", ",", "addr_a", ",", "addr_b", ")", ":", "obj", "=", "self", ".", "project", ".", "loader", ".", "find_object_containing", "(", "addr_a", ",", "membership_check", "=", "False", ")", "if", "obj", "is", "None...
Test if two addresses belong to the same section. :param int addr_a: The first address to test. :param int addr_b: The second address to test. :return: True if the two addresses belong to the same section or both of them do not belong to any section, Fal...
[ "Test", "if", "two", "addresses", "belong", "to", "the", "same", "section", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L614-L642
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._addr_hooked_or_syscall
def _addr_hooked_or_syscall(self, addr): """ Check whether the address belongs to a hook or a syscall. :param int addr: The address to check. :return: True if the address is hooked or belongs to a syscall. False otherwise. :rtype: bool """ ...
python
def _addr_hooked_or_syscall(self, addr): """ Check whether the address belongs to a hook or a syscall. :param int addr: The address to check. :return: True if the address is hooked or belongs to a syscall. False otherwise. :rtype: bool """ ...
[ "def", "_addr_hooked_or_syscall", "(", "self", ",", "addr", ")", ":", "return", "self", ".", "project", ".", "is_hooked", "(", "addr", ")", "or", "self", ".", "project", ".", "simos", ".", "is_syscall_addr", "(", "addr", ")" ]
Check whether the address belongs to a hook or a syscall. :param int addr: The address to check. :return: True if the address is hooked or belongs to a syscall. False otherwise. :rtype: bool
[ "Check", "whether", "the", "address", "belongs", "to", "a", "hook", "or", "a", "syscall", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L644-L653
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._fast_memory_load_bytes
def _fast_memory_load_bytes(self, addr, length): """ Perform a fast memory loading of some data. :param int addr: Address to read from. :param int length: Size of the string to load. :return: A string or None if the address does not exist. :rtype: bytes ...
python
def _fast_memory_load_bytes(self, addr, length): """ Perform a fast memory loading of some data. :param int addr: Address to read from. :param int length: Size of the string to load. :return: A string or None if the address does not exist. :rtype: bytes ...
[ "def", "_fast_memory_load_bytes", "(", "self", ",", "addr", ",", "length", ")", ":", "try", ":", "return", "self", ".", "project", ".", "loader", ".", "memory", ".", "load", "(", "addr", ",", "length", ")", "except", "KeyError", ":", "return", "None" ]
Perform a fast memory loading of some data. :param int addr: Address to read from. :param int length: Size of the string to load. :return: A string or None if the address does not exist. :rtype: bytes or None
[ "Perform", "a", "fast", "memory", "loading", "of", "some", "data", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L669-L682
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._fast_memory_load_pointer
def _fast_memory_load_pointer(self, addr, size=None): """ Perform a fast memory loading of a pointer. :param int addr: Address to read from. :param int size: Size of the pointer. Default to machine-word size. :return: A pointer or None if the address does not exist. ...
python
def _fast_memory_load_pointer(self, addr, size=None): """ Perform a fast memory loading of a pointer. :param int addr: Address to read from. :param int size: Size of the pointer. Default to machine-word size. :return: A pointer or None if the address does not exist. ...
[ "def", "_fast_memory_load_pointer", "(", "self", ",", "addr", ",", "size", "=", "None", ")", ":", "try", ":", "return", "self", ".", "project", ".", "loader", ".", "memory", ".", "unpack_word", "(", "addr", ",", "size", "=", "size", ")", "except", "Key...
Perform a fast memory loading of a pointer. :param int addr: Address to read from. :param int size: Size of the pointer. Default to machine-word size. :return: A pointer or None if the address does not exist. :rtype: int
[ "Perform", "a", "fast", "memory", "loading", "of", "a", "pointer", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L684-L697
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._determine_function_returning
def _determine_function_returning(self, func, all_funcs_completed=False): """ Determine if a function returns or not. A function does not return if a) it is a SimProcedure that has NO_RET being True, or b) it is completely recovered (i.e. every block of this function has...
python
def _determine_function_returning(self, func, all_funcs_completed=False): """ Determine if a function returns or not. A function does not return if a) it is a SimProcedure that has NO_RET being True, or b) it is completely recovered (i.e. every block of this function has...
[ "def", "_determine_function_returning", "(", "self", ",", "func", ",", "all_funcs_completed", "=", "False", ")", ":", "# If there is at least one return site, then this function is definitely returning", "if", "func", ".", "has_return", ":", "return", "True", "# Let's first s...
Determine if a function returns or not. A function does not return if a) it is a SimProcedure that has NO_RET being True, or b) it is completely recovered (i.e. every block of this function has been recovered, and no future block will be added to it), and it does not have a r...
[ "Determine", "if", "a", "function", "returns", "or", "not", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L703-L797
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._analyze_function_features
def _analyze_function_features(self, all_funcs_completed=False): """ For each function in the function_manager, try to determine if it returns or not. A function does not return if it calls another function that is known to be not returning, and this function does not have other exits. ...
python
def _analyze_function_features(self, all_funcs_completed=False): """ For each function in the function_manager, try to determine if it returns or not. A function does not return if it calls another function that is known to be not returning, and this function does not have other exits. ...
[ "def", "_analyze_function_features", "(", "self", ",", "all_funcs_completed", "=", "False", ")", ":", "changes", "=", "{", "'functions_return'", ":", "[", "]", ",", "'functions_do_not_return'", ":", "[", "]", "}", "if", "self", ".", "_updated_nonreturning_function...
For each function in the function_manager, try to determine if it returns or not. A function does not return if it calls another function that is known to be not returning, and this function does not have other exits. We might as well analyze other features of functions in the future. :param b...
[ "For", "each", "function", "in", "the", "function_manager", "try", "to", "determine", "if", "it", "returns", "or", "not", ".", "A", "function", "does", "not", "return", "if", "it", "calls", "another", "function", "that", "is", "known", "to", "be", "not", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L799-L857
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._iteratively_analyze_function_features
def _iteratively_analyze_function_features(self, all_funcs_completed=False): """ Iteratively analyze function features until a fixed point is reached. :return: the "changes" dict :rtype: dict """ changes = { 'functions_do_not_return': set(), 'fu...
python
def _iteratively_analyze_function_features(self, all_funcs_completed=False): """ Iteratively analyze function features until a fixed point is reached. :return: the "changes" dict :rtype: dict """ changes = { 'functions_do_not_return': set(), 'fu...
[ "def", "_iteratively_analyze_function_features", "(", "self", ",", "all_funcs_completed", "=", "False", ")", ":", "changes", "=", "{", "'functions_do_not_return'", ":", "set", "(", ")", ",", "'functions_return'", ":", "set", "(", ")", "}", "while", "True", ":", ...
Iteratively analyze function features until a fixed point is reached. :return: the "changes" dict :rtype: dict
[ "Iteratively", "analyze", "function", "features", "until", "a", "fixed", "point", "is", "reached", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L859-L882
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase.normalize
def normalize(self): """ Normalize the CFG, making sure that there are no overlapping basic blocks. Note that this method will not alter transition graphs of each function in self.kb.functions. You may call normalize() on each Function object to normalize their transition graphs. ...
python
def normalize(self): """ Normalize the CFG, making sure that there are no overlapping basic blocks. Note that this method will not alter transition graphs of each function in self.kb.functions. You may call normalize() on each Function object to normalize their transition graphs. ...
[ "def", "normalize", "(", "self", ")", ":", "graph", "=", "self", ".", "graph", "smallest_nodes", "=", "{", "}", "# indexed by end address of the node", "end_addresses_to_nodes", "=", "defaultdict", "(", "set", ")", "for", "n", "in", "graph", ".", "nodes", "(",...
Normalize the CFG, making sure that there are no overlapping basic blocks. Note that this method will not alter transition graphs of each function in self.kb.functions. You may call normalize() on each Function object to normalize their transition graphs. :return: None
[ "Normalize", "the", "CFG", "making", "sure", "that", "there", "are", "no", "overlapping", "basic", "blocks", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L884-L973
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._get_finished_functions
def _get_finished_functions(self): """ Obtain all functions of which we have finished analyzing. As _jobs_to_analyze_per_function is a defaultdict(), if a function address shows up in it with an empty job list, we consider we have exhausted all jobs of this function (both current jobs an...
python
def _get_finished_functions(self): """ Obtain all functions of which we have finished analyzing. As _jobs_to_analyze_per_function is a defaultdict(), if a function address shows up in it with an empty job list, we consider we have exhausted all jobs of this function (both current jobs an...
[ "def", "_get_finished_functions", "(", "self", ")", ":", "finished_func_addrs", "=", "[", "]", "for", "func_addr", ",", "all_jobs", "in", "self", ".", "_jobs_to_analyze_per_function", ".", "items", "(", ")", ":", "if", "not", "all_jobs", ":", "# great! we have f...
Obtain all functions of which we have finished analyzing. As _jobs_to_analyze_per_function is a defaultdict(), if a function address shows up in it with an empty job list, we consider we have exhausted all jobs of this function (both current jobs and pending jobs), thus the analysis of this function is ...
[ "Obtain", "all", "functions", "of", "which", "we", "have", "finished", "analyzing", ".", "As", "_jobs_to_analyze_per_function", "is", "a", "defaultdict", "()", "if", "a", "function", "address", "shows", "up", "in", "it", "with", "an", "empty", "job", "list", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L1110-L1126
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._cleanup_analysis_jobs
def _cleanup_analysis_jobs(self, finished_func_addrs=None): """ From job manager, remove all functions of which we have finished analysis. :param list or None finished_func_addrs: A list of addresses of functions of which we have finished analysis. ...
python
def _cleanup_analysis_jobs(self, finished_func_addrs=None): """ From job manager, remove all functions of which we have finished analysis. :param list or None finished_func_addrs: A list of addresses of functions of which we have finished analysis. ...
[ "def", "_cleanup_analysis_jobs", "(", "self", ",", "finished_func_addrs", "=", "None", ")", ":", "if", "finished_func_addrs", "is", "None", ":", "finished_func_addrs", "=", "self", ".", "_get_finished_functions", "(", ")", "for", "func_addr", "in", "finished_func_ad...
From job manager, remove all functions of which we have finished analysis. :param list or None finished_func_addrs: A list of addresses of functions of which we have finished analysis. A new list of function addresses will be obtained by calling ...
[ "From", "job", "manager", "remove", "all", "functions", "of", "which", "we", "have", "finished", "analysis", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L1128-L1143
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._make_completed_functions
def _make_completed_functions(self): """ Fill in self._completed_functions list and clean up job manager. :return: None """ finished = self._get_finished_functions() for func_addr in finished: self._completed_functions.add(func_addr) self._cleanup_an...
python
def _make_completed_functions(self): """ Fill in self._completed_functions list and clean up job manager. :return: None """ finished = self._get_finished_functions() for func_addr in finished: self._completed_functions.add(func_addr) self._cleanup_an...
[ "def", "_make_completed_functions", "(", "self", ")", ":", "finished", "=", "self", ".", "_get_finished_functions", "(", ")", "for", "func_addr", "in", "finished", ":", "self", ".", "_completed_functions", ".", "add", "(", "func_addr", ")", "self", ".", "_clea...
Fill in self._completed_functions list and clean up job manager. :return: None
[ "Fill", "in", "self", ".", "_completed_functions", "list", "and", "clean", "up", "job", "manager", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L1145-L1155
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase.remove_function_alignments
def remove_function_alignments(self): """ Remove all function alignments. :return: None """ # This function requires Capstone engine support if not self.project.arch.capstone_support: return for func_addr in self.kb.functions.keys(): fun...
python
def remove_function_alignments(self): """ Remove all function alignments. :return: None """ # This function requires Capstone engine support if not self.project.arch.capstone_support: return for func_addr in self.kb.functions.keys(): fun...
[ "def", "remove_function_alignments", "(", "self", ")", ":", "# This function requires Capstone engine support", "if", "not", "self", ".", "project", ".", "arch", ".", "capstone_support", ":", "return", "for", "func_addr", "in", "self", ".", "kb", ".", "functions", ...
Remove all function alignments. :return: None
[ "Remove", "all", "function", "alignments", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L1161-L1183
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase.make_functions
def make_functions(self): """ Revisit the entire control flow graph, create Function instances accordingly, and correctly put blocks into each function. Although Function objects are crated during the CFG recovery, they are neither sound nor accurate. With a pre-constructed CFG,...
python
def make_functions(self): """ Revisit the entire control flow graph, create Function instances accordingly, and correctly put blocks into each function. Although Function objects are crated during the CFG recovery, they are neither sound nor accurate. With a pre-constructed CFG,...
[ "def", "make_functions", "(", "self", ")", ":", "# TODO: Is it required that PLT stubs are always aligned by 16? If so, on what architectures and platforms is it", "# TODO: enforced?", "tmp_functions", "=", "self", ".", "kb", ".", "functions", ".", "copy", "(", ")", "for", "...
Revisit the entire control flow graph, create Function instances accordingly, and correctly put blocks into each function. Although Function objects are crated during the CFG recovery, they are neither sound nor accurate. With a pre-constructed CFG, this method rebuilds all functions bearing th...
[ "Revisit", "the", "entire", "control", "flow", "graph", "create", "Function", "instances", "accordingly", "and", "correctly", "put", "blocks", "into", "each", "function", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L1185-L1320
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._process_irrational_functions
def _process_irrational_functions(self, functions, predetermined_function_addrs, blockaddr_to_function): """ For unresolveable indirect jumps, angr marks those jump targets as individual functions. For example, usually the following pattern is seen: sub_0x400010: push ebp ...
python
def _process_irrational_functions(self, functions, predetermined_function_addrs, blockaddr_to_function): """ For unresolveable indirect jumps, angr marks those jump targets as individual functions. For example, usually the following pattern is seen: sub_0x400010: push ebp ...
[ "def", "_process_irrational_functions", "(", "self", ",", "functions", ",", "predetermined_function_addrs", ",", "blockaddr_to_function", ")", ":", "functions_to_remove", "=", "{", "}", "functions_can_be_removed", "=", "set", "(", "functions", ".", "keys", "(", ")", ...
For unresolveable indirect jumps, angr marks those jump targets as individual functions. For example, usually the following pattern is seen: sub_0x400010: push ebp mov esp, ebp ... cmp eax, 10 ja end mov eax, jumptable[eax] ...
[ "For", "unresolveable", "indirect", "jumps", "angr", "marks", "those", "jump", "targets", "as", "individual", "functions", ".", "For", "example", "usually", "the", "following", "pattern", "is", "seen", ":" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L1322-L1473
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._process_irrational_function_starts
def _process_irrational_function_starts(self, functions, predetermined_function_addrs, blockaddr_to_function): """ Functions that are identified via function prologues can be starting after the actual beginning of the function. For example, the following function (with an incorrect start) might ...
python
def _process_irrational_function_starts(self, functions, predetermined_function_addrs, blockaddr_to_function): """ Functions that are identified via function prologues can be starting after the actual beginning of the function. For example, the following function (with an incorrect start) might ...
[ "def", "_process_irrational_function_starts", "(", "self", ",", "functions", ",", "predetermined_function_addrs", ",", "blockaddr_to_function", ")", ":", "addrs", "=", "sorted", "(", "k", "for", "k", "in", "functions", ".", "keys", "(", ")", "if", "not", "self",...
Functions that are identified via function prologues can be starting after the actual beginning of the function. For example, the following function (with an incorrect start) might exist after a CFG recovery: sub_8049f70: push esi sub_8049f71: sub esp, 0A8h ...
[ "Functions", "that", "are", "identified", "via", "function", "prologues", "can", "be", "starting", "after", "the", "actual", "beginning", "of", "the", "function", ".", "For", "example", "the", "following", "function", "(", "with", "an", "incorrect", "start", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L1475-L1557
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._addr_to_function
def _addr_to_function(self, addr, blockaddr_to_function, known_functions): """ Convert an address to a Function object, and store the mapping in a dict. If the block is known to be part of a function, just return that function. :param int addr: Address to convert :param dict blo...
python
def _addr_to_function(self, addr, blockaddr_to_function, known_functions): """ Convert an address to a Function object, and store the mapping in a dict. If the block is known to be part of a function, just return that function. :param int addr: Address to convert :param dict blo...
[ "def", "_addr_to_function", "(", "self", ",", "addr", ",", "blockaddr_to_function", ",", "known_functions", ")", ":", "if", "addr", "in", "blockaddr_to_function", ":", "f", "=", "blockaddr_to_function", "[", "addr", "]", "else", ":", "is_syscall", "=", "self", ...
Convert an address to a Function object, and store the mapping in a dict. If the block is known to be part of a function, just return that function. :param int addr: Address to convert :param dict blockaddr_to_function: A mapping between block addresses to Function instances. :param ang...
[ "Convert", "an", "address", "to", "a", "Function", "object", "and", "store", "the", "mapping", "in", "a", "dict", ".", "If", "the", "block", "is", "known", "to", "be", "part", "of", "a", "function", "just", "return", "that", "function", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L1559-L1600
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._is_tail_call_optimization
def _is_tail_call_optimization(self, g : networkx.DiGraph, src_addr, dst_addr, src_function, all_edges, known_functions, blockaddr_to_function): """ If source and destination belong to the same function, and the following criteria apply: - source node has only ...
python
def _is_tail_call_optimization(self, g : networkx.DiGraph, src_addr, dst_addr, src_function, all_edges, known_functions, blockaddr_to_function): """ If source and destination belong to the same function, and the following criteria apply: - source node has only ...
[ "def", "_is_tail_call_optimization", "(", "self", ",", "g", ":", "networkx", ".", "DiGraph", ",", "src_addr", ",", "dst_addr", ",", "src_function", ",", "all_edges", ",", "known_functions", ",", "blockaddr_to_function", ")", ":", "def", "_has_more_than_one_exit", ...
If source and destination belong to the same function, and the following criteria apply: - source node has only one default exit - destination is not one of the known functions - destination does not belong to another function, or destination belongs to the same function that source be...
[ "If", "source", "and", "destination", "belong", "to", "the", "same", "function", "and", "the", "following", "criteria", "apply", ":", "-", "source", "node", "has", "only", "one", "default", "exit", "-", "destination", "is", "not", "one", "of", "the", "know...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L1602-L1663
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._graph_bfs_custom
def _graph_bfs_custom(self, g, starts, callback, blockaddr_to_function, known_functions, traversed_cfg_nodes=None): """ A customized control flow graph BFS implementation with the following rules: - Call edges are not followed. - Syscall edges are not followed. :param networkx.D...
python
def _graph_bfs_custom(self, g, starts, callback, blockaddr_to_function, known_functions, traversed_cfg_nodes=None): """ A customized control flow graph BFS implementation with the following rules: - Call edges are not followed. - Syscall edges are not followed. :param networkx.D...
[ "def", "_graph_bfs_custom", "(", "self", ",", "g", ",", "starts", ",", "callback", ",", "blockaddr_to_function", ",", "known_functions", ",", "traversed_cfg_nodes", "=", "None", ")", ":", "stack", "=", "OrderedSet", "(", "starts", ")", "traversed", "=", "set",...
A customized control flow graph BFS implementation with the following rules: - Call edges are not followed. - Syscall edges are not followed. :param networkx.DiGraph g: The graph. :param list starts: A collection of beginning nodes to start graph traversal. :param func callback:...
[ "A", "customized", "control", "flow", "graph", "BFS", "implementation", "with", "the", "following", "rules", ":", "-", "Call", "edges", "are", "not", "followed", ".", "-", "Syscall", "edges", "are", "not", "followed", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L1665-L1709
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._graph_traversal_handler
def _graph_traversal_handler(self, g, src, dst, data, blockaddr_to_function, known_functions, all_edges): """ Graph traversal handler. It takes in a node or an edge, and create new functions or add nodes to existing functions accordingly. Oh, it also create edges on the transition map of functio...
python
def _graph_traversal_handler(self, g, src, dst, data, blockaddr_to_function, known_functions, all_edges): """ Graph traversal handler. It takes in a node or an edge, and create new functions or add nodes to existing functions accordingly. Oh, it also create edges on the transition map of functio...
[ "def", "_graph_traversal_handler", "(", "self", ",", "g", ",", "src", ",", "dst", ",", "data", ",", "blockaddr_to_function", ",", "known_functions", ",", "all_edges", ")", ":", "src_addr", "=", "src", ".", "addr", "src_function", "=", "self", ".", "_addr_to_...
Graph traversal handler. It takes in a node or an edge, and create new functions or add nodes to existing functions accordingly. Oh, it also create edges on the transition map of functions. :param g: The control flow graph that is currently being traversed. :param CFGNode src: Beginni...
[ "Graph", "traversal", "handler", ".", "It", "takes", "in", "a", "node", "or", "an", "edge", "and", "create", "new", "functions", "or", "add", "nodes", "to", "existing", "functions", "accordingly", ".", "Oh", "it", "also", "create", "edges", "on", "the", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L1711-L1922
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._is_noop_block
def _is_noop_block(arch, block): """ Check if the block is a no-op block by checking VEX statements. :param block: The VEX block instance. :return: True if the entire block is a single-byte or multi-byte nop instruction, False otherwise. :rtype: bool """ if arch...
python
def _is_noop_block(arch, block): """ Check if the block is a no-op block by checking VEX statements. :param block: The VEX block instance. :return: True if the entire block is a single-byte or multi-byte nop instruction, False otherwise. :rtype: bool """ if arch...
[ "def", "_is_noop_block", "(", "arch", ",", "block", ")", ":", "if", "arch", ".", "name", "==", "\"MIPS32\"", ":", "if", "arch", ".", "memory_endness", "==", "\"Iend_BE\"", ":", "MIPS32_BE_NOOPS", "=", "{", "b\"\\x00\\x20\\x08\\x25\"", ",", "# move $at, $at", "...
Check if the block is a no-op block by checking VEX statements. :param block: The VEX block instance. :return: True if the entire block is a single-byte or multi-byte nop instruction, False otherwise. :rtype: bool
[ "Check", "if", "the", "block", "is", "a", "no", "-", "op", "block", "by", "checking", "VEX", "statements", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L1929-L1952
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._is_noop_insn
def _is_noop_insn(insn): """ Check if the instruction does nothing. :param insn: The capstone insn object. :return: True if the instruction does no-op, False otherwise. """ if insn.insn_name() == 'nop': # nops return True if insn.insn_nam...
python
def _is_noop_insn(insn): """ Check if the instruction does nothing. :param insn: The capstone insn object. :return: True if the instruction does no-op, False otherwise. """ if insn.insn_name() == 'nop': # nops return True if insn.insn_nam...
[ "def", "_is_noop_insn", "(", "insn", ")", ":", "if", "insn", ".", "insn_name", "(", ")", "==", "'nop'", ":", "# nops", "return", "True", "if", "insn", ".", "insn_name", "(", ")", "==", "'lea'", ":", "# lea reg, [reg + 0]", "op0", ",", "op1", "=", "insn...
Check if the instruction does nothing. :param insn: The capstone insn object. :return: True if the instruction does no-op, False otherwise.
[ "Check", "if", "the", "instruction", "does", "nothing", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L1955-L1976
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._get_nop_length
def _get_nop_length(cls, insns): """ Calculate the total size of leading nop instructions. :param insns: A list of capstone insn objects. :return: Number of bytes of leading nop instructions. :rtype: int """ nop_length = 0 if insns and cls._is_noop_insn...
python
def _get_nop_length(cls, insns): """ Calculate the total size of leading nop instructions. :param insns: A list of capstone insn objects. :return: Number of bytes of leading nop instructions. :rtype: int """ nop_length = 0 if insns and cls._is_noop_insn...
[ "def", "_get_nop_length", "(", "cls", ",", "insns", ")", ":", "nop_length", "=", "0", "if", "insns", "and", "cls", ".", "_is_noop_insn", "(", "insns", "[", "0", "]", ")", ":", "# see where those nop instructions terminate", "for", "insn", "in", "insns", ":",...
Calculate the total size of leading nop instructions. :param insns: A list of capstone insn objects. :return: Number of bytes of leading nop instructions. :rtype: int
[ "Calculate", "the", "total", "size", "of", "leading", "nop", "instructions", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L1979-L1998
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._lift
def _lift(self, *args, **kwargs): """ Lift a basic block of code. Will use the base state as a source of bytes if possible. """ if 'backup_state' not in kwargs: kwargs['backup_state'] = self._base_state return self.project.factory.block(*args, **kwargs)
python
def _lift(self, *args, **kwargs): """ Lift a basic block of code. Will use the base state as a source of bytes if possible. """ if 'backup_state' not in kwargs: kwargs['backup_state'] = self._base_state return self.project.factory.block(*args, **kwargs)
[ "def", "_lift", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'backup_state'", "not", "in", "kwargs", ":", "kwargs", "[", "'backup_state'", "]", "=", "self", ".", "_base_state", "return", "self", ".", "project", ".", "factory...
Lift a basic block of code. Will use the base state as a source of bytes if possible.
[ "Lift", "a", "basic", "block", "of", "code", ".", "Will", "use", "the", "base", "state", "as", "a", "source", "of", "bytes", "if", "possible", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L2015-L2021
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._resolve_indirect_jump_timelessly
def _resolve_indirect_jump_timelessly(self, addr, block, func_addr, jumpkind): """ Checks if MIPS32 and calls MIPS32 check, otherwise false :param int addr: irsb address :param pyvex.IRSB block: irsb :param int func_addr: Function address :return: If it was resolved and ...
python
def _resolve_indirect_jump_timelessly(self, addr, block, func_addr, jumpkind): """ Checks if MIPS32 and calls MIPS32 check, otherwise false :param int addr: irsb address :param pyvex.IRSB block: irsb :param int func_addr: Function address :return: If it was resolved and ...
[ "def", "_resolve_indirect_jump_timelessly", "(", "self", ",", "addr", ",", "block", ",", "func_addr", ",", "jumpkind", ")", ":", "if", "block", ".", "statements", "is", "None", ":", "block", "=", "self", ".", "project", ".", "factory", ".", "block", "(", ...
Checks if MIPS32 and calls MIPS32 check, otherwise false :param int addr: irsb address :param pyvex.IRSB block: irsb :param int func_addr: Function address :return: If it was resolved and targets alongside it :rtype: tuple
[ "Checks", "if", "MIPS32", "and", "calls", "MIPS32", "check", "otherwise", "false" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L2027-L2046
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._indirect_jump_resolved
def _indirect_jump_resolved(self, jump, jump_addr, resolved_by, targets): """ Called when an indirect jump is successfully resolved. :param IndirectJump jump: The resolved indirect jump, or None if an IndirectJump instance is ...
python
def _indirect_jump_resolved(self, jump, jump_addr, resolved_by, targets): """ Called when an indirect jump is successfully resolved. :param IndirectJump jump: The resolved indirect jump, or None if an IndirectJump instance is ...
[ "def", "_indirect_jump_resolved", "(", "self", ",", "jump", ",", "jump_addr", ",", "resolved_by", ",", "targets", ")", ":", "addr", "=", "jump", ".", "addr", "if", "jump", "is", "not", "None", "else", "jump_addr", "l", ".", "debug", "(", "'The indirect jum...
Called when an indirect jump is successfully resolved. :param IndirectJump jump: The resolved indirect jump, or None if an IndirectJump instance is not available. :param int jump_addr: Address of the resolved in...
[ "Called", "when", "an", "indirect", "jump", "is", "successfully", "resolved", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L2048-L2064
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._indirect_jump_unresolved
def _indirect_jump_unresolved(self, jump): """ Called when we cannot resolve an indirect jump. :param IndirectJump jump: The unresolved indirect jump. :return: None """ l.debug('Failed to resolve the indirect jump at %#x.', jump.addr) # tell KnowledgeBase that ...
python
def _indirect_jump_unresolved(self, jump): """ Called when we cannot resolve an indirect jump. :param IndirectJump jump: The unresolved indirect jump. :return: None """ l.debug('Failed to resolve the indirect jump at %#x.', jump.addr) # tell KnowledgeBase that ...
[ "def", "_indirect_jump_unresolved", "(", "self", ",", "jump", ")", ":", "l", ".", "debug", "(", "'Failed to resolve the indirect jump at %#x.'", ",", "jump", ".", "addr", ")", "# tell KnowledgeBase that it's not resolved", "# TODO: self.kb._unresolved_indirect_jumps is not proc...
Called when we cannot resolve an indirect jump. :param IndirectJump jump: The unresolved indirect jump. :return: None
[ "Called", "when", "we", "cannot", "resolve", "an", "indirect", "jump", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L2066-L2078
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._indirect_jump_encountered
def _indirect_jump_encountered(self, addr, cfg_node, irsb, func_addr, stmt_idx=DEFAULT_STATEMENT): """ Called when we encounter an indirect jump. We will try to resolve this indirect jump using timeless (fast) indirect jump resolvers. If it cannot be resolved, we will see if this indirect jump h...
python
def _indirect_jump_encountered(self, addr, cfg_node, irsb, func_addr, stmt_idx=DEFAULT_STATEMENT): """ Called when we encounter an indirect jump. We will try to resolve this indirect jump using timeless (fast) indirect jump resolvers. If it cannot be resolved, we will see if this indirect jump h...
[ "def", "_indirect_jump_encountered", "(", "self", ",", "addr", ",", "cfg_node", ",", "irsb", ",", "func_addr", ",", "stmt_idx", "=", "DEFAULT_STATEMENT", ")", ":", "jumpkind", "=", "irsb", ".", "jumpkind", "l", ".", "debug", "(", "'(%s) IRSB %#x has an indirect ...
Called when we encounter an indirect jump. We will try to resolve this indirect jump using timeless (fast) indirect jump resolvers. If it cannot be resolved, we will see if this indirect jump has been resolved before. :param int addr: Address of the block containing the indirect jump. ...
[ "Called", "when", "we", "encounter", "an", "indirect", "jump", ".", "We", "will", "try", "to", "resolve", "this", "indirect", "jump", "using", "timeless", "(", "fast", ")", "indirect", "jump", "resolvers", ".", "If", "it", "cannot", "be", "resolved", "we",...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L2080-L2118
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._process_unresolved_indirect_jumps
def _process_unresolved_indirect_jumps(self): """ Resolve all unresolved indirect jumps found in previous scanning. Currently we support resolving the following types of indirect jumps: - Ijk_Call: indirect calls where the function address is passed in from a proceeding basic block ...
python
def _process_unresolved_indirect_jumps(self): """ Resolve all unresolved indirect jumps found in previous scanning. Currently we support resolving the following types of indirect jumps: - Ijk_Call: indirect calls where the function address is passed in from a proceeding basic block ...
[ "def", "_process_unresolved_indirect_jumps", "(", "self", ")", ":", "l", ".", "info", "(", "\"%d indirect jumps to resolve.\"", ",", "len", "(", "self", ".", "_indirect_jumps_to_resolve", ")", ")", "all_targets", "=", "set", "(", ")", "for", "idx", ",", "jump", ...
Resolve all unresolved indirect jumps found in previous scanning. Currently we support resolving the following types of indirect jumps: - Ijk_Call: indirect calls where the function address is passed in from a proceeding basic block - Ijk_Boring: jump tables - For an up-to-date list, se...
[ "Resolve", "all", "unresolved", "indirect", "jumps", "found", "in", "previous", "scanning", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L2120-L2143
train
angr/angr
angr/analyses/cfg/cfg_base.py
CFGBase._process_one_indirect_jump
def _process_one_indirect_jump(self, jump): """ Resolve a given indirect jump. :param IndirectJump jump: The IndirectJump instance. :return: A set of resolved indirect jump targets (ints). """ resolved = False resolved_by = None targets = None ...
python
def _process_one_indirect_jump(self, jump): """ Resolve a given indirect jump. :param IndirectJump jump: The IndirectJump instance. :return: A set of resolved indirect jump targets (ints). """ resolved = False resolved_by = None targets = None ...
[ "def", "_process_one_indirect_jump", "(", "self", ",", "jump", ")", ":", "resolved", "=", "False", "resolved_by", "=", "None", "targets", "=", "None", "block", "=", "self", ".", "_lift", "(", "jump", ".", "addr", ",", "opt_level", "=", "1", ")", "for", ...
Resolve a given indirect jump. :param IndirectJump jump: The IndirectJump instance. :return: A set of resolved indirect jump targets (ints).
[ "Resolve", "a", "given", "indirect", "jump", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_base.py#L2145-L2175
train
angr/angr
angr/analyses/cfg/indirect_jump_resolvers/jumptable.py
JumpTableResolver.resolve
def resolve(self, cfg, addr, func_addr, block, jumpkind): """ Resolves jump tables. :param cfg: A CFG instance. :param int addr: IRSB address. :param int func_addr: The function address. :param pyvex.IRSB block: The IRSB. :return: A bool indicating whether the in...
python
def resolve(self, cfg, addr, func_addr, block, jumpkind): """ Resolves jump tables. :param cfg: A CFG instance. :param int addr: IRSB address. :param int func_addr: The function address. :param pyvex.IRSB block: The IRSB. :return: A bool indicating whether the in...
[ "def", "resolve", "(", "self", ",", "cfg", ",", "addr", ",", "func_addr", ",", "block", ",", "jumpkind", ")", ":", "project", "=", "self", ".", "project", "# short-hand", "self", ".", "_max_targets", "=", "cfg", ".", "_indirect_jump_target_limit", "# Perform...
Resolves jump tables. :param cfg: A CFG instance. :param int addr: IRSB address. :param int func_addr: The function address. :param pyvex.IRSB block: The IRSB. :return: A bool indicating whether the indirect jump is resolved successfully, and a list of resolved targets :...
[ "Resolves", "jump", "tables", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/indirect_jump_resolvers/jumptable.py#L78-L537
train
angr/angr
angr/analyses/cfg/indirect_jump_resolvers/jumptable.py
JumpTableResolver._parse_load_statement
def _parse_load_statement(load_stmt, state): """ Parse a memory load VEX statement and get the jump target addresses. :param load_stmt: The VEX statement for loading the jump target addresses. :param state: The SimState instance (in static mode). :return: An a...
python
def _parse_load_statement(load_stmt, state): """ Parse a memory load VEX statement and get the jump target addresses. :param load_stmt: The VEX statement for loading the jump target addresses. :param state: The SimState instance (in static mode). :return: An a...
[ "def", "_parse_load_statement", "(", "load_stmt", ",", "state", ")", ":", "# The jump table address is stored in a tmp. In this case, we find the jump-target loading tmp.", "load_addr_tmp", "=", "None", "if", "isinstance", "(", "load_stmt", ",", "pyvex", ".", "IRStmt", ".", ...
Parse a memory load VEX statement and get the jump target addresses. :param load_stmt: The VEX statement for loading the jump target addresses. :param state: The SimState instance (in static mode). :return: An abstract value (or a concrete value) representing the jump target ...
[ "Parse", "a", "memory", "load", "VEX", "statement", "and", "get", "the", "jump", "target", "addresses", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/indirect_jump_resolvers/jumptable.py#L666-L724
train
angr/angr
angr/analyses/cfg/segment_list.py
SegmentList._search
def _search(self, addr): """ Checks which segment that the address `addr` should belong to, and, returns the offset of that segment. Note that the address may not actually belong to the block. :param addr: The address to search :return: The offset of the segment. """ ...
python
def _search(self, addr): """ Checks which segment that the address `addr` should belong to, and, returns the offset of that segment. Note that the address may not actually belong to the block. :param addr: The address to search :return: The offset of the segment. """ ...
[ "def", "_search", "(", "self", ",", "addr", ")", ":", "start", "=", "0", "end", "=", "len", "(", "self", ".", "_list", ")", "while", "start", "!=", "end", ":", "mid", "=", "(", "start", "+", "end", ")", "//", "2", "segment", "=", "self", ".", ...
Checks which segment that the address `addr` should belong to, and, returns the offset of that segment. Note that the address may not actually belong to the block. :param addr: The address to search :return: The offset of the segment.
[ "Checks", "which", "segment", "that", "the", "address", "addr", "should", "belong", "to", "and", "returns", "the", "offset", "of", "that", "segment", ".", "Note", "that", "the", "address", "may", "not", "actually", "belong", "to", "the", "block", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/segment_list.py#L76-L101
train
angr/angr
angr/analyses/cfg/segment_list.py
SegmentList._insert_and_merge
def _insert_and_merge(self, address, size, sort, idx): """ Determines whether the block specified by (address, size) should be merged with adjacent blocks. :param int address: Starting address of the block to be merged. :param int size: Size of the block to be merged. :param str...
python
def _insert_and_merge(self, address, size, sort, idx): """ Determines whether the block specified by (address, size) should be merged with adjacent blocks. :param int address: Starting address of the block to be merged. :param int size: Size of the block to be merged. :param str...
[ "def", "_insert_and_merge", "(", "self", ",", "address", ",", "size", ",", "sort", ",", "idx", ")", ":", "# sanity check", "if", "idx", ">", "0", "and", "address", "+", "size", "<=", "self", ".", "_list", "[", "idx", "-", "1", "]", ".", "start", ":...
Determines whether the block specified by (address, size) should be merged with adjacent blocks. :param int address: Starting address of the block to be merged. :param int size: Size of the block to be merged. :param str sort: Type of the block. :param int idx: ID of the address. ...
[ "Determines", "whether", "the", "block", "specified", "by", "(", "address", "size", ")", "should", "be", "merged", "with", "adjacent", "blocks", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/segment_list.py#L103-L152
train
angr/angr
angr/analyses/cfg/segment_list.py
SegmentList._insert_and_merge_core
def _insert_and_merge_core(self, pos, direction): """ The core part of method _insert_and_merge. :param int pos: The starting position. :param str direction: If we are traversing forwards or backwards in the list. It determines where the "sort" ...
python
def _insert_and_merge_core(self, pos, direction): """ The core part of method _insert_and_merge. :param int pos: The starting position. :param str direction: If we are traversing forwards or backwards in the list. It determines where the "sort" ...
[ "def", "_insert_and_merge_core", "(", "self", ",", "pos", ",", "direction", ")", ":", "bytes_changed", "=", "0", "if", "direction", "==", "\"forward\"", ":", "if", "pos", "==", "len", "(", "self", ".", "_list", ")", "-", "1", ":", "return", "False", ",...
The core part of method _insert_and_merge. :param int pos: The starting position. :param str direction: If we are traversing forwards or backwards in the list. It determines where the "sort" of the overlapping memory block comes from. If everything works as exp...
[ "The", "core", "part", "of", "method", "_insert_and_merge", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/segment_list.py#L154-L257
train
angr/angr
angr/analyses/cfg/segment_list.py
SegmentList._dbg_output
def _dbg_output(self): """ Returns a string representation of the segments that form this SegmentList :return: String representation of contents :rtype: str """ s = "[" lst = [] for segment in self._list: lst.append(repr(segment)) s +=...
python
def _dbg_output(self): """ Returns a string representation of the segments that form this SegmentList :return: String representation of contents :rtype: str """ s = "[" lst = [] for segment in self._list: lst.append(repr(segment)) s +=...
[ "def", "_dbg_output", "(", "self", ")", ":", "s", "=", "\"[\"", "lst", "=", "[", "]", "for", "segment", "in", "self", ".", "_list", ":", "lst", ".", "append", "(", "repr", "(", "segment", ")", ")", "s", "+=", "\", \"", ".", "join", "(", "lst", ...
Returns a string representation of the segments that form this SegmentList :return: String representation of contents :rtype: str
[ "Returns", "a", "string", "representation", "of", "the", "segments", "that", "form", "this", "SegmentList" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/segment_list.py#L259-L272
train
angr/angr
angr/analyses/cfg/segment_list.py
SegmentList._debug_check
def _debug_check(self): """ Iterates over list checking segments with same sort do not overlap :raise: Exception: if segments overlap space with same sort """ # old_start = 0 old_end = 0 old_sort = "" for segment in self._list: if segment.star...
python
def _debug_check(self): """ Iterates over list checking segments with same sort do not overlap :raise: Exception: if segments overlap space with same sort """ # old_start = 0 old_end = 0 old_sort = "" for segment in self._list: if segment.star...
[ "def", "_debug_check", "(", "self", ")", ":", "# old_start = 0", "old_end", "=", "0", "old_sort", "=", "\"\"", "for", "segment", "in", "self", ".", "_list", ":", "if", "segment", ".", "start", "<=", "old_end", "and", "segment", ".", "sort", "==", "old_so...
Iterates over list checking segments with same sort do not overlap :raise: Exception: if segments overlap space with same sort
[ "Iterates", "over", "list", "checking", "segments", "with", "same", "sort", "do", "not", "overlap" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/segment_list.py#L274-L288
train
angr/angr
angr/analyses/cfg/segment_list.py
SegmentList.next_free_pos
def next_free_pos(self, address): """ Returns the next free position with respect to an address, including that address itself :param address: The address to begin the search with (including itself) :return: The next free position """ idx = self._search(address) ...
python
def next_free_pos(self, address): """ Returns the next free position with respect to an address, including that address itself :param address: The address to begin the search with (including itself) :return: The next free position """ idx = self._search(address) ...
[ "def", "next_free_pos", "(", "self", ",", "address", ")", ":", "idx", "=", "self", ".", "_search", "(", "address", ")", "if", "idx", "<", "len", "(", "self", ".", "_list", ")", "and", "self", ".", "_list", "[", "idx", "]", ".", "start", "<=", "ad...
Returns the next free position with respect to an address, including that address itself :param address: The address to begin the search with (including itself) :return: The next free position
[ "Returns", "the", "next", "free", "position", "with", "respect", "to", "an", "address", "including", "that", "address", "itself" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/segment_list.py#L294-L313
train
angr/angr
angr/analyses/cfg/segment_list.py
SegmentList.next_pos_with_sort_not_in
def next_pos_with_sort_not_in(self, address, sorts, max_distance=None): """ Returns the address of the next occupied block whose sort is not one of the specified ones. :param int address: The address to begin the search with (including itself). :param sorts: A collection of sort s...
python
def next_pos_with_sort_not_in(self, address, sorts, max_distance=None): """ Returns the address of the next occupied block whose sort is not one of the specified ones. :param int address: The address to begin the search with (including itself). :param sorts: A collection of sort s...
[ "def", "next_pos_with_sort_not_in", "(", "self", ",", "address", ",", "sorts", ",", "max_distance", "=", "None", ")", ":", "list_length", "=", "len", "(", "self", ".", "_list", ")", "idx", "=", "self", ".", "_search", "(", "address", ")", "if", "idx", ...
Returns the address of the next occupied block whose sort is not one of the specified ones. :param int address: The address to begin the search with (including itself). :param sorts: A collection of sort strings. :param max_distance: The maximum distance between `address` and the next ...
[ "Returns", "the", "address", "of", "the", "next", "occupied", "block", "whose", "sort", "is", "not", "one", "of", "the", "specified", "ones", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/segment_list.py#L315-L354
train
angr/angr
angr/analyses/cfg/segment_list.py
SegmentList.is_occupied
def is_occupied(self, address): """ Check if an address belongs to any segment :param address: The address to check :return: True if this address belongs to a segment, False otherwise """ idx = self._search(address) if len(self._list) <= idx: return ...
python
def is_occupied(self, address): """ Check if an address belongs to any segment :param address: The address to check :return: True if this address belongs to a segment, False otherwise """ idx = self._search(address) if len(self._list) <= idx: return ...
[ "def", "is_occupied", "(", "self", ",", "address", ")", ":", "idx", "=", "self", ".", "_search", "(", "address", ")", "if", "len", "(", "self", ".", "_list", ")", "<=", "idx", ":", "return", "False", "if", "self", ".", "_list", "[", "idx", "]", "...
Check if an address belongs to any segment :param address: The address to check :return: True if this address belongs to a segment, False otherwise
[ "Check", "if", "an", "address", "belongs", "to", "any", "segment" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/segment_list.py#L356-L372
train
angr/angr
angr/analyses/cfg/segment_list.py
SegmentList.occupied_by_sort
def occupied_by_sort(self, address): """ Check if an address belongs to any segment, and if yes, returns the sort of the segment :param int address: The address to check :return: Sort of the segment that occupies this address :rtype: str """ idx = self._search(a...
python
def occupied_by_sort(self, address): """ Check if an address belongs to any segment, and if yes, returns the sort of the segment :param int address: The address to check :return: Sort of the segment that occupies this address :rtype: str """ idx = self._search(a...
[ "def", "occupied_by_sort", "(", "self", ",", "address", ")", ":", "idx", "=", "self", ".", "_search", "(", "address", ")", "if", "len", "(", "self", ".", "_list", ")", "<=", "idx", ":", "return", "None", "if", "self", ".", "_list", "[", "idx", "]",...
Check if an address belongs to any segment, and if yes, returns the sort of the segment :param int address: The address to check :return: Sort of the segment that occupies this address :rtype: str
[ "Check", "if", "an", "address", "belongs", "to", "any", "segment", "and", "if", "yes", "returns", "the", "sort", "of", "the", "segment" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/segment_list.py#L374-L391
train
angr/angr
angr/analyses/cfg/segment_list.py
SegmentList.occupy
def occupy(self, address, size, sort): """ Include a block, specified by (address, size), in this segment list. :param int address: The starting address of the block. :param int size: Size of the block. :param str sort: Type of the block. :return: None ...
python
def occupy(self, address, size, sort): """ Include a block, specified by (address, size), in this segment list. :param int address: The starting address of the block. :param int size: Size of the block. :param str sort: Type of the block. :return: None ...
[ "def", "occupy", "(", "self", ",", "address", ",", "size", ",", "sort", ")", ":", "if", "size", "is", "None", "or", "size", "<=", "0", ":", "# Cannot occupy a non-existent block", "return", "# l.debug(\"Occpuying 0x%08x-0x%08x\", address, address + size)", "if", "no...
Include a block, specified by (address, size), in this segment list. :param int address: The starting address of the block. :param int size: Size of the block. :param str sort: Type of the block. :return: None
[ "Include", "a", "block", "specified", "by", "(", "address", "size", ")", "in", "this", "segment", "list", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/segment_list.py#L393-L416
train
angr/angr
angr/analyses/cfg/segment_list.py
SegmentList.copy
def copy(self): """ Make a copy of the SegmentList. :return: A copy of the SegmentList instance. :rtype: angr.analyses.cfg_fast.SegmentList """ n = SegmentList() n._list = [ a.copy() for a in self._list ] n._bytes_occupied = self._bytes_occupied ...
python
def copy(self): """ Make a copy of the SegmentList. :return: A copy of the SegmentList instance. :rtype: angr.analyses.cfg_fast.SegmentList """ n = SegmentList() n._list = [ a.copy() for a in self._list ] n._bytes_occupied = self._bytes_occupied ...
[ "def", "copy", "(", "self", ")", ":", "n", "=", "SegmentList", "(", ")", "n", ".", "_list", "=", "[", "a", ".", "copy", "(", ")", "for", "a", "in", "self", ".", "_list", "]", "n", ".", "_bytes_occupied", "=", "self", ".", "_bytes_occupied", "retu...
Make a copy of the SegmentList. :return: A copy of the SegmentList instance. :rtype: angr.analyses.cfg_fast.SegmentList
[ "Make", "a", "copy", "of", "the", "SegmentList", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/segment_list.py#L420-L431
train
angr/angr
angr/analyses/calling_convention.py
CallingConventionAnalysis._analyze_function
def _analyze_function(self): """ Go over the variable information in variable manager for this function, and return all uninitialized register/stack variables. :return: """ if not self._function.is_simprocedure \ and not self._function.is_plt \ ...
python
def _analyze_function(self): """ Go over the variable information in variable manager for this function, and return all uninitialized register/stack variables. :return: """ if not self._function.is_simprocedure \ and not self._function.is_plt \ ...
[ "def", "_analyze_function", "(", "self", ")", ":", "if", "not", "self", ".", "_function", ".", "is_simprocedure", "and", "not", "self", ".", "_function", ".", "is_plt", "and", "not", "self", ".", "_variable_manager", ".", "has_function_manager", "(", "self", ...
Go over the variable information in variable manager for this function, and return all uninitialized register/stack variables. :return:
[ "Go", "over", "the", "variable", "information", "in", "variable", "manager", "for", "this", "function", "and", "return", "all", "uninitialized", "register", "/", "stack", "variables", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/calling_convention.py#L48-L77
train
angr/angr
angr/analyses/calling_convention.py
CallingConventionAnalysis._is_sane_register_variable
def _is_sane_register_variable(self, variable): """ Filters all registers that are surly not members of function arguments. This can be seen as a workaround, since VariableRecoveryFast sometimes gives input variables of cc_ndep (which is a VEX-specific register) :-( :param SimRe...
python
def _is_sane_register_variable(self, variable): """ Filters all registers that are surly not members of function arguments. This can be seen as a workaround, since VariableRecoveryFast sometimes gives input variables of cc_ndep (which is a VEX-specific register) :-( :param SimRe...
[ "def", "_is_sane_register_variable", "(", "self", ",", "variable", ")", ":", "arch", "=", "self", ".", "project", ".", "arch", "if", "arch", ".", "name", "==", "'AARCH64'", ":", "return", "16", "<=", "variable", ".", "reg", "<", "80", "# x0-x7", "elif", ...
Filters all registers that are surly not members of function arguments. This can be seen as a workaround, since VariableRecoveryFast sometimes gives input variables of cc_ndep (which is a VEX-specific register) :-( :param SimRegisterVariable variable: The variable to test. :return: ...
[ "Filters", "all", "registers", "that", "are", "surly", "not", "members", "of", "function", "arguments", ".", "This", "can", "be", "seen", "as", "a", "workaround", "since", "VariableRecoveryFast", "sometimes", "gives", "input", "variables", "of", "cc_ndep", "(", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/calling_convention.py#L128-L164
train
angr/angr
angr/procedures/definitions/__init__.py
SimLibrary.copy
def copy(self): """ Make a copy of this SimLibrary, allowing it to be mutated without affecting the global version. :return: A new SimLibrary object with the same library references but different dict/list references """ o = SimLibrary() o.procedures = dict(self.proce...
python
def copy(self): """ Make a copy of this SimLibrary, allowing it to be mutated without affecting the global version. :return: A new SimLibrary object with the same library references but different dict/list references """ o = SimLibrary() o.procedures = dict(self.proce...
[ "def", "copy", "(", "self", ")", ":", "o", "=", "SimLibrary", "(", ")", "o", ".", "procedures", "=", "dict", "(", "self", ".", "procedures", ")", "o", ".", "non_returning", "=", "set", "(", "self", ".", "non_returning", ")", "o", ".", "prototypes", ...
Make a copy of this SimLibrary, allowing it to be mutated without affecting the global version. :return: A new SimLibrary object with the same library references but different dict/list references
[ "Make", "a", "copy", "of", "this", "SimLibrary", "allowing", "it", "to", "be", "mutated", "without", "affecting", "the", "global", "version", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/definitions/__init__.py#L38-L50
train
angr/angr
angr/procedures/definitions/__init__.py
SimLibrary.update
def update(self, other): """ Augment this SimLibrary with the information from another SimLibrary :param other: The other SimLibrary """ self.procedures.update(other.procedures) self.non_returning.update(other.non_returning) self.prototypes.update(other.prototy...
python
def update(self, other): """ Augment this SimLibrary with the information from another SimLibrary :param other: The other SimLibrary """ self.procedures.update(other.procedures) self.non_returning.update(other.non_returning) self.prototypes.update(other.prototy...
[ "def", "update", "(", "self", ",", "other", ")", ":", "self", ".", "procedures", ".", "update", "(", "other", ".", "procedures", ")", "self", ".", "non_returning", ".", "update", "(", "other", ".", "non_returning", ")", "self", ".", "prototypes", ".", ...
Augment this SimLibrary with the information from another SimLibrary :param other: The other SimLibrary
[ "Augment", "this", "SimLibrary", "with", "the", "information", "from", "another", "SimLibrary" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/definitions/__init__.py#L52-L61
train
angr/angr
angr/procedures/definitions/__init__.py
SimLibrary.set_library_names
def set_library_names(self, *names): """ Set some common names of this library by which it may be referred during linking :param names: Any number of string library names may be passed as varargs. """ for name in names: self.names.append(name) SIM_LIBRA...
python
def set_library_names(self, *names): """ Set some common names of this library by which it may be referred during linking :param names: Any number of string library names may be passed as varargs. """ for name in names: self.names.append(name) SIM_LIBRA...
[ "def", "set_library_names", "(", "self", ",", "*", "names", ")", ":", "for", "name", "in", "names", ":", "self", ".", "names", ".", "append", "(", "name", ")", "SIM_LIBRARIES", "[", "name", "]", "=", "self" ]
Set some common names of this library by which it may be referred during linking :param names: Any number of string library names may be passed as varargs.
[ "Set", "some", "common", "names", "of", "this", "library", "by", "which", "it", "may", "be", "referred", "during", "linking" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/definitions/__init__.py#L70-L78
train
angr/angr
angr/procedures/definitions/__init__.py
SimLibrary.set_default_cc
def set_default_cc(self, arch_name, cc_cls): """ Set the default calling convention used for this library under a given architecture :param arch_name: The string name of the architecture, i.e. the ``.name`` field from archinfo. :parm cc_cls: The SimCC class (not an instance!) to...
python
def set_default_cc(self, arch_name, cc_cls): """ Set the default calling convention used for this library under a given architecture :param arch_name: The string name of the architecture, i.e. the ``.name`` field from archinfo. :parm cc_cls: The SimCC class (not an instance!) to...
[ "def", "set_default_cc", "(", "self", ",", "arch_name", ",", "cc_cls", ")", ":", "arch_name", "=", "archinfo", ".", "arch_from_id", "(", "arch_name", ")", ".", "name", "self", ".", "default_ccs", "[", "arch_name", "]", "=", "cc_cls" ]
Set the default calling convention used for this library under a given architecture :param arch_name: The string name of the architecture, i.e. the ``.name`` field from archinfo. :parm cc_cls: The SimCC class (not an instance!) to use
[ "Set", "the", "default", "calling", "convention", "used", "for", "this", "library", "under", "a", "given", "architecture" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/definitions/__init__.py#L80-L88
train
angr/angr
angr/procedures/definitions/__init__.py
SimLibrary.set_c_prototype
def set_c_prototype(self, c_decl): """ Set the prototype of a function in the form of a C-style function declaration. :param str c_decl: The C-style declaration of the function. :return: A tuple of (function name, function prototype) :rtype: tuple ""...
python
def set_c_prototype(self, c_decl): """ Set the prototype of a function in the form of a C-style function declaration. :param str c_decl: The C-style declaration of the function. :return: A tuple of (function name, function prototype) :rtype: tuple ""...
[ "def", "set_c_prototype", "(", "self", ",", "c_decl", ")", ":", "parsed", "=", "parse_file", "(", "c_decl", ")", "parsed_decl", "=", "parsed", "[", "0", "]", "if", "not", "parsed_decl", ":", "raise", "ValueError", "(", "'Cannot parse the function prototype.'", ...
Set the prototype of a function in the form of a C-style function declaration. :param str c_decl: The C-style declaration of the function. :return: A tuple of (function name, function prototype) :rtype: tuple
[ "Set", "the", "prototype", "of", "a", "function", "in", "the", "form", "of", "a", "C", "-", "style", "function", "declaration", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/definitions/__init__.py#L116-L133
train