partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | RegionIdentifier.slice_graph | Generate a slice of the graph from the head node to the given frontier.
:param networkx.DiGraph graph: The graph to work on.
:param node: The starting node in the graph.
:param frontier: A list of frontier nodes.
:param bool include_frontier: Whether the frontier nodes are included in t... | angr/analyses/decompiler/region_identifier.py | def slice_graph(graph, node, frontier, include_frontier=False):
"""
Generate a slice of the graph from the head node to the given frontier.
:param networkx.DiGraph graph: The graph to work on.
:param node: The starting node in the graph.
:param frontier: A list of frontier nodes... | def slice_graph(graph, node, frontier, include_frontier=False):
"""
Generate a slice of the graph from the head node to the given frontier.
:param networkx.DiGraph graph: The graph to work on.
:param node: The starting node in the graph.
:param frontier: A list of frontier nodes... | [
"Generate",
"a",
"slice",
"of",
"the",
"graph",
"from",
"the",
"head",
"node",
"to",
"the",
"given",
"frontier",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/decompiler/region_identifier.py#L159-L183 | [
"def",
"slice_graph",
"(",
"graph",
",",
"node",
",",
"frontier",
",",
"include_frontier",
"=",
"False",
")",
":",
"subgraph",
"=",
"networkx",
".",
"DiGraph",
"(",
")",
"for",
"frontier_node",
"in",
"frontier",
":",
"for",
"simple_path",
"in",
"networkx",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | condition_to_lambda | Translates an integer, set, list or function into a lambda that checks if state's current basic block matches
some condition.
:param condition: An integer, set, list or lambda to convert to a lambda.
:param default: The default return value of the lambda (in case condition is None). Default: false.
... | angr/exploration_techniques/common.py | def condition_to_lambda(condition, default=False):
"""
Translates an integer, set, list or function into a lambda that checks if state's current basic block matches
some condition.
:param condition: An integer, set, list or lambda to convert to a lambda.
:param default: The default return val... | def condition_to_lambda(condition, default=False):
"""
Translates an integer, set, list or function into a lambda that checks if state's current basic block matches
some condition.
:param condition: An integer, set, list or lambda to convert to a lambda.
:param default: The default return val... | [
"Translates",
"an",
"integer",
"set",
"list",
"or",
"function",
"into",
"a",
"lambda",
"that",
"checks",
"if",
"state",
"s",
"current",
"basic",
"block",
"matches",
"some",
"condition",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/common.py#L5-L49 | [
"def",
"condition_to_lambda",
"(",
"condition",
",",
"default",
"=",
"False",
")",
":",
"if",
"condition",
"is",
"None",
":",
"condition_function",
"=",
"lambda",
"state",
":",
"default",
"static_addrs",
"=",
"set",
"(",
")",
"elif",
"isinstance",
"(",
"cond... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | Vault._get_persistent_id | Determines a persistent ID for an object.
Does NOT do stores. | angr/vaults.py | def _get_persistent_id(self, o):
"""
Determines a persistent ID for an object.
Does NOT do stores.
"""
if type(o) in self.hash_dedup:
oid = o.__class__.__name__ + "-" + str(hash(o))
self._object_cache[oid] = o
return oid
if any(isinsta... | def _get_persistent_id(self, o):
"""
Determines a persistent ID for an object.
Does NOT do stores.
"""
if type(o) in self.hash_dedup:
oid = o.__class__.__name__ + "-" + str(hash(o))
self._object_cache[oid] = o
return oid
if any(isinsta... | [
"Determines",
"a",
"persistent",
"ID",
"for",
"an",
"object",
".",
"Does",
"NOT",
"do",
"stores",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/vaults.py#L90-L118 | [
"def",
"_get_persistent_id",
"(",
"self",
",",
"o",
")",
":",
"if",
"type",
"(",
"o",
")",
"in",
"self",
".",
"hash_dedup",
":",
"oid",
"=",
"o",
".",
"__class__",
".",
"__name__",
"+",
"\"-\"",
"+",
"str",
"(",
"hash",
"(",
"o",
")",
")",
"self"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | Vault.is_stored | Checks if the provided id is already in the vault. | angr/vaults.py | def is_stored(self, i):
"""
Checks if the provided id is already in the vault.
"""
if i in self.stored:
return True
try:
with self._read_context(i):
return True
except (AngrVaultError, EOFError):
return False | def is_stored(self, i):
"""
Checks if the provided id is already in the vault.
"""
if i in self.stored:
return True
try:
with self._read_context(i):
return True
except (AngrVaultError, EOFError):
return False | [
"Checks",
"if",
"the",
"provided",
"id",
"is",
"already",
"in",
"the",
"vault",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/vaults.py#L124-L135 | [
"def",
"is_stored",
"(",
"self",
",",
"i",
")",
":",
"if",
"i",
"in",
"self",
".",
"stored",
":",
"return",
"True",
"try",
":",
"with",
"self",
".",
"_read_context",
"(",
"i",
")",
":",
"return",
"True",
"except",
"(",
"AngrVaultError",
",",
"EOFErro... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | Vault.load | Retrieves one object from the pickler with the provided id.
:param id: an ID to use | angr/vaults.py | def load(self, id): #pylint:disable=redefined-builtin
"""
Retrieves one object from the pickler with the provided id.
:param id: an ID to use
"""
l.debug("LOAD: %s", id)
try:
l.debug("... trying cached")
return self._object_cache[id]
excep... | def load(self, id): #pylint:disable=redefined-builtin
"""
Retrieves one object from the pickler with the provided id.
:param id: an ID to use
"""
l.debug("LOAD: %s", id)
try:
l.debug("... trying cached")
return self._object_cache[id]
excep... | [
"Retrieves",
"one",
"object",
"from",
"the",
"pickler",
"with",
"the",
"provided",
"id",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/vaults.py#L137-L150 | [
"def",
"load",
"(",
"self",
",",
"id",
")",
":",
"#pylint:disable=redefined-builtin",
"l",
".",
"debug",
"(",
"\"LOAD: %s\"",
",",
"id",
")",
"try",
":",
"l",
".",
"debug",
"(",
"\"... trying cached\"",
")",
"return",
"self",
".",
"_object_cache",
"[",
"id... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | Vault.store | Stores an object and returns its ID.
:param o: the object
:param id: an ID to use | angr/vaults.py | def store(self, o, id=None): #pylint:disable=redefined-builtin
"""
Stores an object and returns its ID.
:param o: the object
:param id: an ID to use
"""
actual_id = id or self._get_persistent_id(o) or "TMP-"+str(uuid.uuid4())
l.debug("STORE: %s %s", o, actual_id... | def store(self, o, id=None): #pylint:disable=redefined-builtin
"""
Stores an object and returns its ID.
:param o: the object
:param id: an ID to use
"""
actual_id = id or self._get_persistent_id(o) or "TMP-"+str(uuid.uuid4())
l.debug("STORE: %s %s", o, actual_id... | [
"Stores",
"an",
"object",
"and",
"returns",
"its",
"ID",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/vaults.py#L152-L176 | [
"def",
"store",
"(",
"self",
",",
"o",
",",
"id",
"=",
"None",
")",
":",
"#pylint:disable=redefined-builtin",
"actual_id",
"=",
"id",
"or",
"self",
".",
"_get_persistent_id",
"(",
"o",
")",
"or",
"\"TMP-\"",
"+",
"str",
"(",
"uuid",
".",
"uuid4",
"(",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | Vault.dumps | Returns a serialized string representing the object, post-deduplication.
:param o: the object | angr/vaults.py | def dumps(self, o):
"""
Returns a serialized string representing the object, post-deduplication.
:param o: the object
"""
f = io.BytesIO()
VaultPickler(self, f).dump(o)
f.seek(0)
return f.read() | def dumps(self, o):
"""
Returns a serialized string representing the object, post-deduplication.
:param o: the object
"""
f = io.BytesIO()
VaultPickler(self, f).dump(o)
f.seek(0)
return f.read() | [
"Returns",
"a",
"serialized",
"string",
"representing",
"the",
"object",
"post",
"-",
"deduplication",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/vaults.py#L178-L187 | [
"def",
"dumps",
"(",
"self",
",",
"o",
")",
":",
"f",
"=",
"io",
".",
"BytesIO",
"(",
")",
"VaultPickler",
"(",
"self",
",",
"f",
")",
".",
"dump",
"(",
"o",
")",
"f",
".",
"seek",
"(",
"0",
")",
"return",
"f",
".",
"read",
"(",
")"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | Vault.loads | Deserializes a string representation of the object.
:param s: the string | angr/vaults.py | def loads(self, s):
"""
Deserializes a string representation of the object.
:param s: the string
"""
f = io.BytesIO(s)
return VaultUnpickler(self, f).load() | def loads(self, s):
"""
Deserializes a string representation of the object.
:param s: the string
"""
f = io.BytesIO(s)
return VaultUnpickler(self, f).load() | [
"Deserializes",
"a",
"string",
"representation",
"of",
"the",
"object",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/vaults.py#L189-L196 | [
"def",
"loads",
"(",
"self",
",",
"s",
")",
":",
"f",
"=",
"io",
".",
"BytesIO",
"(",
"s",
")",
"return",
"VaultUnpickler",
"(",
"self",
",",
"f",
")",
".",
"load",
"(",
")"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | Identifier.get_reg_name | :param arch: the architecture
:param reg_offset: Tries to find the name of a register given the offset in the registers.
:return: The register name | angr/analyses/identifier/identify.py | def get_reg_name(arch, reg_offset):
"""
:param arch: the architecture
:param reg_offset: Tries to find the name of a register given the offset in the registers.
:return: The register name
"""
# todo does this make sense
if reg_offset is None:
return No... | def get_reg_name(arch, reg_offset):
"""
:param arch: the architecture
:param reg_offset: Tries to find the name of a register given the offset in the registers.
:return: The register name
"""
# todo does this make sense
if reg_offset is None:
return No... | [
":",
"param",
"arch",
":",
"the",
"architecture",
":",
"param",
"reg_offset",
":",
"Tries",
"to",
"find",
"the",
"name",
"of",
"a",
"register",
"given",
"the",
"offset",
"in",
"the",
"registers",
".",
":",
"return",
":",
"The",
"register",
"name"
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/identifier/identify.py#L412-L428 | [
"def",
"get_reg_name",
"(",
"arch",
",",
"reg_offset",
")",
":",
"# todo does this make sense",
"if",
"reg_offset",
"is",
"None",
":",
"return",
"None",
"original_offset",
"=",
"reg_offset",
"while",
"reg_offset",
">=",
"0",
"and",
"reg_offset",
">=",
"original_of... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | Identifier._make_regs_symbolic | converts an input state into a state with symbolic registers
:return: the symbolic state | angr/analyses/identifier/identify.py | def _make_regs_symbolic(input_state, reg_list, project):
"""
converts an input state into a state with symbolic registers
:return: the symbolic state
"""
state = input_state.copy()
# overwrite all registers
for reg in reg_list:
state.registers.store(re... | def _make_regs_symbolic(input_state, reg_list, project):
"""
converts an input state into a state with symbolic registers
:return: the symbolic state
"""
state = input_state.copy()
# overwrite all registers
for reg in reg_list:
state.registers.store(re... | [
"converts",
"an",
"input",
"state",
"into",
"a",
"state",
"with",
"symbolic",
"registers",
":",
"return",
":",
"the",
"symbolic",
"state"
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/identifier/identify.py#L431-L444 | [
"def",
"_make_regs_symbolic",
"(",
"input_state",
",",
"reg_list",
",",
"project",
")",
":",
"state",
"=",
"input_state",
".",
"copy",
"(",
")",
"# overwrite all registers",
"for",
"reg",
"in",
"reg_list",
":",
"state",
".",
"registers",
".",
"store",
"(",
"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | Identifier.make_initial_state | :return: an initial state with a symbolic stack and good options for rop | angr/analyses/identifier/identify.py | def make_initial_state(project, stack_length):
"""
:return: an initial state with a symbolic stack and good options for rop
"""
initial_state = project.factory.blank_state(
add_options={options.AVOID_MULTIVALUED_READS, options.AVOID_MULTIVALUED_WRITES,
... | def make_initial_state(project, stack_length):
"""
:return: an initial state with a symbolic stack and good options for rop
"""
initial_state = project.factory.blank_state(
add_options={options.AVOID_MULTIVALUED_READS, options.AVOID_MULTIVALUED_WRITES,
... | [
":",
"return",
":",
"an",
"initial",
"state",
"with",
"a",
"symbolic",
"stack",
"and",
"good",
"options",
"for",
"rop"
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/identifier/identify.py#L795-L812 | [
"def",
"make_initial_state",
"(",
"project",
",",
"stack_length",
")",
":",
"initial_state",
"=",
"project",
".",
"factory",
".",
"blank_state",
"(",
"add_options",
"=",
"{",
"options",
".",
"AVOID_MULTIVALUED_READS",
",",
"options",
".",
"AVOID_MULTIVALUED_WRITES",... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | Identifier.make_symbolic_state | converts an input state into a state with symbolic registers
:return: the symbolic state | angr/analyses/identifier/identify.py | def make_symbolic_state(project, reg_list, stack_length=80):
"""
converts an input state into a state with symbolic registers
:return: the symbolic state
"""
input_state = Identifier.make_initial_state(project, stack_length)
symbolic_state = input_state.copy()
# o... | def make_symbolic_state(project, reg_list, stack_length=80):
"""
converts an input state into a state with symbolic registers
:return: the symbolic state
"""
input_state = Identifier.make_initial_state(project, stack_length)
symbolic_state = input_state.copy()
# o... | [
"converts",
"an",
"input",
"state",
"into",
"a",
"state",
"with",
"symbolic",
"registers",
":",
"return",
":",
"the",
"symbolic",
"state"
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/identifier/identify.py#L815-L829 | [
"def",
"make_symbolic_state",
"(",
"project",
",",
"reg_list",
",",
"stack_length",
"=",
"80",
")",
":",
"input_state",
"=",
"Identifier",
".",
"make_initial_state",
"(",
"project",
",",
"stack_length",
")",
"symbolic_state",
"=",
"input_state",
".",
"copy",
"("... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | CongruencyCheck.set_state_options | Checks that the specified state options result in the same states over the next `depth` states. | angr/analyses/congruency_check.py | def set_state_options(self, left_add_options=None, left_remove_options=None, right_add_options=None, right_remove_options=None):
"""
Checks that the specified state options result in the same states over the next `depth` states.
"""
s_right = self.project.factory.full_init_state(
... | def set_state_options(self, left_add_options=None, left_remove_options=None, right_add_options=None, right_remove_options=None):
"""
Checks that the specified state options result in the same states over the next `depth` states.
"""
s_right = self.project.factory.full_init_state(
... | [
"Checks",
"that",
"the",
"specified",
"state",
"options",
"result",
"in",
"the",
"same",
"states",
"over",
"the",
"next",
"depth",
"states",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/congruency_check.py#L26-L39 | [
"def",
"set_state_options",
"(",
"self",
",",
"left_add_options",
"=",
"None",
",",
"left_remove_options",
"=",
"None",
",",
"right_add_options",
"=",
"None",
",",
"right_remove_options",
"=",
"None",
")",
":",
"s_right",
"=",
"self",
".",
"project",
".",
"fac... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | CongruencyCheck.set_states | Checks that the specified paths stay the same over the next `depth` states. | angr/analyses/congruency_check.py | def set_states(self, left_state, right_state):
"""
Checks that the specified paths stay the same over the next `depth` states.
"""
simgr = self.project.factory.simulation_manager(right_state)
simgr.stash(to_stash='right')
simgr.active.append(left_state)
simgr.sta... | def set_states(self, left_state, right_state):
"""
Checks that the specified paths stay the same over the next `depth` states.
"""
simgr = self.project.factory.simulation_manager(right_state)
simgr.stash(to_stash='right')
simgr.active.append(left_state)
simgr.sta... | [
"Checks",
"that",
"the",
"specified",
"paths",
"stay",
"the",
"same",
"over",
"the",
"next",
"depth",
"states",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/congruency_check.py#L41-L53 | [
"def",
"set_states",
"(",
"self",
",",
"left_state",
",",
"right_state",
")",
":",
"simgr",
"=",
"self",
".",
"project",
".",
"factory",
".",
"simulation_manager",
"(",
"right_state",
")",
"simgr",
".",
"stash",
"(",
"to_stash",
"=",
"'right'",
")",
"simgr... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | CongruencyCheck._validate_incongruency | Checks that a detected incongruency is not caused by translation backends having a different
idea of what constitutes a basic block. | angr/analyses/congruency_check.py | def _validate_incongruency(self):
"""
Checks that a detected incongruency is not caused by translation backends having a different
idea of what constitutes a basic block.
"""
ot = self._throw
try:
self._throw = False
l.debug("Validating incongrue... | def _validate_incongruency(self):
"""
Checks that a detected incongruency is not caused by translation backends having a different
idea of what constitutes a basic block.
"""
ot = self._throw
try:
self._throw = False
l.debug("Validating incongrue... | [
"Checks",
"that",
"a",
"detected",
"incongruency",
"is",
"not",
"caused",
"by",
"translation",
"backends",
"having",
"a",
"different",
"idea",
"of",
"what",
"constitutes",
"a",
"basic",
"block",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/congruency_check.py#L102-L179 | [
"def",
"_validate_incongruency",
"(",
"self",
")",
":",
"ot",
"=",
"self",
".",
"_throw",
"try",
":",
"self",
".",
"_throw",
"=",
"False",
"l",
".",
"debug",
"(",
"\"Validating incongruency.\"",
")",
"if",
"(",
"\"UNICORN\"",
"in",
"self",
".",
"simgr",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | CongruencyCheck.run | Checks that the paths in the specified path group stay the same over the next
`depth` bytes.
The path group should have a "left" and a "right" stash, each with a single
path. | angr/analyses/congruency_check.py | def run(self, depth=None):
"""
Checks that the paths in the specified path group stay the same over the next
`depth` bytes.
The path group should have a "left" and a "right" stash, each with a single
path.
"""
#pg_history = [ ]
if len(self.simgr.right) !=... | def run(self, depth=None):
"""
Checks that the paths in the specified path group stay the same over the next
`depth` bytes.
The path group should have a "left" and a "right" stash, each with a single
path.
"""
#pg_history = [ ]
if len(self.simgr.right) !=... | [
"Checks",
"that",
"the",
"paths",
"in",
"the",
"specified",
"path",
"group",
"stay",
"the",
"same",
"over",
"the",
"next",
"depth",
"bytes",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/congruency_check.py#L186-L259 | [
"def",
"run",
"(",
"self",
",",
"depth",
"=",
"None",
")",
":",
"#pg_history = [ ]",
"if",
"len",
"(",
"self",
".",
"simgr",
".",
"right",
")",
"!=",
"1",
"or",
"len",
"(",
"self",
".",
"simgr",
".",
"left",
")",
"!=",
"1",
":",
"self",
".",
"_... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | CongruencyCheck.compare_states | Compares two states for similarity. | angr/analyses/congruency_check.py | def compare_states(self, sl, sr):
"""
Compares two states for similarity.
"""
joint_solver = claripy.Solver()
# make sure the canonicalized constraints are the same
n_map, n_counter, n_canon_constraint = claripy.And(*sr.solver.constraints).canonicalize() #pylint:disable=... | def compare_states(self, sl, sr):
"""
Compares two states for similarity.
"""
joint_solver = claripy.Solver()
# make sure the canonicalized constraints are the same
n_map, n_counter, n_canon_constraint = claripy.And(*sr.solver.constraints).canonicalize() #pylint:disable=... | [
"Compares",
"two",
"states",
"for",
"similarity",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/congruency_check.py#L281-L342 | [
"def",
"compare_states",
"(",
"self",
",",
"sl",
",",
"sr",
")",
":",
"joint_solver",
"=",
"claripy",
".",
"Solver",
"(",
")",
"# make sure the canonicalized constraints are the same",
"n_map",
",",
"n_counter",
",",
"n_canon_constraint",
"=",
"claripy",
".",
"And... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | BP.check | Checks state `state` to see if the breakpoint should fire.
:param state: The state.
:param when: Whether the check is happening before or after the event.
:return: A boolean representing whether the checkpoint should fire. | angr/state_plugins/inspect.py | def check(self, state, when):
"""
Checks state `state` to see if the breakpoint should fire.
:param state: The state.
:param when: Whether the check is happening before or after the event.
:return: A boolean representing whether the checkpoint should fire.
""... | def check(self, state, when):
"""
Checks state `state` to see if the breakpoint should fire.
:param state: The state.
:param when: Whether the check is happening before or after the event.
:return: A boolean representing whether the checkpoint should fire.
""... | [
"Checks",
"state",
"state",
"to",
"see",
"if",
"the",
"breakpoint",
"should",
"fire",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/inspect.py#L138-L184 | [
"def",
"check",
"(",
"self",
",",
"state",
",",
"when",
")",
":",
"ok",
"=",
"self",
".",
"enabled",
"and",
"(",
"when",
"==",
"self",
".",
"when",
"or",
"self",
".",
"when",
"==",
"BP_BOTH",
")",
"if",
"not",
"ok",
":",
"return",
"ok",
"l",
".... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | BP.fire | Trigger the breakpoint.
:param state: The state. | angr/state_plugins/inspect.py | def fire(self, state):
"""
Trigger the breakpoint.
:param state: The state.
"""
if self.action is None or self.action == BP_IPDB:
import ipdb; ipdb.set_trace() #pylint:disable=F0401
elif self.action == BP_IPYTHON:
import IPython
shel... | def fire(self, state):
"""
Trigger the breakpoint.
:param state: The state.
"""
if self.action is None or self.action == BP_IPDB:
import ipdb; ipdb.set_trace() #pylint:disable=F0401
elif self.action == BP_IPYTHON:
import IPython
shel... | [
"Trigger",
"the",
"breakpoint",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/inspect.py#L186-L201 | [
"def",
"fire",
"(",
"self",
",",
"state",
")",
":",
"if",
"self",
".",
"action",
"is",
"None",
"or",
"self",
".",
"action",
"==",
"BP_IPDB",
":",
"import",
"ipdb",
"ipdb",
".",
"set_trace",
"(",
")",
"#pylint:disable=F0401",
"elif",
"self",
".",
"actio... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimInspector.action | Called from within SimuVEX when events happens. This function checks all breakpoints registered for that event
and fires the ones whose conditions match. | angr/state_plugins/inspect.py | def action(self, event_type, when, **kwargs):
"""
Called from within SimuVEX when events happens. This function checks all breakpoints registered for that event
and fires the ones whose conditions match.
"""
l.debug("Event %s (%s) firing...", event_type, when)
for k,v in ... | def action(self, event_type, when, **kwargs):
"""
Called from within SimuVEX when events happens. This function checks all breakpoints registered for that event
and fires the ones whose conditions match.
"""
l.debug("Event %s (%s) firing...", event_type, when)
for k,v in ... | [
"Called",
"from",
"within",
"SimuVEX",
"when",
"events",
"happens",
".",
"This",
"function",
"checks",
"all",
"breakpoints",
"registered",
"for",
"that",
"event",
"and",
"fires",
"the",
"ones",
"whose",
"conditions",
"match",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/inspect.py#L232-L249 | [
"def",
"action",
"(",
"self",
",",
"event_type",
",",
"when",
",",
"*",
"*",
"kwargs",
")",
":",
"l",
".",
"debug",
"(",
"\"Event %s (%s) firing...\"",
",",
"event_type",
",",
"when",
")",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimInspector.make_breakpoint | Creates and adds a breakpoint which would trigger on `event_type`. Additional arguments are passed to the
:class:`BP` constructor.
:return: The created breakpoint, so that it can be removed later. | angr/state_plugins/inspect.py | def make_breakpoint(self, event_type, *args, **kwargs):
"""
Creates and adds a breakpoint which would trigger on `event_type`. Additional arguments are passed to the
:class:`BP` constructor.
:return: The created breakpoint, so that it can be removed later.
"""
bp = BP... | def make_breakpoint(self, event_type, *args, **kwargs):
"""
Creates and adds a breakpoint which would trigger on `event_type`. Additional arguments are passed to the
:class:`BP` constructor.
:return: The created breakpoint, so that it can be removed later.
"""
bp = BP... | [
"Creates",
"and",
"adds",
"a",
"breakpoint",
"which",
"would",
"trigger",
"on",
"event_type",
".",
"Additional",
"arguments",
"are",
"passed",
"to",
"the",
":",
"class",
":",
"BP",
"constructor",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/inspect.py#L251-L260 | [
"def",
"make_breakpoint",
"(",
"self",
",",
"event_type",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"bp",
"=",
"BP",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"add_breakpoint",
"(",
"event_type",
",",
"bp",
")",
"retur... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimInspector.add_breakpoint | Adds a breakpoint which would trigger on `event_type`.
:param event_type: The event type to trigger on
:param bp: The breakpoint
:return: The created breakpoint. | angr/state_plugins/inspect.py | def add_breakpoint(self, event_type, bp):
"""
Adds a breakpoint which would trigger on `event_type`.
:param event_type: The event type to trigger on
:param bp: The breakpoint
:return: The created breakpoint.
"""
if event_type not in event_typ... | def add_breakpoint(self, event_type, bp):
"""
Adds a breakpoint which would trigger on `event_type`.
:param event_type: The event type to trigger on
:param bp: The breakpoint
:return: The created breakpoint.
"""
if event_type not in event_typ... | [
"Adds",
"a",
"breakpoint",
"which",
"would",
"trigger",
"on",
"event_type",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/inspect.py#L264-L276 | [
"def",
"add_breakpoint",
"(",
"self",
",",
"event_type",
",",
"bp",
")",
":",
"if",
"event_type",
"not",
"in",
"event_types",
":",
"raise",
"ValueError",
"(",
"\"Invalid event type %s passed in. Should be one of: %s\"",
"%",
"(",
"event_type",
",",
"\", \"",
".",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimInspector.remove_breakpoint | Removes a breakpoint.
:param bp: The breakpoint to remove.
:param filter_func: A filter function to specify whether each breakpoint should be removed or not. | angr/state_plugins/inspect.py | def remove_breakpoint(self, event_type, bp=None, filter_func=None):
"""
Removes a breakpoint.
:param bp: The breakpoint to remove.
:param filter_func: A filter function to specify whether each breakpoint should be removed or not.
"""
if bp is None and filter_func is No... | def remove_breakpoint(self, event_type, bp=None, filter_func=None):
"""
Removes a breakpoint.
:param bp: The breakpoint to remove.
:param filter_func: A filter function to specify whether each breakpoint should be removed or not.
"""
if bp is None and filter_func is No... | [
"Removes",
"a",
"breakpoint",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/inspect.py#L278-L296 | [
"def",
"remove_breakpoint",
"(",
"self",
",",
"event_type",
",",
"bp",
"=",
"None",
",",
"filter_func",
"=",
"None",
")",
":",
"if",
"bp",
"is",
"None",
"and",
"filter_func",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'remove_breakpoint(): You must specif... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimInspector.downsize | Remove previously stored attributes from this plugin instance to save memory.
This method is supposed to be called by breakpoint implementors. A typical workflow looks like the following :
>>> # Add `attr0` and `attr1` to `self.state.inspect`
>>> self.state.inspect(xxxxxx, attr0=yyyy, attr1=zzz... | angr/state_plugins/inspect.py | def downsize(self):
"""
Remove previously stored attributes from this plugin instance to save memory.
This method is supposed to be called by breakpoint implementors. A typical workflow looks like the following :
>>> # Add `attr0` and `attr1` to `self.state.inspect`
>>> self.sta... | def downsize(self):
"""
Remove previously stored attributes from this plugin instance to save memory.
This method is supposed to be called by breakpoint implementors. A typical workflow looks like the following :
>>> # Add `attr0` and `attr1` to `self.state.inspect`
>>> self.sta... | [
"Remove",
"previously",
"stored",
"attributes",
"from",
"this",
"plugin",
"instance",
"to",
"save",
"memory",
".",
"This",
"method",
"is",
"supposed",
"to",
"be",
"called",
"by",
"breakpoint",
"implementors",
".",
"A",
"typical",
"workflow",
"looks",
"like",
"... | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/inspect.py#L308-L323 | [
"def",
"downsize",
"(",
"self",
")",
":",
"for",
"k",
"in",
"inspect_attributes",
":",
"if",
"hasattr",
"(",
"self",
",",
"k",
")",
":",
"setattr",
"(",
"self",
",",
"k",
",",
"None",
")"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimUserland.syscall | Given a state, return the procedure corresponding to the current syscall.
This procedure will have .syscall_number, .display_name, and .addr set.
:param state: The state to get the syscall number from
:param allow_unsupported: Whether to return a "dummy" sycall instead of raisin... | angr/simos/userland.py | def syscall(self, state, allow_unsupported=True):
"""
Given a state, return the procedure corresponding to the current syscall.
This procedure will have .syscall_number, .display_name, and .addr set.
:param state: The state to get the syscall number from
:param all... | def syscall(self, state, allow_unsupported=True):
"""
Given a state, return the procedure corresponding to the current syscall.
This procedure will have .syscall_number, .display_name, and .addr set.
:param state: The state to get the syscall number from
:param all... | [
"Given",
"a",
"state",
"return",
"the",
"procedure",
"corresponding",
"to",
"the",
"current",
"syscall",
".",
"This",
"procedure",
"will",
"have",
".",
"syscall_number",
".",
"display_name",
"and",
".",
"addr",
"set",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/userland.py#L47-L78 | [
"def",
"syscall",
"(",
"self",
",",
"state",
",",
"allow_unsupported",
"=",
"True",
")",
":",
"abi",
"=",
"self",
".",
"syscall_abi",
"(",
"state",
")",
"if",
"state",
".",
"os_name",
"in",
"SYSCALL_CC",
"[",
"state",
".",
"arch",
".",
"name",
"]",
"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimUserland.is_syscall_addr | Return whether or not the given address corresponds to a syscall implementation. | angr/simos/userland.py | def is_syscall_addr(self, addr):
"""
Return whether or not the given address corresponds to a syscall implementation.
"""
if self.kernel_base is None or addr < self.kernel_base:
return False
addr -= self.kernel_base
if addr % self.syscall_addr_alignment != 0... | def is_syscall_addr(self, addr):
"""
Return whether or not the given address corresponds to a syscall implementation.
"""
if self.kernel_base is None or addr < self.kernel_base:
return False
addr -= self.kernel_base
if addr % self.syscall_addr_alignment != 0... | [
"Return",
"whether",
"or",
"not",
"the",
"given",
"address",
"corresponds",
"to",
"a",
"syscall",
"implementation",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/userland.py#L86-L99 | [
"def",
"is_syscall_addr",
"(",
"self",
",",
"addr",
")",
":",
"if",
"self",
".",
"kernel_base",
"is",
"None",
"or",
"addr",
"<",
"self",
".",
"kernel_base",
":",
"return",
"False",
"addr",
"-=",
"self",
".",
"kernel_base",
"if",
"addr",
"%",
"self",
".... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimUserland.syscall_from_addr | Get a syscall SimProcedure from an address.
:param addr: The address to convert to a syscall SimProcedure
:param allow_unsupported: Whether to return a dummy procedure for an unsupported syscall instead of raising an
exception.
:return: The SimProcedure for the... | angr/simos/userland.py | def syscall_from_addr(self, addr, allow_unsupported=True):
"""
Get a syscall SimProcedure from an address.
:param addr: The address to convert to a syscall SimProcedure
:param allow_unsupported: Whether to return a dummy procedure for an unsupported syscall instead of raising an
... | def syscall_from_addr(self, addr, allow_unsupported=True):
"""
Get a syscall SimProcedure from an address.
:param addr: The address to convert to a syscall SimProcedure
:param allow_unsupported: Whether to return a dummy procedure for an unsupported syscall instead of raising an
... | [
"Get",
"a",
"syscall",
"SimProcedure",
"from",
"an",
"address",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/userland.py#L101-L122 | [
"def",
"syscall_from_addr",
"(",
"self",
",",
"addr",
",",
"allow_unsupported",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"is_syscall_addr",
"(",
"addr",
")",
":",
"return",
"None",
"number",
"=",
"(",
"addr",
"-",
"self",
".",
"kernel_base",
")",... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimUserland.syscall_from_number | Get a syscall SimProcedure from its number.
:param number: The syscall number
:param allow_unsupported: Whether to return a "stub" syscall for unsupported numbers instead of throwing an error
:param abi: The name of the abi to use. If None, will assume that the ab... | angr/simos/userland.py | def syscall_from_number(self, number, allow_unsupported=True, abi=None):
"""
Get a syscall SimProcedure from its number.
:param number: The syscall number
:param allow_unsupported: Whether to return a "stub" syscall for unsupported numbers instead of throwing an error
... | def syscall_from_number(self, number, allow_unsupported=True, abi=None):
"""
Get a syscall SimProcedure from its number.
:param number: The syscall number
:param allow_unsupported: Whether to return a "stub" syscall for unsupported numbers instead of throwing an error
... | [
"Get",
"a",
"syscall",
"SimProcedure",
"from",
"its",
"number",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/userland.py#L124-L152 | [
"def",
"syscall_from_number",
"(",
"self",
",",
"number",
",",
"allow_unsupported",
"=",
"True",
",",
"abi",
"=",
"None",
")",
":",
"abilist",
"=",
"self",
".",
"syscall_abis",
"if",
"abi",
"is",
"None",
"else",
"[",
"abi",
"]",
"if",
"self",
".",
"sys... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | convert_prot | Convert from a windows memory protection constant to an angr bitmask | angr/procedures/win32/VirtualAlloc.py | def convert_prot(prot):
"""
Convert from a windows memory protection constant to an angr bitmask
"""
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa366786(v=vs.85).aspx
if prot & 0x10:
return 4
if prot & 0x20:
return 5
if prot & 0x40:
return 7
if pro... | def convert_prot(prot):
"""
Convert from a windows memory protection constant to an angr bitmask
"""
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa366786(v=vs.85).aspx
if prot & 0x10:
return 4
if prot & 0x20:
return 5
if prot & 0x40:
return 7
if pro... | [
"Convert",
"from",
"a",
"windows",
"memory",
"protection",
"constant",
"to",
"an",
"angr",
"bitmask"
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/win32/VirtualAlloc.py#L6-L27 | [
"def",
"convert_prot",
"(",
"prot",
")",
":",
"# https://msdn.microsoft.com/en-us/library/windows/desktop/aa366786(v=vs.85).aspx",
"if",
"prot",
"&",
"0x10",
":",
"return",
"4",
"if",
"prot",
"&",
"0x20",
":",
"return",
"5",
"if",
"prot",
"&",
"0x40",
":",
"return... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | LiveDefinitions.copy | Make a hard copy of `self`.
:return: A new LiveDefinition instance.
:rtype: angr.analyses.ddg.LiveDefinitions | angr/analyses/ddg.py | def copy(self):
"""
Make a hard copy of `self`.
:return: A new LiveDefinition instance.
:rtype: angr.analyses.ddg.LiveDefinitions
"""
ld = LiveDefinitions()
ld._memory_map = self._memory_map.copy()
ld._register_map = self._register_map.copy()
ld.... | def copy(self):
"""
Make a hard copy of `self`.
:return: A new LiveDefinition instance.
:rtype: angr.analyses.ddg.LiveDefinitions
"""
ld = LiveDefinitions()
ld._memory_map = self._memory_map.copy()
ld._register_map = self._register_map.copy()
ld.... | [
"Make",
"a",
"hard",
"copy",
"of",
"self",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L137-L150 | [
"def",
"copy",
"(",
"self",
")",
":",
"ld",
"=",
"LiveDefinitions",
"(",
")",
"ld",
".",
"_memory_map",
"=",
"self",
".",
"_memory_map",
".",
"copy",
"(",
")",
"ld",
".",
"_register_map",
"=",
"self",
".",
"_register_map",
".",
"copy",
"(",
")",
"ld"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | LiveDefinitions.add_def | Add a new definition of variable.
:param SimVariable variable: The variable being defined.
:param CodeLocation location: Location of the varaible being defined.
:param int size_threshold: The maximum bytes to consider for the variable.
:return: True if the definition was new, False othe... | angr/analyses/ddg.py | def add_def(self, variable, location, size_threshold=32):
"""
Add a new definition of variable.
:param SimVariable variable: The variable being defined.
:param CodeLocation location: Location of the varaible being defined.
:param int size_threshold: The maximum bytes to consider... | def add_def(self, variable, location, size_threshold=32):
"""
Add a new definition of variable.
:param SimVariable variable: The variable being defined.
:param CodeLocation location: Location of the varaible being defined.
:param int size_threshold: The maximum bytes to consider... | [
"Add",
"a",
"new",
"definition",
"of",
"variable",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L152-L194 | [
"def",
"add_def",
"(",
"self",
",",
"variable",
",",
"location",
",",
"size_threshold",
"=",
"32",
")",
":",
"new_defs_added",
"=",
"False",
"if",
"isinstance",
"(",
"variable",
",",
"SimRegisterVariable",
")",
":",
"if",
"variable",
".",
"reg",
"is",
"Non... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | LiveDefinitions.add_defs | Add a collection of new definitions of a variable.
:param SimVariable variable: The variable being defined.
:param iterable locations: A collection of locations where the variable was defined.
:param int size_threshold: The maximum bytes to consider for the variable.
:return: True if an... | angr/analyses/ddg.py | def add_defs(self, variable, locations, size_threshold=32):
"""
Add a collection of new definitions of a variable.
:param SimVariable variable: The variable being defined.
:param iterable locations: A collection of locations where the variable was defined.
:param int size_thresh... | def add_defs(self, variable, locations, size_threshold=32):
"""
Add a collection of new definitions of a variable.
:param SimVariable variable: The variable being defined.
:param iterable locations: A collection of locations where the variable was defined.
:param int size_thresh... | [
"Add",
"a",
"collection",
"of",
"new",
"definitions",
"of",
"a",
"variable",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L196-L212 | [
"def",
"add_defs",
"(",
"self",
",",
"variable",
",",
"locations",
",",
"size_threshold",
"=",
"32",
")",
":",
"new_defs_added",
"=",
"False",
"for",
"loc",
"in",
"locations",
":",
"new_defs_added",
"|=",
"self",
".",
"add_def",
"(",
"variable",
",",
"loc"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | LiveDefinitions.kill_def | Add a new definition for variable and kill all previous definitions.
:param SimVariable variable: The variable to kill.
:param CodeLocation location: The location where this variable is defined.
:param int size_threshold: The maximum bytes to consider for the variable.
:return: None | angr/analyses/ddg.py | def kill_def(self, variable, location, size_threshold=32):
"""
Add a new definition for variable and kill all previous definitions.
:param SimVariable variable: The variable to kill.
:param CodeLocation location: The location where this variable is defined.
:param int size_thres... | def kill_def(self, variable, location, size_threshold=32):
"""
Add a new definition for variable and kill all previous definitions.
:param SimVariable variable: The variable to kill.
:param CodeLocation location: The location where this variable is defined.
:param int size_thres... | [
"Add",
"a",
"new",
"definition",
"for",
"variable",
"and",
"kill",
"all",
"previous",
"definitions",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L214-L247 | [
"def",
"kill_def",
"(",
"self",
",",
"variable",
",",
"location",
",",
"size_threshold",
"=",
"32",
")",
":",
"if",
"isinstance",
"(",
"variable",
",",
"SimRegisterVariable",
")",
":",
"if",
"variable",
".",
"reg",
"is",
"None",
":",
"l",
".",
"warning",... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | LiveDefinitions.lookup_defs | Find all definitions of the varaible
:param SimVariable variable: The variable to lookup for.
:param int size_threshold: The maximum bytes to consider for the variable. For example, if the variable is 100
byte long, only the first `size_threshold` bytes are considered... | angr/analyses/ddg.py | def lookup_defs(self, variable, size_threshold=32):
"""
Find all definitions of the varaible
:param SimVariable variable: The variable to lookup for.
:param int size_threshold: The maximum bytes to consider for the variable. For example, if the variable is 100
... | def lookup_defs(self, variable, size_threshold=32):
"""
Find all definitions of the varaible
:param SimVariable variable: The variable to lookup for.
:param int size_threshold: The maximum bytes to consider for the variable. For example, if the variable is 100
... | [
"Find",
"all",
"definitions",
"of",
"the",
"varaible"
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L249-L287 | [
"def",
"lookup_defs",
"(",
"self",
",",
"variable",
",",
"size_threshold",
"=",
"32",
")",
":",
"live_def_locs",
"=",
"set",
"(",
")",
"if",
"isinstance",
"(",
"variable",
",",
"SimRegisterVariable",
")",
":",
"if",
"variable",
".",
"reg",
"is",
"None",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDGViewItem._to_viewitem | Convert a ProgramVariable instance to a DDGViewItem object.
:param ProgramVariable prog_var: The ProgramVariable object to convert.
:return: The converted DDGViewItem object.
:rtype: DDGViewItem | angr/analyses/ddg.py | def _to_viewitem(self, prog_var):
"""
Convert a ProgramVariable instance to a DDGViewItem object.
:param ProgramVariable prog_var: The ProgramVariable object to convert.
:return: The converted DDGViewItem object.
:rtype: DDGViewIt... | def _to_viewitem(self, prog_var):
"""
Convert a ProgramVariable instance to a DDGViewItem object.
:param ProgramVariable prog_var: The ProgramVariable object to convert.
:return: The converted DDGViewItem object.
:rtype: DDGViewIt... | [
"Convert",
"a",
"ProgramVariable",
"instance",
"to",
"a",
"DDGViewItem",
"object",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L342-L351 | [
"def",
"_to_viewitem",
"(",
"self",
",",
"prog_var",
")",
":",
"return",
"DDGViewItem",
"(",
"self",
".",
"_ddg",
",",
"prog_var",
",",
"simplified",
"=",
"self",
".",
"_simplified",
")"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDGViewInstruction.definitions | Get all definitions located at the current instruction address.
:return: A list of ProgramVariable instances.
:rtype: list | angr/analyses/ddg.py | def definitions(self):
"""
Get all definitions located at the current instruction address.
:return: A list of ProgramVariable instances.
:rtype: list
"""
defs = set()
if self._simplified:
graph = self._ddg.simplified_data_graph
else:
... | def definitions(self):
"""
Get all definitions located at the current instruction address.
:return: A list of ProgramVariable instances.
:rtype: list
"""
defs = set()
if self._simplified:
graph = self._ddg.simplified_data_graph
else:
... | [
"Get",
"all",
"definitions",
"located",
"at",
"the",
"current",
"instruction",
"address",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L404-L423 | [
"def",
"definitions",
"(",
"self",
")",
":",
"defs",
"=",
"set",
"(",
")",
"if",
"self",
".",
"_simplified",
":",
"graph",
"=",
"self",
".",
"_ddg",
".",
"simplified_data_graph",
"else",
":",
"graph",
"=",
"self",
".",
"_ddg",
".",
"data_graph",
"for",... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG.pp | Pretty printing. | angr/analyses/ddg.py | def pp(self):
"""
Pretty printing.
"""
# TODO: make it prettier
for src, dst, data in self.graph.edges(data=True):
print("%s <-- %s, %s" % (src, dst, data)) | def pp(self):
"""
Pretty printing.
"""
# TODO: make it prettier
for src, dst, data in self.graph.edges(data=True):
print("%s <-- %s, %s" % (src, dst, data)) | [
"Pretty",
"printing",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L549-L555 | [
"def",
"pp",
"(",
"self",
")",
":",
"# TODO: make it prettier",
"for",
"src",
",",
"dst",
",",
"data",
"in",
"self",
".",
"graph",
".",
"edges",
"(",
"data",
"=",
"True",
")",
":",
"print",
"(",
"\"%s <-- %s, %s\"",
"%",
"(",
"src",
",",
"dst",
",",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG.function_dependency_graph | Get a dependency graph for the function `func`.
:param func: The Function object in CFG.function_manager.
:returns: A networkx.DiGraph instance. | angr/analyses/ddg.py | def function_dependency_graph(self, func):
"""
Get a dependency graph for the function `func`.
:param func: The Function object in CFG.function_manager.
:returns: A networkx.DiGraph instance.
"""
if self._function_data_dependencies is None:
self._bu... | def function_dependency_graph(self, func):
"""
Get a dependency graph for the function `func`.
:param func: The Function object in CFG.function_manager.
:returns: A networkx.DiGraph instance.
"""
if self._function_data_dependencies is None:
self._bu... | [
"Get",
"a",
"dependency",
"graph",
"for",
"the",
"function",
"func",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L584-L599 | [
"def",
"function_dependency_graph",
"(",
"self",
",",
"func",
")",
":",
"if",
"self",
".",
"_function_data_dependencies",
"is",
"None",
":",
"self",
".",
"_build_function_dependency_graphs",
"(",
")",
"if",
"func",
"in",
"self",
".",
"_function_data_dependencies",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG.data_sub_graph | Get a subgraph from the data graph or the simplified data graph that starts from node pv.
:param ProgramVariable pv: The starting point of the subgraph.
:param bool simplified: When True, the simplified data graph is used, otherwise the data graph is used.
:param bool killing_edges: Are killing... | angr/analyses/ddg.py | def data_sub_graph(self, pv, simplified=True, killing_edges=False, excluding_types=None):
"""
Get a subgraph from the data graph or the simplified data graph that starts from node pv.
:param ProgramVariable pv: The starting point of the subgraph.
:param bool simplified: When True, the s... | def data_sub_graph(self, pv, simplified=True, killing_edges=False, excluding_types=None):
"""
Get a subgraph from the data graph or the simplified data graph that starts from node pv.
:param ProgramVariable pv: The starting point of the subgraph.
:param bool simplified: When True, the s... | [
"Get",
"a",
"subgraph",
"from",
"the",
"data",
"graph",
"or",
"the",
"simplified",
"data",
"graph",
"that",
"starts",
"from",
"node",
"pv",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L601-L647 | [
"def",
"data_sub_graph",
"(",
"self",
",",
"pv",
",",
"simplified",
"=",
"True",
",",
"killing_edges",
"=",
"False",
",",
"excluding_types",
"=",
"None",
")",
":",
"result",
"=",
"networkx",
".",
"MultiDiGraph",
"(",
")",
"result",
".",
"add_node",
"(",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG._construct | Construct the data dependence graph.
We track the following types of dependence:
- (Intra-IRSB) temporary variable dependencies
- Register dependencies
- Memory dependencies, although it's very limited. See below.
We track the following types of memory access:
- (Intra-... | angr/analyses/ddg.py | def _construct(self):
"""
Construct the data dependence graph.
We track the following types of dependence:
- (Intra-IRSB) temporary variable dependencies
- Register dependencies
- Memory dependencies, although it's very limited. See below.
We track the following... | def _construct(self):
"""
Construct the data dependence graph.
We track the following types of dependence:
- (Intra-IRSB) temporary variable dependencies
- Register dependencies
- Memory dependencies, although it's very limited. See below.
We track the following... | [
"Construct",
"the",
"data",
"dependence",
"graph",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L653-L791 | [
"def",
"_construct",
"(",
"self",
")",
":",
"worklist",
"=",
"[",
"]",
"worklist_set",
"=",
"set",
"(",
")",
"# Initialize the worklist",
"if",
"self",
".",
"_start",
"is",
"None",
":",
"# initial nodes are those nodes in CFG that has no in-degrees",
"for",
"n",
"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG._track | Given all live definitions prior to this program point, track the changes, and return a new list of live
definitions. We scan through the action list of the new state to track the changes.
:param state: The input state at that program point.
:param live_defs: All live definition... | angr/analyses/ddg.py | def _track(self, state, live_defs, statements):
"""
Given all live definitions prior to this program point, track the changes, and return a new list of live
definitions. We scan through the action list of the new state to track the changes.
:param state: The input state at tha... | def _track(self, state, live_defs, statements):
"""
Given all live definitions prior to this program point, track the changes, and return a new list of live
definitions. We scan through the action list of the new state to track the changes.
:param state: The input state at tha... | [
"Given",
"all",
"live",
"definitions",
"prior",
"to",
"this",
"program",
"point",
"track",
"the",
"changes",
"and",
"return",
"a",
"new",
"list",
"of",
"live",
"definitions",
".",
"We",
"scan",
"through",
"the",
"action",
"list",
"of",
"the",
"new",
"state... | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L793-L853 | [
"def",
"_track",
"(",
"self",
",",
"state",
",",
"live_defs",
",",
"statements",
")",
":",
"# Make a copy of live_defs",
"self",
".",
"_live_defs",
"=",
"live_defs",
".",
"copy",
"(",
")",
"action_list",
"=",
"list",
"(",
"state",
".",
"history",
".",
"rec... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG._def_lookup | This is a backward lookup in the previous defs. Note that, as we are using VSA, it is possible that `variable`
is affected by several definitions.
:param angr.analyses.ddg.LiveDefinitions live_defs:
The collection of live definitions.
:param SimVariable: The variable... | angr/analyses/ddg.py | def _def_lookup(self, variable): # pylint:disable=no-self-use
"""
This is a backward lookup in the previous defs. Note that, as we are using VSA, it is possible that `variable`
is affected by several definitions.
:param angr.analyses.ddg.LiveDefinitions live_defs:
... | def _def_lookup(self, variable): # pylint:disable=no-self-use
"""
This is a backward lookup in the previous defs. Note that, as we are using VSA, it is possible that `variable`
is affected by several definitions.
:param angr.analyses.ddg.LiveDefinitions live_defs:
... | [
"This",
"is",
"a",
"backward",
"lookup",
"in",
"the",
"previous",
"defs",
".",
"Note",
"that",
"as",
"we",
"are",
"using",
"VSA",
"it",
"is",
"possible",
"that",
"variable",
"is",
"affected",
"by",
"several",
"definitions",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L855-L883 | [
"def",
"_def_lookup",
"(",
"self",
",",
"variable",
")",
":",
"# pylint:disable=no-self-use",
"prevdefs",
"=",
"{",
"}",
"for",
"code_loc",
"in",
"self",
".",
"_live_defs",
".",
"lookup_defs",
"(",
"variable",
")",
":",
"# Label edges with cardinality or actual sets... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG._kill | Kill previous defs. addr_list is a list of normalized addresses. | angr/analyses/ddg.py | def _kill(self, variable, code_loc): # pylint:disable=no-self-use
"""
Kill previous defs. addr_list is a list of normalized addresses.
"""
# Case 1: address perfectly match, we kill
# Case 2: a is a subset of the original address
# Case 3: a is a superset of the origina... | def _kill(self, variable, code_loc): # pylint:disable=no-self-use
"""
Kill previous defs. addr_list is a list of normalized addresses.
"""
# Case 1: address perfectly match, we kill
# Case 2: a is a subset of the original address
# Case 3: a is a superset of the origina... | [
"Kill",
"previous",
"defs",
".",
"addr_list",
"is",
"a",
"list",
"of",
"normalized",
"addresses",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L885-L901 | [
"def",
"_kill",
"(",
"self",
",",
"variable",
",",
"code_loc",
")",
":",
"# pylint:disable=no-self-use",
"# Case 1: address perfectly match, we kill",
"# Case 2: a is a subset of the original address",
"# Case 3: a is a superset of the original address",
"# the previous definition is kil... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG._get_register_size | Get the size of a register.
:param int reg_offset: Offset of the register.
:return: Size in bytes.
:rtype: int | angr/analyses/ddg.py | def _get_register_size(self, reg_offset):
"""
Get the size of a register.
:param int reg_offset: Offset of the register.
:return: Size in bytes.
:rtype: int
"""
# TODO: support registers that are not aligned
if reg_offset in self.project.arch.register_na... | def _get_register_size(self, reg_offset):
"""
Get the size of a register.
:param int reg_offset: Offset of the register.
:return: Size in bytes.
:rtype: int
"""
# TODO: support registers that are not aligned
if reg_offset in self.project.arch.register_na... | [
"Get",
"the",
"size",
"of",
"a",
"register",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L903-L920 | [
"def",
"_get_register_size",
"(",
"self",
",",
"reg_offset",
")",
":",
"# TODO: support registers that are not aligned",
"if",
"reg_offset",
"in",
"self",
".",
"project",
".",
"arch",
".",
"register_names",
":",
"reg_name",
"=",
"self",
".",
"project",
".",
"arch"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG._get_actual_addrs | For memory actions, get a list of addresses it operates on.
:param SimAction action: The action object to work with.
:return: A list of addresses that are accessed with that action.
:rtype: list | angr/analyses/ddg.py | def _get_actual_addrs(action, state):
"""
For memory actions, get a list of addresses it operates on.
:param SimAction action: The action object to work with.
:return: A list of addresses that are accessed with that action.
:rtype: list
"... | def _get_actual_addrs(action, state):
"""
For memory actions, get a list of addresses it operates on.
:param SimAction action: The action object to work with.
:return: A list of addresses that are accessed with that action.
:rtype: list
"... | [
"For",
"memory",
"actions",
"get",
"a",
"list",
"of",
"addresses",
"it",
"operates",
"on",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L927-L948 | [
"def",
"_get_actual_addrs",
"(",
"action",
",",
"state",
")",
":",
"if",
"action",
".",
"actual_addrs",
"is",
"None",
":",
"# For now, mem reads don't necessarily have actual_addrs set properly",
"try",
":",
"addr_list",
"=",
"{",
"state",
".",
"solver",
".",
"eval"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG._create_memory_variable | Create a SimStackVariable or SimMemoryVariable based on action objects and its address.
:param SimAction action: The action to work with.
:param int addr: The address of the memory variable in creation.
:param list addrs: A list of all addresses that the action was effective on.
... | angr/analyses/ddg.py | def _create_memory_variable(self, action, addr, addrs):
"""
Create a SimStackVariable or SimMemoryVariable based on action objects and its address.
:param SimAction action: The action to work with.
:param int addr: The address of the memory variable in creation.
:param l... | def _create_memory_variable(self, action, addr, addrs):
"""
Create a SimStackVariable or SimMemoryVariable based on action objects and its address.
:param SimAction action: The action to work with.
:param int addr: The address of the memory variable in creation.
:param l... | [
"Create",
"a",
"SimStackVariable",
"or",
"SimMemoryVariable",
"based",
"on",
"action",
"objects",
"and",
"its",
"address",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L950-L971 | [
"def",
"_create_memory_variable",
"(",
"self",
",",
"action",
",",
"addr",
",",
"addrs",
")",
":",
"variable",
"=",
"None",
"if",
"len",
"(",
"addrs",
")",
"==",
"1",
"and",
"len",
"(",
"action",
".",
"addr",
".",
"tmp_deps",
")",
"==",
"1",
":",
"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG._data_graph_add_edge | Add an edge in the data dependence graph.
:param ProgramVariable src: Source node.
:param ProgramVariable dst: Destination node.
:param edge_labels: All labels associated with the edge.
:return: None | angr/analyses/ddg.py | def _data_graph_add_edge(self, src, dst, **edge_labels):
"""
Add an edge in the data dependence graph.
:param ProgramVariable src: Source node.
:param ProgramVariable dst: Destination node.
:param edge_labels: All labels associated with the edge.
:return: None
""... | def _data_graph_add_edge(self, src, dst, **edge_labels):
"""
Add an edge in the data dependence graph.
:param ProgramVariable src: Source node.
:param ProgramVariable dst: Destination node.
:param edge_labels: All labels associated with the edge.
:return: None
""... | [
"Add",
"an",
"edge",
"in",
"the",
"data",
"dependence",
"graph",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1299-L1314 | [
"def",
"_data_graph_add_edge",
"(",
"self",
",",
"src",
",",
"dst",
",",
"*",
"*",
"edge_labels",
")",
":",
"if",
"src",
"in",
"self",
".",
"_data_graph",
"and",
"dst",
"in",
"self",
".",
"_data_graph",
"[",
"src",
"]",
":",
"return",
"self",
".",
"_... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG._stmt_graph_add_edge | Add an edge in the statement dependence graph from a program location `src` to another program location `dst`.
:param CodeLocation src: Source node.
:param CodeLocation dst: Destination node.
:param edge_labels: All labels associated with the edge.
:returns: None | angr/analyses/ddg.py | def _stmt_graph_add_edge(self, src, dst, **edge_labels):
"""
Add an edge in the statement dependence graph from a program location `src` to another program location `dst`.
:param CodeLocation src: Source node.
:param CodeLocation dst: Destination node.
:param edge_labels: All la... | def _stmt_graph_add_edge(self, src, dst, **edge_labels):
"""
Add an edge in the statement dependence graph from a program location `src` to another program location `dst`.
:param CodeLocation src: Source node.
:param CodeLocation dst: Destination node.
:param edge_labels: All la... | [
"Add",
"an",
"edge",
"in",
"the",
"statement",
"dependence",
"graph",
"from",
"a",
"program",
"location",
"src",
"to",
"another",
"program",
"location",
"dst",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1316-L1331 | [
"def",
"_stmt_graph_add_edge",
"(",
"self",
",",
"src",
",",
"dst",
",",
"*",
"*",
"edge_labels",
")",
":",
"# Is that edge already in the graph ?",
"# If at least one is new, then we are not redoing the same path again",
"if",
"src",
"in",
"self",
".",
"_stmt_graph",
"an... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG._stmt_graph_annotate_edges | Add new annotations to edges in the statement dependence graph.
:param list edges_to_annotate: A list of edges to annotate.
:param new_labels: New labels to be added to those edges.
:returns: None | angr/analyses/ddg.py | def _stmt_graph_annotate_edges(self, edges_to_annotate, **new_labels):
"""
Add new annotations to edges in the statement dependence graph.
:param list edges_to_annotate: A list of edges to annotate.
:param new_labels: New labels to be added to those edges.
:returns: None
... | def _stmt_graph_annotate_edges(self, edges_to_annotate, **new_labels):
"""
Add new annotations to edges in the statement dependence graph.
:param list edges_to_annotate: A list of edges to annotate.
:param new_labels: New labels to be added to those edges.
:returns: None
... | [
"Add",
"new",
"annotations",
"to",
"edges",
"in",
"the",
"statement",
"dependence",
"graph",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1333-L1359 | [
"def",
"_stmt_graph_annotate_edges",
"(",
"self",
",",
"edges_to_annotate",
",",
"*",
"*",
"new_labels",
")",
":",
"graph",
"=",
"self",
".",
"graph",
"for",
"src",
",",
"dst",
"in",
"edges_to_annotate",
":",
"if",
"src",
"not",
"in",
"graph",
":",
"contin... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG._simplify_data_graph | Simplify a data graph by removing all temp variable nodes on the graph.
:param networkx.DiGraph data_graph: The data dependence graph to simplify.
:return: The simplified graph.
:rtype: networkx.MultiDiGraph | angr/analyses/ddg.py | def _simplify_data_graph(self, data_graph): # pylint:disable=no-self-use
"""
Simplify a data graph by removing all temp variable nodes on the graph.
:param networkx.DiGraph data_graph: The data dependence graph to simplify.
:return: The simplified graph.
:rtype: networkx.MultiD... | def _simplify_data_graph(self, data_graph): # pylint:disable=no-self-use
"""
Simplify a data graph by removing all temp variable nodes on the graph.
:param networkx.DiGraph data_graph: The data dependence graph to simplify.
:return: The simplified graph.
:rtype: networkx.MultiD... | [
"Simplify",
"a",
"data",
"graph",
"by",
"removing",
"all",
"temp",
"variable",
"nodes",
"on",
"the",
"graph",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1361-L1394 | [
"def",
"_simplify_data_graph",
"(",
"self",
",",
"data_graph",
")",
":",
"# pylint:disable=no-self-use",
"graph",
"=",
"networkx",
".",
"MultiDiGraph",
"(",
"data_graph",
")",
"all_nodes",
"=",
"[",
"n",
"for",
"n",
"in",
"graph",
".",
"nodes",
"(",
")",
"if... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG._worklist_append | Append a CFGNode and its successors into the work-list, and respect the call-depth limit
:param node_wrapper: The NodeWrapper instance to insert.
:param worklist: The work-list, which is a list.
:param worklist_set: A set of all CFGNodes that are inside the work-list, just for the ... | angr/analyses/ddg.py | def _worklist_append(self, node_wrapper, worklist, worklist_set):
"""
Append a CFGNode and its successors into the work-list, and respect the call-depth limit
:param node_wrapper: The NodeWrapper instance to insert.
:param worklist: The work-list, which is a list.
:par... | def _worklist_append(self, node_wrapper, worklist, worklist_set):
"""
Append a CFGNode and its successors into the work-list, and respect the call-depth limit
:param node_wrapper: The NodeWrapper instance to insert.
:param worklist: The work-list, which is a list.
:par... | [
"Append",
"a",
"CFGNode",
"and",
"its",
"successors",
"into",
"the",
"work",
"-",
"list",
"and",
"respect",
"the",
"call",
"-",
"depth",
"limit"
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1396-L1452 | [
"def",
"_worklist_append",
"(",
"self",
",",
"node_wrapper",
",",
"worklist",
",",
"worklist_set",
")",
":",
"if",
"node_wrapper",
".",
"cfg_node",
"in",
"worklist_set",
":",
"# It's already in the work-list",
"return",
"worklist",
".",
"append",
"(",
"node_wrapper"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG._build_function_dependency_graphs | Build dependency graphs for each function, and save them in self._function_data_dependencies. | angr/analyses/ddg.py | def _build_function_dependency_graphs(self):
"""
Build dependency graphs for each function, and save them in self._function_data_dependencies.
"""
# This is a map between functions and its corresponding dependencies
self._function_data_dependencies = defaultdict(networkx.DiGraph... | def _build_function_dependency_graphs(self):
"""
Build dependency graphs for each function, and save them in self._function_data_dependencies.
"""
# This is a map between functions and its corresponding dependencies
self._function_data_dependencies = defaultdict(networkx.DiGraph... | [
"Build",
"dependency",
"graphs",
"for",
"each",
"function",
"and",
"save",
"them",
"in",
"self",
".",
"_function_data_dependencies",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1454-L1478 | [
"def",
"_build_function_dependency_graphs",
"(",
"self",
")",
":",
"# This is a map between functions and its corresponding dependencies",
"self",
".",
"_function_data_dependencies",
"=",
"defaultdict",
"(",
"networkx",
".",
"DiGraph",
")",
"# Group all dependencies first",
"bloc... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG._filter_defs_at_call_sites | If we are not tracing into the function that are called in a real execution, we should properly filter the defs
to account for the behavior of the skipped function at this call site.
This function is a WIP. See TODOs inside.
:param defs:
:return: | angr/analyses/ddg.py | def _filter_defs_at_call_sites(self, defs):
"""
If we are not tracing into the function that are called in a real execution, we should properly filter the defs
to account for the behavior of the skipped function at this call site.
This function is a WIP. See TODOs inside.
:para... | def _filter_defs_at_call_sites(self, defs):
"""
If we are not tracing into the function that are called in a real execution, we should properly filter the defs
to account for the behavior of the skipped function at this call site.
This function is a WIP. See TODOs inside.
:para... | [
"If",
"we",
"are",
"not",
"tracing",
"into",
"the",
"function",
"that",
"are",
"called",
"in",
"a",
"real",
"execution",
"we",
"should",
"properly",
"filter",
"the",
"defs",
"to",
"account",
"for",
"the",
"behavior",
"of",
"the",
"skipped",
"function",
"at... | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1484-L1508 | [
"def",
"_filter_defs_at_call_sites",
"(",
"self",
",",
"defs",
")",
":",
"# TODO: make definition killing architecture independent and calling convention independent",
"# TODO: use information from a calling convention analysis",
"filtered_defs",
"=",
"LiveDefinitions",
"(",
")",
"for"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG.find_definitions | Find all definitions of the given variable.
:param SimVariable variable:
:param bool simplified_graph: True if you just want to search in the simplified graph instead of the normal
graph. Usually the simplified graph suffices for finding definitions of register
... | angr/analyses/ddg.py | def find_definitions(self, variable, location=None, simplified_graph=True):
"""
Find all definitions of the given variable.
:param SimVariable variable:
:param bool simplified_graph: True if you just want to search in the simplified graph instead of the normal
... | def find_definitions(self, variable, location=None, simplified_graph=True):
"""
Find all definitions of the given variable.
:param SimVariable variable:
:param bool simplified_graph: True if you just want to search in the simplified graph instead of the normal
... | [
"Find",
"all",
"definitions",
"of",
"the",
"given",
"variable",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1510-L1538 | [
"def",
"find_definitions",
"(",
"self",
",",
"variable",
",",
"location",
"=",
"None",
",",
"simplified_graph",
"=",
"True",
")",
":",
"if",
"simplified_graph",
":",
"graph",
"=",
"self",
".",
"simplified_data_graph",
"else",
":",
"graph",
"=",
"self",
".",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG.find_consumers | Find all consumers to the specified variable definition.
:param ProgramVariable var_def: The variable definition.
:param bool simplified_graph: True if we want to search in the simplified graph, False otherwise.
:return: A collection of all consumers to the specified variable definition.
... | angr/analyses/ddg.py | def find_consumers(self, var_def, simplified_graph=True):
"""
Find all consumers to the specified variable definition.
:param ProgramVariable var_def: The variable definition.
:param bool simplified_graph: True if we want to search in the simplified graph, False otherwise.
:retu... | def find_consumers(self, var_def, simplified_graph=True):
"""
Find all consumers to the specified variable definition.
:param ProgramVariable var_def: The variable definition.
:param bool simplified_graph: True if we want to search in the simplified graph, False otherwise.
:retu... | [
"Find",
"all",
"consumers",
"to",
"the",
"specified",
"variable",
"definition",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1541-L1578 | [
"def",
"find_consumers",
"(",
"self",
",",
"var_def",
",",
"simplified_graph",
"=",
"True",
")",
":",
"if",
"simplified_graph",
":",
"graph",
"=",
"self",
".",
"simplified_data_graph",
"else",
":",
"graph",
"=",
"self",
".",
"data_graph",
"if",
"var_def",
"n... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG.find_killers | Find all killers to the specified variable definition.
:param ProgramVariable var_def: The variable definition.
:param bool simplified_graph: True if we want to search in the simplified graph, False otherwise.
:return: A collection of all killers to the specified variable definition.
:r... | angr/analyses/ddg.py | def find_killers(self, var_def, simplified_graph=True):
"""
Find all killers to the specified variable definition.
:param ProgramVariable var_def: The variable definition.
:param bool simplified_graph: True if we want to search in the simplified graph, False otherwise.
:return: ... | def find_killers(self, var_def, simplified_graph=True):
"""
Find all killers to the specified variable definition.
:param ProgramVariable var_def: The variable definition.
:param bool simplified_graph: True if we want to search in the simplified graph, False otherwise.
:return: ... | [
"Find",
"all",
"killers",
"to",
"the",
"specified",
"variable",
"definition",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1581-L1605 | [
"def",
"find_killers",
"(",
"self",
",",
"var_def",
",",
"simplified_graph",
"=",
"True",
")",
":",
"if",
"simplified_graph",
":",
"graph",
"=",
"self",
".",
"simplified_data_graph",
"else",
":",
"graph",
"=",
"self",
".",
"data_graph",
"if",
"var_def",
"not... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | DDG.find_sources | Find all sources to the specified variable definition.
:param ProgramVariable var_def: The variable definition.
:param bool simplified_graph: True if we want to search in the simplified graph, False otherwise.
:return: A collection of all sources to the specified variable definition.
:r... | angr/analyses/ddg.py | def find_sources(self, var_def, simplified_graph=True):
"""
Find all sources to the specified variable definition.
:param ProgramVariable var_def: The variable definition.
:param bool simplified_graph: True if we want to search in the simplified graph, False otherwise.
:return: ... | def find_sources(self, var_def, simplified_graph=True):
"""
Find all sources to the specified variable definition.
:param ProgramVariable var_def: The variable definition.
:param bool simplified_graph: True if we want to search in the simplified graph, False otherwise.
:return: ... | [
"Find",
"all",
"sources",
"to",
"the",
"specified",
"variable",
"definition",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L1608-L1644 | [
"def",
"find_sources",
"(",
"self",
",",
"var_def",
",",
"simplified_graph",
"=",
"True",
")",
":",
"if",
"simplified_graph",
":",
"graph",
"=",
"self",
".",
"simplified_data_graph",
"else",
":",
"graph",
"=",
"self",
".",
"data_graph",
"if",
"var_def",
"not... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimSootExpr_NewMultiArray.new_array | Allocates a new multi array in memory and returns the reference to the base. | angr/engines/soot/expressions/newMultiArray.py | def new_array(state, element_type, size, default_value_generator=None):
"""
Allocates a new multi array in memory and returns the reference to the base.
"""
size_bounded = SimSootExpr_NewMultiArray._bound_multi_array_size(state, size)
# return the reference of the array base
... | def new_array(state, element_type, size, default_value_generator=None):
"""
Allocates a new multi array in memory and returns the reference to the base.
"""
size_bounded = SimSootExpr_NewMultiArray._bound_multi_array_size(state, size)
# return the reference of the array base
... | [
"Allocates",
"a",
"new",
"multi",
"array",
"in",
"memory",
"and",
"returns",
"the",
"reference",
"to",
"the",
"base",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/soot/expressions/newMultiArray.py#L21-L31 | [
"def",
"new_array",
"(",
"state",
",",
"element_type",
",",
"size",
",",
"default_value_generator",
"=",
"None",
")",
":",
"size_bounded",
"=",
"SimSootExpr_NewMultiArray",
".",
"_bound_multi_array_size",
"(",
"state",
",",
"size",
")",
"# return the reference of the ... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimConcretizationStrategy._min | Gets the minimum solution of an address. | angr/concretization_strategies/__init__.py | def _min(self, memory, addr, **kwargs):
"""
Gets the minimum solution of an address.
"""
return memory.state.solver.min(addr, exact=kwargs.pop('exact', self._exact), **kwargs) | def _min(self, memory, addr, **kwargs):
"""
Gets the minimum solution of an address.
"""
return memory.state.solver.min(addr, exact=kwargs.pop('exact', self._exact), **kwargs) | [
"Gets",
"the",
"minimum",
"solution",
"of",
"an",
"address",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/concretization_strategies/__init__.py#L21-L25 | [
"def",
"_min",
"(",
"self",
",",
"memory",
",",
"addr",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"memory",
".",
"state",
".",
"solver",
".",
"min",
"(",
"addr",
",",
"exact",
"=",
"kwargs",
".",
"pop",
"(",
"'exact'",
",",
"self",
".",
"_exac... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimConcretizationStrategy._max | Gets the maximum solution of an address. | angr/concretization_strategies/__init__.py | def _max(self, memory, addr, **kwargs):
"""
Gets the maximum solution of an address.
"""
return memory.state.solver.max(addr, exact=kwargs.pop('exact', self._exact), **kwargs) | def _max(self, memory, addr, **kwargs):
"""
Gets the maximum solution of an address.
"""
return memory.state.solver.max(addr, exact=kwargs.pop('exact', self._exact), **kwargs) | [
"Gets",
"the",
"maximum",
"solution",
"of",
"an",
"address",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/concretization_strategies/__init__.py#L27-L31 | [
"def",
"_max",
"(",
"self",
",",
"memory",
",",
"addr",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"memory",
".",
"state",
".",
"solver",
".",
"max",
"(",
"addr",
",",
"exact",
"=",
"kwargs",
".",
"pop",
"(",
"'exact'",
",",
"self",
".",
"_exac... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimConcretizationStrategy._any | Gets any solution of an address. | angr/concretization_strategies/__init__.py | def _any(self, memory, addr, **kwargs):
"""
Gets any solution of an address.
"""
return memory.state.solver.eval(addr, exact=kwargs.pop('exact', self._exact), **kwargs) | def _any(self, memory, addr, **kwargs):
"""
Gets any solution of an address.
"""
return memory.state.solver.eval(addr, exact=kwargs.pop('exact', self._exact), **kwargs) | [
"Gets",
"any",
"solution",
"of",
"an",
"address",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/concretization_strategies/__init__.py#L33-L37 | [
"def",
"_any",
"(",
"self",
",",
"memory",
",",
"addr",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"memory",
".",
"state",
".",
"solver",
".",
"eval",
"(",
"addr",
",",
"exact",
"=",
"kwargs",
".",
"pop",
"(",
"'exact'",
",",
"self",
".",
"_exa... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimConcretizationStrategy._eval | Gets n solutions for an address. | angr/concretization_strategies/__init__.py | def _eval(self, memory, addr, n, **kwargs):
"""
Gets n solutions for an address.
"""
return memory.state.solver.eval_upto(addr, n, exact=kwargs.pop('exact', self._exact), **kwargs) | def _eval(self, memory, addr, n, **kwargs):
"""
Gets n solutions for an address.
"""
return memory.state.solver.eval_upto(addr, n, exact=kwargs.pop('exact', self._exact), **kwargs) | [
"Gets",
"n",
"solutions",
"for",
"an",
"address",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/concretization_strategies/__init__.py#L39-L43 | [
"def",
"_eval",
"(",
"self",
",",
"memory",
",",
"addr",
",",
"n",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"memory",
".",
"state",
".",
"solver",
".",
"eval_upto",
"(",
"addr",
",",
"n",
",",
"exact",
"=",
"kwargs",
".",
"pop",
"(",
"'exact'... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimConcretizationStrategy._range | Gets the (min, max) range of solutions for an address. | angr/concretization_strategies/__init__.py | def _range(self, memory, addr, **kwargs):
"""
Gets the (min, max) range of solutions for an address.
"""
return (self._min(memory, addr, **kwargs), self._max(memory, addr, **kwargs)) | def _range(self, memory, addr, **kwargs):
"""
Gets the (min, max) range of solutions for an address.
"""
return (self._min(memory, addr, **kwargs), self._max(memory, addr, **kwargs)) | [
"Gets",
"the",
"(",
"min",
"max",
")",
"range",
"of",
"solutions",
"for",
"an",
"address",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/concretization_strategies/__init__.py#L45-L49 | [
"def",
"_range",
"(",
"self",
",",
"memory",
",",
"addr",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"(",
"self",
".",
"_min",
"(",
"memory",
",",
"addr",
",",
"*",
"*",
"kwargs",
")",
",",
"self",
".",
"_max",
"(",
"memory",
",",
"addr",
","... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimConcretizationStrategy.concretize | Concretizes the address into a list of values.
If this strategy cannot handle this address, returns None. | angr/concretization_strategies/__init__.py | def concretize(self, memory, addr):
"""
Concretizes the address into a list of values.
If this strategy cannot handle this address, returns None.
"""
if self._filter is None or self._filter(memory, addr):
return self._concretize(memory, addr) | def concretize(self, memory, addr):
"""
Concretizes the address into a list of values.
If this strategy cannot handle this address, returns None.
"""
if self._filter is None or self._filter(memory, addr):
return self._concretize(memory, addr) | [
"Concretizes",
"the",
"address",
"into",
"a",
"list",
"of",
"values",
".",
"If",
"this",
"strategy",
"cannot",
"handle",
"this",
"address",
"returns",
"None",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/concretization_strategies/__init__.py#L51-L57 | [
"def",
"concretize",
"(",
"self",
",",
"memory",
",",
"addr",
")",
":",
"if",
"self",
".",
"_filter",
"is",
"None",
"or",
"self",
".",
"_filter",
"(",
"memory",
",",
"addr",
")",
":",
"return",
"self",
".",
"_concretize",
"(",
"memory",
",",
"addr",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | CFGUtils.find_merge_points | Given a local transition graph of a function, find all merge points inside, and then perform a
quasi-topological sort of those merge points.
A merge point might be one of the following cases:
- two or more paths come together, and ends at the same address.
- end of the current function
... | angr/analyses/cfg/cfg_utils.py | def find_merge_points(function_addr, function_endpoints, graph): # pylint:disable=unused-argument
"""
Given a local transition graph of a function, find all merge points inside, and then perform a
quasi-topological sort of those merge points.
A merge point might be one of the following... | def find_merge_points(function_addr, function_endpoints, graph): # pylint:disable=unused-argument
"""
Given a local transition graph of a function, find all merge points inside, and then perform a
quasi-topological sort of those merge points.
A merge point might be one of the following... | [
"Given",
"a",
"local",
"transition",
"graph",
"of",
"a",
"function",
"find",
"all",
"merge",
"points",
"inside",
"and",
"then",
"perform",
"a",
"quasi",
"-",
"topological",
"sort",
"of",
"those",
"merge",
"points",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_utils.py#L25-L50 | [
"def",
"find_merge_points",
"(",
"function_addr",
",",
"function_endpoints",
",",
"graph",
")",
":",
"# pylint:disable=unused-argument",
"merge_points",
"=",
"set",
"(",
")",
"for",
"node",
"in",
"graph",
".",
"nodes",
"(",
")",
":",
"if",
"graph",
".",
"in_de... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | CFGUtils.find_widening_points | Given a local transition graph of a function, find all widening points inside.
Correctly choosing widening points is very important in order to not lose too much information during static
analysis. We mainly consider merge points that has at least one loop back edges coming in as widening points.
... | angr/analyses/cfg/cfg_utils.py | def find_widening_points(function_addr, function_endpoints, graph): # pylint: disable=unused-argument
"""
Given a local transition graph of a function, find all widening points inside.
Correctly choosing widening points is very important in order to not lose too much information during static
... | def find_widening_points(function_addr, function_endpoints, graph): # pylint: disable=unused-argument
"""
Given a local transition graph of a function, find all widening points inside.
Correctly choosing widening points is very important in order to not lose too much information during static
... | [
"Given",
"a",
"local",
"transition",
"graph",
"of",
"a",
"function",
"find",
"all",
"widening",
"points",
"inside",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_utils.py#L53-L84 | [
"def",
"find_widening_points",
"(",
"function_addr",
",",
"function_endpoints",
",",
"graph",
")",
":",
"# pylint: disable=unused-argument",
"sccs",
"=",
"networkx",
".",
"strongly_connected_components",
"(",
"graph",
")",
"widening_addrs",
"=",
"set",
"(",
")",
"for"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | CFGUtils.reverse_post_order_sort_nodes | Sort a given set of nodes in reverse post ordering.
:param networkx.DiGraph graph: A local transition graph of a function.
:param iterable nodes: A collection of nodes to sort.
:return: A list of sorted nodes.
:rtype: list | angr/analyses/cfg/cfg_utils.py | def reverse_post_order_sort_nodes(graph, nodes=None):
"""
Sort a given set of nodes in reverse post ordering.
:param networkx.DiGraph graph: A local transition graph of a function.
:param iterable nodes: A collection of nodes to sort.
:return: A list of sorted nodes.
:rt... | def reverse_post_order_sort_nodes(graph, nodes=None):
"""
Sort a given set of nodes in reverse post ordering.
:param networkx.DiGraph graph: A local transition graph of a function.
:param iterable nodes: A collection of nodes to sort.
:return: A list of sorted nodes.
:rt... | [
"Sort",
"a",
"given",
"set",
"of",
"nodes",
"in",
"reverse",
"post",
"ordering",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_utils.py#L87-L105 | [
"def",
"reverse_post_order_sort_nodes",
"(",
"graph",
",",
"nodes",
"=",
"None",
")",
":",
"post_order",
"=",
"networkx",
".",
"dfs_postorder_nodes",
"(",
"graph",
")",
"if",
"nodes",
"is",
"None",
":",
"return",
"reversed",
"(",
"list",
"(",
"post_order",
"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | CFGUtils.quasi_topological_sort_nodes | Sort a given set of nodes from a graph based on the following rules:
# - if A -> B and not B -> A, then we have A < B
# - if A -> B and B -> A, then the ordering is undefined
Following the above rules gives us a quasi-topological sorting of nodes in the graph. It also works for cyclic
... | angr/analyses/cfg/cfg_utils.py | def quasi_topological_sort_nodes(graph, nodes=None):
"""
Sort a given set of nodes from a graph based on the following rules:
# - if A -> B and not B -> A, then we have A < B
# - if A -> B and B -> A, then the ordering is undefined
Following the above rules gives us a quasi-top... | def quasi_topological_sort_nodes(graph, nodes=None):
"""
Sort a given set of nodes from a graph based on the following rules:
# - if A -> B and not B -> A, then we have A < B
# - if A -> B and B -> A, then the ordering is undefined
Following the above rules gives us a quasi-top... | [
"Sort",
"a",
"given",
"set",
"of",
"nodes",
"from",
"a",
"graph",
"based",
"on",
"the",
"following",
"rules",
":"
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_utils.py#L108-L171 | [
"def",
"quasi_topological_sort_nodes",
"(",
"graph",
",",
"nodes",
"=",
"None",
")",
":",
"# fast path for single node graphs",
"if",
"graph",
".",
"number_of_nodes",
"(",
")",
"==",
"1",
":",
"return",
"graph",
".",
"nodes",
"(",
")",
"# make a copy to the graph ... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | CFGUtils._append_scc | Append all nodes from a strongly connected component to a list of ordered nodes and ensure the topological
order.
:param networkx.DiGraph graph: The graph where all nodes belong to.
:param list ordered_nodes: Ordered nodes.
:param iterable scc: A set of nodes that forms a ... | angr/analyses/cfg/cfg_utils.py | def _append_scc(graph, ordered_nodes, scc):
"""
Append all nodes from a strongly connected component to a list of ordered nodes and ensure the topological
order.
:param networkx.DiGraph graph: The graph where all nodes belong to.
:param list ordered_nodes: Ordered nodes.
... | def _append_scc(graph, ordered_nodes, scc):
"""
Append all nodes from a strongly connected component to a list of ordered nodes and ensure the topological
order.
:param networkx.DiGraph graph: The graph where all nodes belong to.
:param list ordered_nodes: Ordered nodes.
... | [
"Append",
"all",
"nodes",
"from",
"a",
"strongly",
"connected",
"component",
"to",
"a",
"list",
"of",
"ordered",
"nodes",
"and",
"ensure",
"the",
"topological",
"order",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_utils.py#L182-L212 | [
"def",
"_append_scc",
"(",
"graph",
",",
"ordered_nodes",
",",
"scc",
")",
":",
"# find the first node in the strongly connected component that is the successor to any node in ordered_nodes",
"loop_head",
"=",
"None",
"for",
"parent_node",
"in",
"reversed",
"(",
"ordered_nodes"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimulationManager.mulpyplex | Mulpyplex across several stashes.
:param stashes: the stashes to mulpyplex
:return: a mulpyplexed list of states from the stashes in question, in the specified order | angr/sim_manager.py | def mulpyplex(self, *stashes):
"""
Mulpyplex across several stashes.
:param stashes: the stashes to mulpyplex
:return: a mulpyplexed list of states from the stashes in question, in the specified order
"""
return mulpyplexer.MP(list(itertools.chain.from_iterable(self._st... | def mulpyplex(self, *stashes):
"""
Mulpyplex across several stashes.
:param stashes: the stashes to mulpyplex
:return: a mulpyplexed list of states from the stashes in question, in the specified order
"""
return mulpyplexer.MP(list(itertools.chain.from_iterable(self._st... | [
"Mulpyplex",
"across",
"several",
"stashes",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L144-L152 | [
"def",
"mulpyplex",
"(",
"self",
",",
"*",
"stashes",
")",
":",
"return",
"mulpyplexer",
".",
"MP",
"(",
"list",
"(",
"itertools",
".",
"chain",
".",
"from_iterable",
"(",
"self",
".",
"_stashes",
"[",
"s",
"]",
"for",
"s",
"in",
"stashes",
")",
")",... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimulationManager.copy | Make a copy of this simulation manager. Pass ``deep=True`` to copy all the states in it as well. | angr/sim_manager.py | def copy(self, deep=False): # pylint: disable=arguments-differ
"""
Make a copy of this simulation manager. Pass ``deep=True`` to copy all the states in it as well.
"""
simgr = SimulationManager(self._project,
stashes=self._copy_stashes(deep=deep),
... | def copy(self, deep=False): # pylint: disable=arguments-differ
"""
Make a copy of this simulation manager. Pass ``deep=True`` to copy all the states in it as well.
"""
simgr = SimulationManager(self._project,
stashes=self._copy_stashes(deep=deep),
... | [
"Make",
"a",
"copy",
"of",
"this",
"simulation",
"manager",
".",
"Pass",
"deep",
"=",
"True",
"to",
"copy",
"all",
"the",
"states",
"in",
"it",
"as",
"well",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L154-L165 | [
"def",
"copy",
"(",
"self",
",",
"deep",
"=",
"False",
")",
":",
"# pylint: disable=arguments-differ",
"simgr",
"=",
"SimulationManager",
"(",
"self",
".",
"_project",
",",
"stashes",
"=",
"self",
".",
"_copy_stashes",
"(",
"deep",
"=",
"deep",
")",
",",
"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimulationManager.use_technique | Use an exploration technique with this SimulationManager.
Techniques can be found in :mod:`angr.exploration_techniques`.
:param tech: An ExplorationTechnique object that contains code to modify
this SimulationManager's behavior.
:type tech: ExplorationTechnique
... | angr/sim_manager.py | def use_technique(self, tech):
"""
Use an exploration technique with this SimulationManager.
Techniques can be found in :mod:`angr.exploration_techniques`.
:param tech: An ExplorationTechnique object that contains code to modify
this SimulationManager's behav... | def use_technique(self, tech):
"""
Use an exploration technique with this SimulationManager.
Techniques can be found in :mod:`angr.exploration_techniques`.
:param tech: An ExplorationTechnique object that contains code to modify
this SimulationManager's behav... | [
"Use",
"an",
"exploration",
"technique",
"with",
"this",
"SimulationManager",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L171-L191 | [
"def",
"use_technique",
"(",
"self",
",",
"tech",
")",
":",
"if",
"not",
"isinstance",
"(",
"tech",
",",
"ExplorationTechnique",
")",
":",
"raise",
"SimulationManagerError",
"# XXX: as promised",
"tech",
".",
"project",
"=",
"self",
".",
"_project",
"tech",
".... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimulationManager.remove_technique | Remove an exploration technique from a list of active techniques.
:param tech: An ExplorationTechnique object.
:type tech: ExplorationTechnique | angr/sim_manager.py | def remove_technique(self, tech):
"""
Remove an exploration technique from a list of active techniques.
:param tech: An ExplorationTechnique object.
:type tech: ExplorationTechnique
"""
if not isinstance(tech, ExplorationTechnique):
raise SimulationMan... | def remove_technique(self, tech):
"""
Remove an exploration technique from a list of active techniques.
:param tech: An ExplorationTechnique object.
:type tech: ExplorationTechnique
"""
if not isinstance(tech, ExplorationTechnique):
raise SimulationMan... | [
"Remove",
"an",
"exploration",
"technique",
"from",
"a",
"list",
"of",
"active",
"techniques",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L193-L211 | [
"def",
"remove_technique",
"(",
"self",
",",
"tech",
")",
":",
"if",
"not",
"isinstance",
"(",
"tech",
",",
"ExplorationTechnique",
")",
":",
"raise",
"SimulationManagerError",
"def",
"_is_overriden",
"(",
"name",
")",
":",
"return",
"getattr",
"(",
"tech",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimulationManager.explore | Tick stash "stash" forward (up to "n" times or until "num_find" states are found), looking for condition "find",
avoiding condition "avoid". Stores found states into "find_stash' and avoided states into "avoid_stash".
The "find" and "avoid" parameters may be any of:
- An address to find
... | angr/sim_manager.py | def explore(self, stash='active', n=None, find=None, avoid=None, find_stash='found', avoid_stash='avoid', cfg=None,
num_find=1, **kwargs):
"""
Tick stash "stash" forward (up to "n" times or until "num_find" states are found), looking for condition "find",
avoiding condition "avoi... | def explore(self, stash='active', n=None, find=None, avoid=None, find_stash='found', avoid_stash='avoid', cfg=None,
num_find=1, **kwargs):
"""
Tick stash "stash" forward (up to "n" times or until "num_find" states are found), looking for condition "find",
avoiding condition "avoi... | [
"Tick",
"stash",
"stash",
"forward",
"(",
"up",
"to",
"n",
"times",
"or",
"until",
"num_find",
"states",
"are",
"found",
")",
"looking",
"for",
"condition",
"find",
"avoiding",
"condition",
"avoid",
".",
"Stores",
"found",
"states",
"into",
"find_stash",
"an... | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L217-L241 | [
"def",
"explore",
"(",
"self",
",",
"stash",
"=",
"'active'",
",",
"n",
"=",
"None",
",",
"find",
"=",
"None",
",",
"avoid",
"=",
"None",
",",
"find_stash",
"=",
"'found'",
",",
"avoid_stash",
"=",
"'avoid'",
",",
"cfg",
"=",
"None",
",",
"num_find",... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimulationManager.run | Run until the SimulationManager has reached a completed state, according to
the current exploration techniques. If no exploration techniques that define a completion
state are being used, run until there is nothing left to run.
:param stash: Operate on this stash
:param n: ... | angr/sim_manager.py | def run(self, stash='active', n=None, until=None, **kwargs):
"""
Run until the SimulationManager has reached a completed state, according to
the current exploration techniques. If no exploration techniques that define a completion
state are being used, run until there is nothing left to ... | def run(self, stash='active', n=None, until=None, **kwargs):
"""
Run until the SimulationManager has reached a completed state, according to
the current exploration techniques. If no exploration techniques that define a completion
state are being used, run until there is nothing left to ... | [
"Run",
"until",
"the",
"SimulationManager",
"has",
"reached",
"a",
"completed",
"state",
"according",
"to",
"the",
"current",
"exploration",
"techniques",
".",
"If",
"no",
"exploration",
"techniques",
"that",
"define",
"a",
"completion",
"state",
"are",
"being",
... | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L243-L263 | [
"def",
"run",
"(",
"self",
",",
"stash",
"=",
"'active'",
",",
"n",
"=",
"None",
",",
"until",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"_",
"in",
"(",
"itertools",
".",
"count",
"(",
")",
"if",
"n",
"is",
"None",
"else",
"range",... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimulationManager.complete | Returns whether or not this manager has reached a "completed" state. | angr/sim_manager.py | def complete(self):
"""
Returns whether or not this manager has reached a "completed" state.
"""
if not self._techniques:
return False
if not any(tech._is_overriden('complete') for tech in self._techniques):
return False
return self.completion_mode... | def complete(self):
"""
Returns whether or not this manager has reached a "completed" state.
"""
if not self._techniques:
return False
if not any(tech._is_overriden('complete') for tech in self._techniques):
return False
return self.completion_mode... | [
"Returns",
"whether",
"or",
"not",
"this",
"manager",
"has",
"reached",
"a",
"completed",
"state",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L265-L273 | [
"def",
"complete",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_techniques",
":",
"return",
"False",
"if",
"not",
"any",
"(",
"tech",
".",
"_is_overriden",
"(",
"'complete'",
")",
"for",
"tech",
"in",
"self",
".",
"_techniques",
")",
":",
"return... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimulationManager.step | 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... | angr/sim_manager.py | 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, **run_args):
"""
Step a stash of states forward and categorize the successors appropriately.
The parameters to this function allow you to control everything... | [
"Step",
"a",
"stash",
"of",
"states",
"forward",
"and",
"categorize",
"the",
"successors",
"appropriately",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L275-L374 | [
"def",
"step",
"(",
"self",
",",
"stash",
"=",
"'active'",
",",
"n",
"=",
"None",
",",
"selector_func",
"=",
"None",
",",
"step_func",
"=",
"None",
",",
"successor_func",
"=",
"None",
",",
"until",
"=",
"None",
",",
"filter_func",
"=",
"None",
",",
"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimulationManager.step_state | Don't use this function manually - it is meant to interface with exploration techniques. | angr/sim_manager.py | 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):
"""
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... | [
"Don",
"t",
"use",
"this",
"function",
"manually",
"-",
"it",
"is",
"meant",
"to",
"interface",
"with",
"exploration",
"techniques",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L376-L396 | [
"def",
"step_state",
"(",
"self",
",",
"state",
",",
"successor_func",
"=",
"None",
",",
"*",
"*",
"run_args",
")",
":",
"try",
":",
"successors",
"=",
"self",
".",
"successors",
"(",
"state",
",",
"successor_func",
"=",
"successor_func",
",",
"*",
"*",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimulationManager.successors | Don't use this function manually - it is meant to interface with exploration techniques. | angr/sim_manager.py | 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):
"""
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... | [
"Don",
"t",
"use",
"this",
"function",
"manually",
"-",
"it",
"is",
"meant",
"to",
"interface",
"with",
"exploration",
"techniques",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L414-L420 | [
"def",
"successors",
"(",
"self",
",",
"state",
",",
"successor_func",
"=",
"None",
",",
"*",
"*",
"run_args",
")",
":",
"if",
"successor_func",
"is",
"not",
"None",
":",
"return",
"successor_func",
"(",
"state",
",",
"*",
"*",
"run_args",
")",
"return",... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimulationManager.prune | 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... | angr/sim_manager.py | 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'):
"""
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... | [
"Prune",
"unsatisfiable",
"states",
"from",
"a",
"stash",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L426-L449 | [
"def",
"prune",
"(",
"self",
",",
"filter_func",
"=",
"None",
",",
"from_stash",
"=",
"'active'",
",",
"to_stash",
"=",
"'pruned'",
")",
":",
"def",
"_prune_filter",
"(",
"state",
")",
":",
"to_prune",
"=",
"not",
"filter_func",
"or",
"filter_func",
"(",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimulationManager.move | 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... | angr/sim_manager.py | 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):
"""
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... | [
"Move",
"states",
"from",
"one",
"stash",
"to",
"another",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L461-L475 | [
"def",
"move",
"(",
"self",
",",
"from_stash",
",",
"to_stash",
",",
"filter_func",
"=",
"None",
")",
":",
"filter_func",
"=",
"filter_func",
"or",
"(",
"lambda",
"s",
":",
"True",
")",
"stash_splitter",
"=",
"lambda",
"states",
":",
"reversed",
"(",
"se... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimulationManager.stash | 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... | angr/sim_manager.py | 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'):
"""
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... | [
"Stash",
"some",
"states",
".",
"This",
"is",
"an",
"alias",
"for",
"move",
"()",
"with",
"defaults",
"for",
"the",
"stashes",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L477-L489 | [
"def",
"stash",
"(",
"self",
",",
"filter_func",
"=",
"None",
",",
"from_stash",
"=",
"'active'",
",",
"to_stash",
"=",
"'stashed'",
")",
":",
"return",
"self",
".",
"move",
"(",
"from_stash",
",",
"to_stash",
",",
"filter_func",
"=",
"filter_func",
")"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimulationManager.unstash | 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... | angr/sim_manager.py | 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'):
"""
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... | [
"Unstash",
"some",
"states",
".",
"This",
"is",
"an",
"alias",
"for",
"move",
"()",
"with",
"defaults",
"for",
"the",
"stashes",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L491-L503 | [
"def",
"unstash",
"(",
"self",
",",
"filter_func",
"=",
"None",
",",
"to_stash",
"=",
"'active'",
",",
"from_stash",
"=",
"'stashed'",
")",
":",
"return",
"self",
".",
"move",
"(",
"from_stash",
",",
"to_stash",
",",
"filter_func",
"=",
"filter_func",
")"
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimulationManager.drop | 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... | angr/sim_manager.py | 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'):
"""
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... | [
"Drops",
"states",
"from",
"a",
"stash",
".",
"This",
"is",
"an",
"alias",
"for",
"move",
"()",
"with",
"defaults",
"for",
"the",
"stashes",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L505-L516 | [
"def",
"drop",
"(",
"self",
",",
"filter_func",
"=",
"None",
",",
"stash",
"=",
"'active'",
")",
":",
"return",
"self",
".",
"move",
"(",
"stash",
",",
"self",
".",
"DROP",
",",
"filter_func",
"=",
"filter_func",
")"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimulationManager.apply | 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... | angr/sim_manager.py | 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):
"""
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 ... | [
"Applies",
"a",
"given",
"function",
"to",
"a",
"given",
"stash",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L518-L555 | [
"def",
"apply",
"(",
"self",
",",
"state_func",
"=",
"None",
",",
"stash_func",
"=",
"None",
",",
"stash",
"=",
"'active'",
",",
"to_stash",
"=",
"None",
")",
":",
"to_stash",
"=",
"to_stash",
"or",
"stash",
"def",
"_stash_splitter",
"(",
"states",
")",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimulationManager.split | 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... | angr/sim_manager.py | 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'):
"""
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... | [
"Split",
"a",
"stash",
"of",
"states",
"into",
"two",
"stashes",
"depending",
"on",
"the",
"specified",
"options",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L557-L602 | [
"def",
"split",
"(",
"self",
",",
"stash_splitter",
"=",
"None",
",",
"stash_ranker",
"=",
"None",
",",
"state_ranker",
"=",
"None",
",",
"limit",
"=",
"8",
",",
"from_stash",
"=",
"'active'",
",",
"to_stash",
"=",
"'stashed'",
")",
":",
"states",
"=",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimulationManager.merge | 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... | angr/sim_manager.py | 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'):
"""
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... | [
"Merge",
"the",
"states",
"in",
"a",
"given",
"stash",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L610-L648 | [
"def",
"merge",
"(",
"self",
",",
"merge_func",
"=",
"None",
",",
"merge_key",
"=",
"None",
",",
"stash",
"=",
"'active'",
")",
":",
"self",
".",
"prune",
"(",
"from_stash",
"=",
"stash",
")",
"to_merge",
"=",
"self",
".",
"_fetch_states",
"(",
"stash"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimulationManager._merge_states | Merges a list of states.
:param states: the states to merge
:returns SimState: the resulting state | angr/sim_manager.py | 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):
"""
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:
... | [
"Merges",
"a",
"list",
"of",
"states",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L684-L726 | [
"def",
"_merge_states",
"(",
"self",
",",
"states",
")",
":",
"if",
"self",
".",
"_hierarchy",
":",
"optimal",
",",
"common_history",
",",
"others",
"=",
"self",
".",
"_hierarchy",
".",
"most_mergeable",
"(",
"states",
")",
"else",
":",
"optimal",
",",
"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | ErrorRecord.debug | Launch a postmortem debug shell at the site of the error. | angr/sim_manager.py | 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):
"""
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) | [
"Launch",
"a",
"postmortem",
"debug",
"shell",
"at",
"the",
"site",
"of",
"the",
"error",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L787-L794 | [
"def",
"debug",
"(",
"self",
")",
":",
"try",
":",
"__import__",
"(",
"'ipdb'",
")",
".",
"post_mortem",
"(",
"self",
".",
"traceback",
")",
"except",
"ImportError",
":",
"__import__",
"(",
"'pdb'",
")",
".",
"post_mortem",
"(",
"self",
".",
"traceback",... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | SimVariableSet.complement | Calculate the complement of `self` and `other`.
:param other: Another SimVariableSet instance.
:return: The complement result. | angr/sim_variable.py | 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):
"""
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... | [
"Calculate",
"the",
"complement",
"of",
"self",
"and",
"other",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_variable.py#L314-L328 | [
"def",
"complement",
"(",
"self",
",",
"other",
")",
":",
"s",
"=",
"SimVariableSet",
"(",
")",
"s",
".",
"register_variables",
"=",
"self",
".",
"register_variables",
"-",
"other",
".",
"register_variables",
"s",
".",
"register_variable_offsets",
"=",
"self",... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | BaseGoal._get_cfg_node | 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... | angr/exploration_techniques/director.py | 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):
"""
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,... | [
"Get",
"the",
"CFGNode",
"object",
"on",
"the",
"control",
"flow",
"graph",
"given",
"an",
"angr",
"state",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/director.py#L61-L76 | [
"def",
"_get_cfg_node",
"(",
"cfg",
",",
"state",
")",
":",
"call_stack_suffix",
"=",
"state",
".",
"callstack",
".",
"stack_suffix",
"(",
"cfg",
".",
"context_sensitivity_level",
")",
"is_syscall",
"=",
"state",
".",
"history",
".",
"jumpkind",
"is",
"not",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | BaseGoal._dfs_edges | 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.
... | angr/exploration_techniques/director.py | 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):
"""
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: ... | [
"Perform",
"a",
"depth",
"-",
"first",
"search",
"on",
"the",
"given",
"DiGraph",
"with",
"a",
"limit",
"on",
"maximum",
"steps",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/director.py#L79-L112 | [
"def",
"_dfs_edges",
"(",
"graph",
",",
"source",
",",
"max_steps",
"=",
"None",
")",
":",
"if",
"max_steps",
"is",
"None",
":",
"yield",
"networkx",
".",
"dfs_edges",
"(",
"graph",
",",
"source",
")",
"else",
":",
"steps_map",
"=",
"defaultdict",
"(",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | ExecuteAddressGoal.check | Check if the specified address will be executed
:param cfg:
:param state:
:param int peek_blocks:
:return:
:rtype: bool | angr/exploration_techniques/director.py | 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):
"""
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... | [
"Check",
"if",
"the",
"specified",
"address",
"will",
"be",
"executed"
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/director.py#L128-L154 | [
"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... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | CallFunctionGoal.check | Check if the specified function will be reached with certain arguments.
:param cfg:
:param state:
:param peek_blocks:
:return: | angr/exploration_techniques/director.py | 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):
"""
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)
... | [
"Check",
"if",
"the",
"specified",
"function",
"will",
"be",
"reached",
"with",
"certain",
"arguments",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/director.py#L206-L247 | [
"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... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | CallFunctionGoal.check_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 | angr/exploration_techniques/director.py | 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):
"""
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 == ... | [
"Check",
"if",
"the",
"specific",
"function",
"is",
"reached",
"with",
"certain",
"arguments"
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/director.py#L249-L263 | [
"def",
"check_state",
"(",
"self",
",",
"state",
")",
":",
"if",
"state",
".",
"addr",
"==",
"self",
".",
"function",
".",
"addr",
":",
"arch",
"=",
"state",
".",
"arch",
"if",
"self",
".",
"_check_arguments",
"(",
"arch",
",",
"state",
")",
":",
"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | Director._peek_forward | 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: | angr/exploration_techniques/director.py | 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):
"""
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:
... | [
"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",
"... | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/director.py#L434-L456 | [
"def",
"_peek_forward",
"(",
"self",
",",
"simgr",
")",
":",
"if",
"self",
".",
"_cfg",
"is",
"None",
":",
"starts",
"=",
"list",
"(",
"simgr",
".",
"active",
")",
"self",
".",
"_cfg_kb",
"=",
"KnowledgeBase",
"(",
"self",
".",
"project",
")",
"self"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | Director._load_fallback_states | 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 | angr/exploration_techniques/director.py | 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):
"""
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",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/director.py#L458-L471 | [
"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",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | Director._categorize_states | 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)
... | angr/exploration_techniques/director.py | 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):
"""
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... | [
"Categorize",
"all",
"states",
"into",
"two",
"different",
"groups",
":",
"reaching",
"the",
"destination",
"within",
"the",
"peek",
"depth",
"and",
"not",
"reaching",
"the",
"destination",
"within",
"the",
"peek",
"depth",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/director.py#L473-L510 | [
"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... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | CodeTagging.has_xor | Detects if there is any xor operation in the function.
:return: Tags | angr/analyses/code_tagging.py | 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):
"""
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:
... | [
"Detects",
"if",
"there",
"is",
"any",
"xor",
"operation",
"in",
"the",
"function",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/code_tagging.py#L36-L61 | [
"def",
"has_xor",
"(",
"self",
")",
":",
"def",
"_has_xor",
"(",
"expr",
")",
":",
"return",
"isinstance",
"(",
"expr",
",",
"pyvex",
".",
"IRExpr",
".",
"Binop",
")",
"and",
"expr",
".",
"op",
".",
"startswith",
"(",
"\"Iop_Xor\"",
")",
"found_xor",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
train | CodeTagging.has_bitshifts | Detects if there is any bitwise operation in the function.
:return: Tags. | angr/analyses/code_tagging.py | 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):
"""
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") \
... | [
"Detects",
"if",
"there",
"is",
"any",
"bitwise",
"operation",
"in",
"the",
"function",
"."
] | angr/angr | python | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/code_tagging.py#L63-L92 | [
"def",
"has_bitshifts",
"(",
"self",
")",
":",
"def",
"_has_bitshifts",
"(",
"expr",
")",
":",
"if",
"isinstance",
"(",
"expr",
",",
"pyvex",
".",
"IRExpr",
".",
"Binop",
")",
":",
"return",
"expr",
".",
"op",
".",
"startswith",
"(",
"\"Iop_Shl\"",
")"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.