repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
angr/angr | angr/procedures/definitions/__init__.py | SimLibrary.add | def add(self, name, proc_cls, **kwargs):
"""
Add a function implementation fo the library.
:param name: The name of the function as a string
:param proc_cls: The implementation of the function as a SimProcedure _class_, not instance
:param kwargs: Any additional p... | python | def add(self, name, proc_cls, **kwargs):
"""
Add a function implementation fo the library.
:param name: The name of the function as a string
:param proc_cls: The implementation of the function as a SimProcedure _class_, not instance
:param kwargs: Any additional p... | [
"def",
"add",
"(",
"self",
",",
"name",
",",
"proc_cls",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"procedures",
"[",
"name",
"]",
"=",
"proc_cls",
"(",
"display_name",
"=",
"name",
",",
"*",
"*",
"kwargs",
")"
] | Add a function implementation fo the library.
:param name: The name of the function as a string
:param proc_cls: The implementation of the function as a SimProcedure _class_, not instance
:param kwargs: Any additional parameters to the procedure class constructor may be passed as... | [
"Add",
"a",
"function",
"implementation",
"fo",
"the",
"library",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/definitions/__init__.py#L135-L143 | train |
angr/angr | angr/procedures/definitions/__init__.py | SimLibrary.add_all_from_dict | def add_all_from_dict(self, dictionary, **kwargs):
"""
Batch-add function implementations to the library.
:param dictionary: A mapping from name to procedure class, i.e. the first two arguments to add()
:param kwargs: Any additional kwargs will be passed to the constructors of _ea... | python | def add_all_from_dict(self, dictionary, **kwargs):
"""
Batch-add function implementations to the library.
:param dictionary: A mapping from name to procedure class, i.e. the first two arguments to add()
:param kwargs: Any additional kwargs will be passed to the constructors of _ea... | [
"def",
"add_all_from_dict",
"(",
"self",
",",
"dictionary",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"name",
",",
"procedure",
"in",
"dictionary",
".",
"items",
"(",
")",
":",
"self",
".",
"add",
"(",
"name",
",",
"procedure",
",",
"*",
"*",
"kwargs... | Batch-add function implementations to the library.
:param dictionary: A mapping from name to procedure class, i.e. the first two arguments to add()
:param kwargs: Any additional kwargs will be passed to the constructors of _each_ procedure class | [
"Batch",
"-",
"add",
"function",
"implementations",
"to",
"the",
"library",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/definitions/__init__.py#L145-L153 | train |
angr/angr | angr/procedures/definitions/__init__.py | SimLibrary.add_alias | def add_alias(self, name, *alt_names):
"""
Add some duplicate names for a given function. The original function's implementation must already be
registered.
:param name: The name of the function for which an implementation is already present
:param alt_names: Any number... | python | def add_alias(self, name, *alt_names):
"""
Add some duplicate names for a given function. The original function's implementation must already be
registered.
:param name: The name of the function for which an implementation is already present
:param alt_names: Any number... | [
"def",
"add_alias",
"(",
"self",
",",
"name",
",",
"*",
"alt_names",
")",
":",
"old_procedure",
"=",
"self",
".",
"procedures",
"[",
"name",
"]",
"for",
"alt",
"in",
"alt_names",
":",
"new_procedure",
"=",
"copy",
".",
"deepcopy",
"(",
"old_procedure",
"... | Add some duplicate names for a given function. The original function's implementation must already be
registered.
:param name: The name of the function for which an implementation is already present
:param alt_names: Any number of alternate names may be passed as varargs | [
"Add",
"some",
"duplicate",
"names",
"for",
"a",
"given",
"function",
".",
"The",
"original",
"function",
"s",
"implementation",
"must",
"already",
"be",
"registered",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/definitions/__init__.py#L155-L167 | train |
angr/angr | angr/procedures/definitions/__init__.py | SimLibrary.get | def get(self, name, arch):
"""
Get an implementation of the given function specialized for the given arch, or a stub procedure if none exists.
:param name: The name of the function as a string
:param arch: The architecure to use, as either a string or an archinfo.Arch instance
... | python | def get(self, name, arch):
"""
Get an implementation of the given function specialized for the given arch, or a stub procedure if none exists.
:param name: The name of the function as a string
:param arch: The architecure to use, as either a string or an archinfo.Arch instance
... | [
"def",
"get",
"(",
"self",
",",
"name",
",",
"arch",
")",
":",
"if",
"type",
"(",
"arch",
")",
"is",
"str",
":",
"arch",
"=",
"archinfo",
".",
"arch_from_id",
"(",
"arch",
")",
"if",
"name",
"in",
"self",
".",
"procedures",
":",
"proc",
"=",
"cop... | Get an implementation of the given function specialized for the given arch, or a stub procedure if none exists.
:param name: The name of the function as a string
:param arch: The architecure to use, as either a string or an archinfo.Arch instance
:return: A SimProcedure instance re... | [
"Get",
"an",
"implementation",
"of",
"the",
"given",
"function",
"specialized",
"for",
"the",
"given",
"arch",
"or",
"a",
"stub",
"procedure",
"if",
"none",
"exists",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/definitions/__init__.py#L188-L203 | train |
angr/angr | angr/procedures/definitions/__init__.py | SimLibrary.get_stub | def get_stub(self, name, arch):
"""
Get a stub procedure for the given function, regardless of if a real implementation is available. This will
apply any metadata, such as a default calling convention or a function prototype.
By stub, we pretty much always mean a ``ReturnUnconstrained``... | python | def get_stub(self, name, arch):
"""
Get a stub procedure for the given function, regardless of if a real implementation is available. This will
apply any metadata, such as a default calling convention or a function prototype.
By stub, we pretty much always mean a ``ReturnUnconstrained``... | [
"def",
"get_stub",
"(",
"self",
",",
"name",
",",
"arch",
")",
":",
"proc",
"=",
"self",
".",
"fallback_proc",
"(",
"display_name",
"=",
"name",
",",
"is_stub",
"=",
"True",
")",
"self",
".",
"_apply_metadata",
"(",
"proc",
",",
"arch",
")",
"return",
... | Get a stub procedure for the given function, regardless of if a real implementation is available. This will
apply any metadata, such as a default calling convention or a function prototype.
By stub, we pretty much always mean a ``ReturnUnconstrained`` SimProcedure with the appropriate display name
... | [
"Get",
"a",
"stub",
"procedure",
"for",
"the",
"given",
"function",
"regardless",
"of",
"if",
"a",
"real",
"implementation",
"is",
"available",
".",
"This",
"will",
"apply",
"any",
"metadata",
"such",
"as",
"a",
"default",
"calling",
"convention",
"or",
"a",... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/definitions/__init__.py#L205-L219 | train |
angr/angr | angr/procedures/definitions/__init__.py | SimLibrary.has_metadata | def has_metadata(self, name):
"""
Check if a function has either an implementation or any metadata associated with it
:param name: The name of the function as a string
:return: A bool indicating if anything is known about the function
"""
return self.has_implem... | python | def has_metadata(self, name):
"""
Check if a function has either an implementation or any metadata associated with it
:param name: The name of the function as a string
:return: A bool indicating if anything is known about the function
"""
return self.has_implem... | [
"def",
"has_metadata",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"has_implementation",
"(",
"name",
")",
"or",
"name",
"in",
"self",
".",
"non_returning",
"or",
"name",
"in",
"self",
".",
"prototypes"
] | Check if a function has either an implementation or any metadata associated with it
:param name: The name of the function as a string
:return: A bool indicating if anything is known about the function | [
"Check",
"if",
"a",
"function",
"has",
"either",
"an",
"implementation",
"or",
"any",
"metadata",
"associated",
"with",
"it"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/definitions/__init__.py#L221-L230 | train |
angr/angr | angr/procedures/definitions/__init__.py | SimSyscallLibrary.minimum_syscall_number | def minimum_syscall_number(self, abi):
"""
:param abi: The abi to evaluate
:return: The smallest syscall number known for the given abi
"""
if abi not in self.syscall_number_mapping or \
not self.syscall_number_mapping[abi]:
return 0
return ... | python | def minimum_syscall_number(self, abi):
"""
:param abi: The abi to evaluate
:return: The smallest syscall number known for the given abi
"""
if abi not in self.syscall_number_mapping or \
not self.syscall_number_mapping[abi]:
return 0
return ... | [
"def",
"minimum_syscall_number",
"(",
"self",
",",
"abi",
")",
":",
"if",
"abi",
"not",
"in",
"self",
".",
"syscall_number_mapping",
"or",
"not",
"self",
".",
"syscall_number_mapping",
"[",
"abi",
"]",
":",
"return",
"0",
"return",
"min",
"(",
"self",
".",... | :param abi: The abi to evaluate
:return: The smallest syscall number known for the given abi | [
":",
"param",
"abi",
":",
"The",
"abi",
"to",
"evaluate",
":",
"return",
":",
"The",
"smallest",
"syscall",
"number",
"known",
"for",
"the",
"given",
"abi"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/definitions/__init__.py#L289-L297 | train |
angr/angr | angr/procedures/definitions/__init__.py | SimSyscallLibrary.maximum_syscall_number | def maximum_syscall_number(self, abi):
"""
:param abi: The abi to evaluate
:return: The largest syscall number known for the given abi
"""
if abi not in self.syscall_number_mapping or \
not self.syscall_number_mapping[abi]:
return 0
return m... | python | def maximum_syscall_number(self, abi):
"""
:param abi: The abi to evaluate
:return: The largest syscall number known for the given abi
"""
if abi not in self.syscall_number_mapping or \
not self.syscall_number_mapping[abi]:
return 0
return m... | [
"def",
"maximum_syscall_number",
"(",
"self",
",",
"abi",
")",
":",
"if",
"abi",
"not",
"in",
"self",
".",
"syscall_number_mapping",
"or",
"not",
"self",
".",
"syscall_number_mapping",
"[",
"abi",
"]",
":",
"return",
"0",
"return",
"max",
"(",
"self",
".",... | :param abi: The abi to evaluate
:return: The largest syscall number known for the given abi | [
":",
"param",
"abi",
":",
"The",
"abi",
"to",
"evaluate",
":",
"return",
":",
"The",
"largest",
"syscall",
"number",
"known",
"for",
"the",
"given",
"abi"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/definitions/__init__.py#L299-L307 | train |
angr/angr | angr/procedures/definitions/__init__.py | SimSyscallLibrary.add_number_mapping | def add_number_mapping(self, abi, number, name):
"""
Associate a syscall number with the name of a function present in the underlying SimLibrary
:param abi: The abi for which this mapping applies
:param number: The syscall number
:param name: The name of the function
... | python | def add_number_mapping(self, abi, number, name):
"""
Associate a syscall number with the name of a function present in the underlying SimLibrary
:param abi: The abi for which this mapping applies
:param number: The syscall number
:param name: The name of the function
... | [
"def",
"add_number_mapping",
"(",
"self",
",",
"abi",
",",
"number",
",",
"name",
")",
":",
"self",
".",
"syscall_number_mapping",
"[",
"abi",
"]",
"[",
"number",
"]",
"=",
"name",
"self",
".",
"syscall_name_mapping",
"[",
"abi",
"]",
"[",
"name",
"]",
... | Associate a syscall number with the name of a function present in the underlying SimLibrary
:param abi: The abi for which this mapping applies
:param number: The syscall number
:param name: The name of the function | [
"Associate",
"a",
"syscall",
"number",
"with",
"the",
"name",
"of",
"a",
"function",
"present",
"in",
"the",
"underlying",
"SimLibrary"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/definitions/__init__.py#L309-L318 | train |
angr/angr | angr/procedures/definitions/__init__.py | SimSyscallLibrary.add_number_mapping_from_dict | def add_number_mapping_from_dict(self, abi, mapping):
"""
Batch-associate syscall numbers with names of functions present in the underlying SimLibrary
:param abi: The abi for which this mapping applies
:param mapping: A dict mapping syscall numbers to function names
"""
... | python | def add_number_mapping_from_dict(self, abi, mapping):
"""
Batch-associate syscall numbers with names of functions present in the underlying SimLibrary
:param abi: The abi for which this mapping applies
:param mapping: A dict mapping syscall numbers to function names
"""
... | [
"def",
"add_number_mapping_from_dict",
"(",
"self",
",",
"abi",
",",
"mapping",
")",
":",
"self",
".",
"syscall_number_mapping",
"[",
"abi",
"]",
".",
"update",
"(",
"mapping",
")",
"self",
".",
"syscall_name_mapping",
"[",
"abi",
"]",
".",
"update",
"(",
... | Batch-associate syscall numbers with names of functions present in the underlying SimLibrary
:param abi: The abi for which this mapping applies
:param mapping: A dict mapping syscall numbers to function names | [
"Batch",
"-",
"associate",
"syscall",
"numbers",
"with",
"names",
"of",
"functions",
"present",
"in",
"the",
"underlying",
"SimLibrary"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/definitions/__init__.py#L320-L328 | train |
angr/angr | angr/procedures/definitions/__init__.py | SimSyscallLibrary.get | def get(self, number, arch, abi_list=()):
"""
The get() function for SimSyscallLibrary looks a little different from its original version.
Instead of providing a name, you provide a number, and you additionally provide a list of abi names that are
applicable. The first abi for which the... | python | def get(self, number, arch, abi_list=()):
"""
The get() function for SimSyscallLibrary looks a little different from its original version.
Instead of providing a name, you provide a number, and you additionally provide a list of abi names that are
applicable. The first abi for which the... | [
"def",
"get",
"(",
"self",
",",
"number",
",",
"arch",
",",
"abi_list",
"=",
"(",
")",
")",
":",
"name",
",",
"arch",
",",
"abi",
"=",
"self",
".",
"_canonicalize",
"(",
"number",
",",
"arch",
",",
"abi_list",
")",
"proc",
"=",
"super",
"(",
"Sim... | The get() function for SimSyscallLibrary looks a little different from its original version.
Instead of providing a name, you provide a number, and you additionally provide a list of abi names that are
applicable. The first abi for which the number is present in the mapping will be chosen. This allows ... | [
"The",
"get",
"()",
"function",
"for",
"SimSyscallLibrary",
"looks",
"a",
"little",
"different",
"from",
"its",
"original",
"version",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/definitions/__init__.py#L360-L380 | train |
angr/angr | angr/procedures/definitions/__init__.py | SimSyscallLibrary.get_stub | def get_stub(self, number, arch, abi_list=()):
"""
Pretty much the intersection of SimLibrary.get_stub() and SimSyscallLibrary.get().
:param number: The syscall number
:param arch: The architecture being worked with, as either a string name or an archinfo.Arch
:param... | python | def get_stub(self, number, arch, abi_list=()):
"""
Pretty much the intersection of SimLibrary.get_stub() and SimSyscallLibrary.get().
:param number: The syscall number
:param arch: The architecture being worked with, as either a string name or an archinfo.Arch
:param... | [
"def",
"get_stub",
"(",
"self",
",",
"number",
",",
"arch",
",",
"abi_list",
"=",
"(",
")",
")",
":",
"name",
",",
"arch",
",",
"abi",
"=",
"self",
".",
"_canonicalize",
"(",
"number",
",",
"arch",
",",
"abi_list",
")",
"proc",
"=",
"super",
"(",
... | Pretty much the intersection of SimLibrary.get_stub() and SimSyscallLibrary.get().
:param number: The syscall number
:param arch: The architecture being worked with, as either a string name or an archinfo.Arch
:param abi_list: A list of ABI names that could be used
:retur... | [
"Pretty",
"much",
"the",
"intersection",
"of",
"SimLibrary",
".",
"get_stub",
"()",
"and",
"SimSyscallLibrary",
".",
"get",
"()",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/definitions/__init__.py#L382-L395 | train |
angr/angr | angr/procedures/definitions/__init__.py | SimSyscallLibrary.has_implementation | def has_implementation(self, number, arch, abi_list=()):
"""
Pretty much the intersection of SimLibrary.has_implementation() and SimSyscallLibrary.get().
:param number: The syscall number
:param arch: The architecture being worked with, as either a string name or an archinfo... | python | def has_implementation(self, number, arch, abi_list=()):
"""
Pretty much the intersection of SimLibrary.has_implementation() and SimSyscallLibrary.get().
:param number: The syscall number
:param arch: The architecture being worked with, as either a string name or an archinfo... | [
"def",
"has_implementation",
"(",
"self",
",",
"number",
",",
"arch",
",",
"abi_list",
"=",
"(",
")",
")",
":",
"name",
",",
"_",
",",
"_",
"=",
"self",
".",
"_canonicalize",
"(",
"number",
",",
"arch",
",",
"abi_list",
")",
"return",
"super",
"(",
... | Pretty much the intersection of SimLibrary.has_implementation() and SimSyscallLibrary.get().
:param number: The syscall number
:param arch: The architecture being worked with, as either a string name or an archinfo.Arch
:param abi_list: A list of ABI names that could be used
... | [
"Pretty",
"much",
"the",
"intersection",
"of",
"SimLibrary",
".",
"has_implementation",
"()",
"and",
"SimSyscallLibrary",
".",
"get",
"()",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/definitions/__init__.py#L409-L419 | train |
angr/angr | angr/state_plugins/scratch.py | SimStateScratch.tmp_expr | def tmp_expr(self, tmp):
"""
Returns the Claripy expression of a VEX temp value.
:param tmp: the number of the tmp
:param simplify: simplify the tmp before returning it
:returns: a Claripy expression of the tmp
"""
self.state._inspect('tmp_read', BP_BEFORE, tmp_r... | python | def tmp_expr(self, tmp):
"""
Returns the Claripy expression of a VEX temp value.
:param tmp: the number of the tmp
:param simplify: simplify the tmp before returning it
:returns: a Claripy expression of the tmp
"""
self.state._inspect('tmp_read', BP_BEFORE, tmp_r... | [
"def",
"tmp_expr",
"(",
"self",
",",
"tmp",
")",
":",
"self",
".",
"state",
".",
"_inspect",
"(",
"'tmp_read'",
",",
"BP_BEFORE",
",",
"tmp_read_num",
"=",
"tmp",
")",
"try",
":",
"v",
"=",
"self",
".",
"temps",
"[",
"tmp",
"]",
"if",
"v",
"is",
... | Returns the Claripy expression of a VEX temp value.
:param tmp: the number of the tmp
:param simplify: simplify the tmp before returning it
:returns: a Claripy expression of the tmp | [
"Returns",
"the",
"Claripy",
"expression",
"of",
"a",
"VEX",
"temp",
"value",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/scratch.py#L85-L102 | train |
angr/angr | angr/state_plugins/scratch.py | SimStateScratch.store_tmp | def store_tmp(self, tmp, content, reg_deps=None, tmp_deps=None, deps=None):
"""
Stores a Claripy expression in a VEX temp value.
If in symbolic mode, this involves adding a constraint for the tmp's symbolic variable.
:param tmp: the number of the tmp
:param content: a Claripy ex... | python | def store_tmp(self, tmp, content, reg_deps=None, tmp_deps=None, deps=None):
"""
Stores a Claripy expression in a VEX temp value.
If in symbolic mode, this involves adding a constraint for the tmp's symbolic variable.
:param tmp: the number of the tmp
:param content: a Claripy ex... | [
"def",
"store_tmp",
"(",
"self",
",",
"tmp",
",",
"content",
",",
"reg_deps",
"=",
"None",
",",
"tmp_deps",
"=",
"None",
",",
"deps",
"=",
"None",
")",
":",
"self",
".",
"state",
".",
"_inspect",
"(",
"'tmp_write'",
",",
"BP_BEFORE",
",",
"tmp_write_nu... | Stores a Claripy expression in a VEX temp value.
If in symbolic mode, this involves adding a constraint for the tmp's symbolic variable.
:param tmp: the number of the tmp
:param content: a Claripy expression of the content
:param reg_deps: the register dependencies of the content
... | [
"Stores",
"a",
"Claripy",
"expression",
"in",
"a",
"VEX",
"temp",
"value",
".",
"If",
"in",
"symbolic",
"mode",
"this",
"involves",
"adding",
"a",
"constraint",
"for",
"the",
"tmp",
"s",
"symbolic",
"variable",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/scratch.py#L104-L131 | train |
angr/angr | angr/state_plugins/filesystem.py | SimFilesystem._normalize_path | def _normalize_path(self, path):
"""
Takes a path and returns a simple absolute path as a list of directories from the root
"""
if type(path) is str:
path = path.encode()
path = path.split(b'\0')[0]
if path[0:1] != self.pathsep:
path = self.cwd + ... | python | def _normalize_path(self, path):
"""
Takes a path and returns a simple absolute path as a list of directories from the root
"""
if type(path) is str:
path = path.encode()
path = path.split(b'\0')[0]
if path[0:1] != self.pathsep:
path = self.cwd + ... | [
"def",
"_normalize_path",
"(",
"self",
",",
"path",
")",
":",
"if",
"type",
"(",
"path",
")",
"is",
"str",
":",
"path",
"=",
"path",
".",
"encode",
"(",
")",
"path",
"=",
"path",
".",
"split",
"(",
"b'\\0'",
")",
"[",
"0",
"]",
"if",
"path",
"[... | Takes a path and returns a simple absolute path as a list of directories from the root | [
"Takes",
"a",
"path",
"and",
"returns",
"a",
"simple",
"absolute",
"path",
"as",
"a",
"list",
"of",
"directories",
"from",
"the",
"root"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/filesystem.py#L118-L142 | train |
angr/angr | angr/state_plugins/filesystem.py | SimFilesystem.chdir | def chdir(self, path):
"""
Changes the current directory to the given path
"""
self.cwd = self._join_chunks(self._normalize_path(path)) | python | def chdir(self, path):
"""
Changes the current directory to the given path
"""
self.cwd = self._join_chunks(self._normalize_path(path)) | [
"def",
"chdir",
"(",
"self",
",",
"path",
")",
":",
"self",
".",
"cwd",
"=",
"self",
".",
"_join_chunks",
"(",
"self",
".",
"_normalize_path",
"(",
"path",
")",
")"
] | Changes the current directory to the given path | [
"Changes",
"the",
"current",
"directory",
"to",
"the",
"given",
"path"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/filesystem.py#L150-L154 | train |
angr/angr | angr/state_plugins/filesystem.py | SimFilesystem.get | def get(self, path):
"""
Get a file from the filesystem. Returns a SimFile or None.
"""
mountpoint, chunks = self.get_mountpoint(path)
if mountpoint is None:
return self._files.get(self._join_chunks(chunks))
else:
return mountpoint.get(chunks) | python | def get(self, path):
"""
Get a file from the filesystem. Returns a SimFile or None.
"""
mountpoint, chunks = self.get_mountpoint(path)
if mountpoint is None:
return self._files.get(self._join_chunks(chunks))
else:
return mountpoint.get(chunks) | [
"def",
"get",
"(",
"self",
",",
"path",
")",
":",
"mountpoint",
",",
"chunks",
"=",
"self",
".",
"get_mountpoint",
"(",
"path",
")",
"if",
"mountpoint",
"is",
"None",
":",
"return",
"self",
".",
"_files",
".",
"get",
"(",
"self",
".",
"_join_chunks",
... | Get a file from the filesystem. Returns a SimFile or None. | [
"Get",
"a",
"file",
"from",
"the",
"filesystem",
".",
"Returns",
"a",
"SimFile",
"or",
"None",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/filesystem.py#L156-L165 | train |
angr/angr | angr/state_plugins/filesystem.py | SimFilesystem.insert | def insert(self, path, simfile):
"""
Insert a file into the filesystem. Returns whether the operation was successful.
"""
if self.state is not None:
simfile.set_state(self.state)
mountpoint, chunks = self.get_mountpoint(path)
if mountpoint is None:
... | python | def insert(self, path, simfile):
"""
Insert a file into the filesystem. Returns whether the operation was successful.
"""
if self.state is not None:
simfile.set_state(self.state)
mountpoint, chunks = self.get_mountpoint(path)
if mountpoint is None:
... | [
"def",
"insert",
"(",
"self",
",",
"path",
",",
"simfile",
")",
":",
"if",
"self",
".",
"state",
"is",
"not",
"None",
":",
"simfile",
".",
"set_state",
"(",
"self",
".",
"state",
")",
"mountpoint",
",",
"chunks",
"=",
"self",
".",
"get_mountpoint",
"... | Insert a file into the filesystem. Returns whether the operation was successful. | [
"Insert",
"a",
"file",
"into",
"the",
"filesystem",
".",
"Returns",
"whether",
"the",
"operation",
"was",
"successful",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/filesystem.py#L167-L179 | train |
angr/angr | angr/state_plugins/filesystem.py | SimFilesystem.delete | def delete(self, path):
"""
Remove a file from the filesystem. Returns whether the operation was successful.
This will add a ``fs_unlink`` event with the path of the file and also the index into the `unlinks` list.
"""
mountpoint, chunks = self.get_mountpoint(path)
apath... | python | def delete(self, path):
"""
Remove a file from the filesystem. Returns whether the operation was successful.
This will add a ``fs_unlink`` event with the path of the file and also the index into the `unlinks` list.
"""
mountpoint, chunks = self.get_mountpoint(path)
apath... | [
"def",
"delete",
"(",
"self",
",",
"path",
")",
":",
"mountpoint",
",",
"chunks",
"=",
"self",
".",
"get_mountpoint",
"(",
"path",
")",
"apath",
"=",
"self",
".",
"_join_chunks",
"(",
"chunks",
")",
"if",
"mountpoint",
"is",
"None",
":",
"try",
":",
... | Remove a file from the filesystem. Returns whether the operation was successful.
This will add a ``fs_unlink`` event with the path of the file and also the index into the `unlinks` list. | [
"Remove",
"a",
"file",
"from",
"the",
"filesystem",
".",
"Returns",
"whether",
"the",
"operation",
"was",
"successful",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/filesystem.py#L181-L200 | train |
angr/angr | angr/state_plugins/filesystem.py | SimFilesystem.mount | def mount(self, path, mount):
"""
Add a mountpoint to the filesystem.
"""
self._mountpoints[self._join_chunks(self._normalize_path(path))] = mount | python | def mount(self, path, mount):
"""
Add a mountpoint to the filesystem.
"""
self._mountpoints[self._join_chunks(self._normalize_path(path))] = mount | [
"def",
"mount",
"(",
"self",
",",
"path",
",",
"mount",
")",
":",
"self",
".",
"_mountpoints",
"[",
"self",
".",
"_join_chunks",
"(",
"self",
".",
"_normalize_path",
"(",
"path",
")",
")",
"]",
"=",
"mount"
] | Add a mountpoint to the filesystem. | [
"Add",
"a",
"mountpoint",
"to",
"the",
"filesystem",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/filesystem.py#L202-L206 | train |
angr/angr | angr/state_plugins/filesystem.py | SimFilesystem.unmount | def unmount(self, path):
"""
Remove a mountpoint from the filesystem.
"""
del self._mountpoints[self._join_chunks(self._normalize_path(path))] | python | def unmount(self, path):
"""
Remove a mountpoint from the filesystem.
"""
del self._mountpoints[self._join_chunks(self._normalize_path(path))] | [
"def",
"unmount",
"(",
"self",
",",
"path",
")",
":",
"del",
"self",
".",
"_mountpoints",
"[",
"self",
".",
"_join_chunks",
"(",
"self",
".",
"_normalize_path",
"(",
"path",
")",
")",
"]"
] | Remove a mountpoint from the filesystem. | [
"Remove",
"a",
"mountpoint",
"from",
"the",
"filesystem",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/filesystem.py#L208-L212 | train |
angr/angr | angr/state_plugins/filesystem.py | SimFilesystem.get_mountpoint | def get_mountpoint(self, path):
"""
Look up the mountpoint servicing the given path.
:return: A tuple of the mount and a list of path elements traversing from the mountpoint to the specified file.
"""
path_chunks = self._normalize_path(path)
for i in range(len(path_chunk... | python | def get_mountpoint(self, path):
"""
Look up the mountpoint servicing the given path.
:return: A tuple of the mount and a list of path elements traversing from the mountpoint to the specified file.
"""
path_chunks = self._normalize_path(path)
for i in range(len(path_chunk... | [
"def",
"get_mountpoint",
"(",
"self",
",",
"path",
")",
":",
"path_chunks",
"=",
"self",
".",
"_normalize_path",
"(",
"path",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"path_chunks",
")",
"-",
"1",
",",
"-",
"1",
",",
"-",
"1",
")",
":",
"... | Look up the mountpoint servicing the given path.
:return: A tuple of the mount and a list of path elements traversing from the mountpoint to the specified file. | [
"Look",
"up",
"the",
"mountpoint",
"servicing",
"the",
"given",
"path",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/filesystem.py#L214-L229 | train |
angr/angr | angr/procedures/java_jni/__init__.py | JNISimProcedure._store_in_native_memory | def _store_in_native_memory(self, data, data_type, addr=None):
"""
Store in native memory.
:param data: Either a single value or a list.
Lists get interpreted as an array.
:param data_type: Java type of the element(s).
:param addr: Native stor... | python | def _store_in_native_memory(self, data, data_type, addr=None):
"""
Store in native memory.
:param data: Either a single value or a list.
Lists get interpreted as an array.
:param data_type: Java type of the element(s).
:param addr: Native stor... | [
"def",
"_store_in_native_memory",
"(",
"self",
",",
"data",
",",
"data_type",
",",
"addr",
"=",
"None",
")",
":",
"# check if addr is symbolic",
"if",
"addr",
"is",
"not",
"None",
"and",
"self",
".",
"state",
".",
"solver",
".",
"symbolic",
"(",
"addr",
")... | Store in native memory.
:param data: Either a single value or a list.
Lists get interpreted as an array.
:param data_type: Java type of the element(s).
:param addr: Native store address.
If not set, native memory is allocated.
... | [
"Store",
"in",
"native",
"memory",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/java_jni/__init__.py#L46-L77 | train |
angr/angr | angr/procedures/java_jni/__init__.py | JNISimProcedure._load_from_native_memory | def _load_from_native_memory(self, addr, data_type=None, data_size=None,
no_of_elements=1, return_as_list=False):
"""
Load from native memory.
:param addr: Native load address.
:param data_type: Java type of elements.
... | python | def _load_from_native_memory(self, addr, data_type=None, data_size=None,
no_of_elements=1, return_as_list=False):
"""
Load from native memory.
:param addr: Native load address.
:param data_type: Java type of elements.
... | [
"def",
"_load_from_native_memory",
"(",
"self",
",",
"addr",
",",
"data_type",
"=",
"None",
",",
"data_size",
"=",
"None",
",",
"no_of_elements",
"=",
"1",
",",
"return_as_list",
"=",
"False",
")",
":",
"# check if addr is symbolic",
"if",
"addr",
"is",
"not",... | Load from native memory.
:param addr: Native load address.
:param data_type: Java type of elements.
If set, all loaded elements are casted to this type.
:param data_size: Size of each element.
If not set, siz... | [
"Load",
"from",
"native",
"memory",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/java_jni/__init__.py#L79-L116 | train |
angr/angr | angr/procedures/java_jni/__init__.py | JNISimProcedure._load_string_from_native_memory | def _load_string_from_native_memory(self, addr_):
"""
Load zero terminated UTF-8 string from native memory.
:param addr_: Native load address.
:return: Loaded string.
"""
# check if addr is symbolic
if self.state.solver.symbolic(addr_):
l.error("... | python | def _load_string_from_native_memory(self, addr_):
"""
Load zero terminated UTF-8 string from native memory.
:param addr_: Native load address.
:return: Loaded string.
"""
# check if addr is symbolic
if self.state.solver.symbolic(addr_):
l.error("... | [
"def",
"_load_string_from_native_memory",
"(",
"self",
",",
"addr_",
")",
":",
"# check if addr is symbolic",
"if",
"self",
".",
"state",
".",
"solver",
".",
"symbolic",
"(",
"addr_",
")",
":",
"l",
".",
"error",
"(",
"\"Loading strings from symbolic addresses is no... | Load zero terminated UTF-8 string from native memory.
:param addr_: Native load address.
:return: Loaded string. | [
"Load",
"zero",
"terminated",
"UTF",
"-",
"8",
"string",
"from",
"native",
"memory",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/java_jni/__init__.py#L118-L144 | train |
angr/angr | angr/procedures/java_jni/__init__.py | JNISimProcedure._store_string_in_native_memory | def _store_string_in_native_memory(self, string, addr=None):
"""
Store given string UTF-8 encoded and zero terminated in native memory.
:param str string: String
:param addr: Native store address.
If not set, native memory is allocated.
:retur... | python | def _store_string_in_native_memory(self, string, addr=None):
"""
Store given string UTF-8 encoded and zero terminated in native memory.
:param str string: String
:param addr: Native store address.
If not set, native memory is allocated.
:retur... | [
"def",
"_store_string_in_native_memory",
"(",
"self",
",",
"string",
",",
"addr",
"=",
"None",
")",
":",
"if",
"addr",
"is",
"None",
":",
"addr",
"=",
"self",
".",
"_allocate_native_memory",
"(",
"size",
"=",
"len",
"(",
"string",
")",
"+",
"1",
")",
"... | Store given string UTF-8 encoded and zero terminated in native memory.
:param str string: String
:param addr: Native store address.
If not set, native memory is allocated.
:return: Native address of the string. | [
"Store",
"given",
"string",
"UTF",
"-",
"8",
"encoded",
"and",
"zero",
"terminated",
"in",
"native",
"memory",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/java_jni/__init__.py#L146-L178 | train |
angr/angr | angr/procedures/java_jni/__init__.py | JNISimProcedure._normalize_array_idx | def _normalize_array_idx(self, idx):
"""
In Java, all array indices are represented by a 32 bit integer and
consequently we are using in the Soot engine a 32bit bitvector for this.
This function normalize the given index to follow this "convention".
:return: Index as a 32bit bit... | python | def _normalize_array_idx(self, idx):
"""
In Java, all array indices are represented by a 32 bit integer and
consequently we are using in the Soot engine a 32bit bitvector for this.
This function normalize the given index to follow this "convention".
:return: Index as a 32bit bit... | [
"def",
"_normalize_array_idx",
"(",
"self",
",",
"idx",
")",
":",
"if",
"isinstance",
"(",
"idx",
",",
"SimActionObject",
")",
":",
"idx",
"=",
"idx",
".",
"to_claripy",
"(",
")",
"if",
"self",
".",
"arch",
".",
"memory_endness",
"==",
"\"Iend_LE\"",
":"... | In Java, all array indices are represented by a 32 bit integer and
consequently we are using in the Soot engine a 32bit bitvector for this.
This function normalize the given index to follow this "convention".
:return: Index as a 32bit bitvector. | [
"In",
"Java",
"all",
"array",
"indices",
"are",
"represented",
"by",
"a",
"32",
"bit",
"integer",
"and",
"consequently",
"we",
"are",
"using",
"in",
"the",
"Soot",
"engine",
"a",
"32bit",
"bitvector",
"for",
"this",
".",
"This",
"function",
"normalize",
"t... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/java_jni/__init__.py#L184-L197 | train |
angr/angr | angr/misc/hookset.py | HookSet.install_hooks | def install_hooks(target, **hooks):
"""
Given the target `target`, apply the hooks given as keyword arguments to it.
If any targeted method has already been hooked, the hooks will not be overridden but will instead be pushed
into a list of pending hooks. The final behavior should be that... | python | def install_hooks(target, **hooks):
"""
Given the target `target`, apply the hooks given as keyword arguments to it.
If any targeted method has already been hooked, the hooks will not be overridden but will instead be pushed
into a list of pending hooks. The final behavior should be that... | [
"def",
"install_hooks",
"(",
"target",
",",
"*",
"*",
"hooks",
")",
":",
"for",
"name",
",",
"hook",
"in",
"hooks",
".",
"items",
"(",
")",
":",
"func",
"=",
"getattr",
"(",
"target",
",",
"name",
")",
"if",
"not",
"isinstance",
"(",
"func",
",",
... | Given the target `target`, apply the hooks given as keyword arguments to it.
If any targeted method has already been hooked, the hooks will not be overridden but will instead be pushed
into a list of pending hooks. The final behavior should be that all hooks call each other in a nested stack.
:... | [
"Given",
"the",
"target",
"target",
"apply",
"the",
"hooks",
"given",
"as",
"keyword",
"arguments",
"to",
"it",
".",
"If",
"any",
"targeted",
"method",
"has",
"already",
"been",
"hooked",
"the",
"hooks",
"will",
"not",
"be",
"overridden",
"but",
"will",
"i... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/misc/hookset.py#L11-L26 | train |
angr/angr | angr/misc/hookset.py | HookSet.remove_hooks | def remove_hooks(target, **hooks):
"""
Remove the given hooks from the given target.
:param target: The object from which to remove hooks. If all hooks are removed from a given method, the
HookedMethod object will be removed and replaced with the original function.
... | python | def remove_hooks(target, **hooks):
"""
Remove the given hooks from the given target.
:param target: The object from which to remove hooks. If all hooks are removed from a given method, the
HookedMethod object will be removed and replaced with the original function.
... | [
"def",
"remove_hooks",
"(",
"target",
",",
"*",
"*",
"hooks",
")",
":",
"for",
"name",
",",
"hook",
"in",
"hooks",
".",
"items",
"(",
")",
":",
"hooked",
"=",
"getattr",
"(",
"target",
",",
"name",
")",
"if",
"hook",
"in",
"hooked",
".",
"pending",... | Remove the given hooks from the given target.
:param target: The object from which to remove hooks. If all hooks are removed from a given method, the
HookedMethod object will be removed and replaced with the original function.
:param hooks: Any keywords will be interpreted as... | [
"Remove",
"the",
"given",
"hooks",
"from",
"the",
"given",
"target",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/misc/hookset.py#L29-L46 | train |
angr/angr | angr/analyses/forward_analysis.py | GraphVisitor.reset | def reset(self):
"""
Reset the internal node traversal state. Must be called prior to visiting future nodes.
:return: None
"""
self._sorted_nodes.clear()
self._node_to_index.clear()
self._reached_fixedpoint.clear()
for i, n in enumerate(self.sort_nodes(... | python | def reset(self):
"""
Reset the internal node traversal state. Must be called prior to visiting future nodes.
:return: None
"""
self._sorted_nodes.clear()
self._node_to_index.clear()
self._reached_fixedpoint.clear()
for i, n in enumerate(self.sort_nodes(... | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"_sorted_nodes",
".",
"clear",
"(",
")",
"self",
".",
"_node_to_index",
".",
"clear",
"(",
")",
"self",
".",
"_reached_fixedpoint",
".",
"clear",
"(",
")",
"for",
"i",
",",
"n",
"in",
"enumerate",
"... | Reset the internal node traversal state. Must be called prior to visiting future nodes.
:return: None | [
"Reset",
"the",
"internal",
"node",
"traversal",
"state",
".",
"Must",
"be",
"called",
"prior",
"to",
"visiting",
"future",
"nodes",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/forward_analysis.py#L102-L115 | train |
angr/angr | angr/analyses/forward_analysis.py | GraphVisitor.all_successors | def all_successors(self, node, skip_reached_fixedpoint=False):
"""
Returns all successors to the specific node.
:param node: A node in the graph.
:return: A set of nodes that are all successors to the given node.
:rtype: set
"""
successors = set()
... | python | def all_successors(self, node, skip_reached_fixedpoint=False):
"""
Returns all successors to the specific node.
:param node: A node in the graph.
:return: A set of nodes that are all successors to the given node.
:rtype: set
"""
successors = set()
... | [
"def",
"all_successors",
"(",
"self",
",",
"node",
",",
"skip_reached_fixedpoint",
"=",
"False",
")",
":",
"successors",
"=",
"set",
"(",
")",
"stack",
"=",
"[",
"node",
"]",
"while",
"stack",
":",
"n",
"=",
"stack",
".",
"pop",
"(",
")",
"successors",... | Returns all successors to the specific node.
:param node: A node in the graph.
:return: A set of nodes that are all successors to the given node.
:rtype: set | [
"Returns",
"all",
"successors",
"to",
"the",
"specific",
"node",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/forward_analysis.py#L129-L149 | train |
angr/angr | angr/analyses/forward_analysis.py | GraphVisitor.revisit | def revisit(self, node, include_self=True):
"""
Revisit a node in the future. As a result, the successors to this node will be revisited as well.
:param node: The node to revisit in the future.
:return: None
"""
successors = self.successors(node) #, skip_reached_fix... | python | def revisit(self, node, include_self=True):
"""
Revisit a node in the future. As a result, the successors to this node will be revisited as well.
:param node: The node to revisit in the future.
:return: None
"""
successors = self.successors(node) #, skip_reached_fix... | [
"def",
"revisit",
"(",
"self",
",",
"node",
",",
"include_self",
"=",
"True",
")",
":",
"successors",
"=",
"self",
".",
"successors",
"(",
"node",
")",
"#, skip_reached_fixedpoint=True)",
"if",
"include_self",
":",
"self",
".",
"_sorted_nodes",
".",
"add",
"... | Revisit a node in the future. As a result, the successors to this node will be revisited as well.
:param node: The node to revisit in the future.
:return: None | [
"Revisit",
"a",
"node",
"in",
"the",
"future",
".",
"As",
"a",
"result",
"the",
"successors",
"to",
"this",
"node",
"will",
"be",
"revisited",
"as",
"well",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/forward_analysis.py#L151-L168 | train |
angr/angr | angr/analyses/forward_analysis.py | JobInfo.add_job | def add_job(self, job, merged=False, widened=False):
"""
Appended a new job to this JobInfo node.
:param job: The new job to append.
:param bool merged: Whether it is a merged job or not.
:param bool widened: Whether it is a widened job or not.
"""
job_type = ''
... | python | def add_job(self, job, merged=False, widened=False):
"""
Appended a new job to this JobInfo node.
:param job: The new job to append.
:param bool merged: Whether it is a merged job or not.
:param bool widened: Whether it is a widened job or not.
"""
job_type = ''
... | [
"def",
"add_job",
"(",
"self",
",",
"job",
",",
"merged",
"=",
"False",
",",
"widened",
"=",
"False",
")",
":",
"job_type",
"=",
"''",
"if",
"merged",
":",
"job_type",
"=",
"'merged'",
"elif",
"widened",
":",
"job_type",
"=",
"'widened'",
"self",
".",
... | Appended a new job to this JobInfo node.
:param job: The new job to append.
:param bool merged: Whether it is a merged job or not.
:param bool widened: Whether it is a widened job or not. | [
"Appended",
"a",
"new",
"job",
"to",
"this",
"JobInfo",
"node",
".",
":",
"param",
"job",
":",
"The",
"new",
"job",
"to",
"append",
".",
":",
"param",
"bool",
"merged",
":",
"Whether",
"it",
"is",
"a",
"merged",
"job",
"or",
"not",
".",
":",
"param... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/forward_analysis.py#L370-L383 | train |
angr/angr | angr/analyses/forward_analysis.py | ForwardAnalysis.has_job | def has_job(self, job):
"""
Checks whether there exists another job which has the same job key.
:param job: The job to check.
:return: True if there exists another job with the same key, False otherwise.
"""
job_key = self._job_key(job)
return job_key in self.... | python | def has_job(self, job):
"""
Checks whether there exists another job which has the same job key.
:param job: The job to check.
:return: True if there exists another job with the same key, False otherwise.
"""
job_key = self._job_key(job)
return job_key in self.... | [
"def",
"has_job",
"(",
"self",
",",
"job",
")",
":",
"job_key",
"=",
"self",
".",
"_job_key",
"(",
"job",
")",
"return",
"job_key",
"in",
"self",
".",
"_job_map"
] | Checks whether there exists another job which has the same job key.
:param job: The job to check.
:return: True if there exists another job with the same key, False otherwise. | [
"Checks",
"whether",
"there",
"exists",
"another",
"job",
"which",
"has",
"the",
"same",
"job",
"key",
".",
":",
"param",
"job",
":",
"The",
"job",
"to",
"check",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/forward_analysis.py#L480-L488 | train |
angr/angr | angr/analyses/forward_analysis.py | ForwardAnalysis._analyze | def _analyze(self):
"""
The main analysis routine.
:return: None
"""
self._pre_analysis()
if self._graph_visitor is None:
# There is no base graph that we can rely on. The analysis itself should generate successors for the
# current job.
... | python | def _analyze(self):
"""
The main analysis routine.
:return: None
"""
self._pre_analysis()
if self._graph_visitor is None:
# There is no base graph that we can rely on. The analysis itself should generate successors for the
# current job.
... | [
"def",
"_analyze",
"(",
"self",
")",
":",
"self",
".",
"_pre_analysis",
"(",
")",
"if",
"self",
".",
"_graph_visitor",
"is",
"None",
":",
"# There is no base graph that we can rely on. The analysis itself should generate successors for the",
"# current job.",
"# An example is... | The main analysis routine.
:return: None | [
"The",
"main",
"analysis",
"routine",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/forward_analysis.py#L569-L590 | train |
angr/angr | angr/analyses/forward_analysis.py | ForwardAnalysis._add_input_state | def _add_input_state(self, node, input_state):
"""
Add the input state to all successors of the given node.
:param node: The node whose successors' input states will be touched.
:param input_state: The state that will be added to successors of the node.
:return: ... | python | def _add_input_state(self, node, input_state):
"""
Add the input state to all successors of the given node.
:param node: The node whose successors' input states will be touched.
:param input_state: The state that will be added to successors of the node.
:return: ... | [
"def",
"_add_input_state",
"(",
"self",
",",
"node",
",",
"input_state",
")",
":",
"successors",
"=",
"self",
".",
"_graph_visitor",
".",
"successors",
"(",
"node",
")",
"for",
"succ",
"in",
"successors",
":",
"if",
"succ",
"in",
"self",
".",
"_state_map",... | Add the input state to all successors of the given node.
:param node: The node whose successors' input states will be touched.
:param input_state: The state that will be added to successors of the node.
:return: None | [
"Add",
"the",
"input",
"state",
"to",
"all",
"successors",
"of",
"the",
"given",
"node",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/forward_analysis.py#L623-L638 | train |
angr/angr | angr/analyses/forward_analysis.py | ForwardAnalysis._pop_input_state | def _pop_input_state(self, node):
"""
Get the input abstract state for this node, and remove it from the state map.
:param node: The node in graph.
:return: A merged state, or None if there is no input state for this node available.
"""
if node in self._state_map:
... | python | def _pop_input_state(self, node):
"""
Get the input abstract state for this node, and remove it from the state map.
:param node: The node in graph.
:return: A merged state, or None if there is no input state for this node available.
"""
if node in self._state_map:
... | [
"def",
"_pop_input_state",
"(",
"self",
",",
"node",
")",
":",
"if",
"node",
"in",
"self",
".",
"_state_map",
":",
"return",
"self",
".",
"_state_map",
".",
"pop",
"(",
"node",
")",
"return",
"None"
] | Get the input abstract state for this node, and remove it from the state map.
:param node: The node in graph.
:return: A merged state, or None if there is no input state for this node available. | [
"Get",
"the",
"input",
"abstract",
"state",
"for",
"this",
"node",
"and",
"remove",
"it",
"from",
"the",
"state",
"map",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/forward_analysis.py#L640-L650 | train |
angr/angr | angr/analyses/forward_analysis.py | ForwardAnalysis._merge_state_from_predecessors | def _merge_state_from_predecessors(self, node):
"""
Get abstract states for all predecessors of the node, merge them, and return the merged state.
:param node: The node in graph.
:return: A merged state, or None if no predecessor is available.
"""
preds = self._grap... | python | def _merge_state_from_predecessors(self, node):
"""
Get abstract states for all predecessors of the node, merge them, and return the merged state.
:param node: The node in graph.
:return: A merged state, or None if no predecessor is available.
"""
preds = self._grap... | [
"def",
"_merge_state_from_predecessors",
"(",
"self",
",",
"node",
")",
":",
"preds",
"=",
"self",
".",
"_graph_visitor",
".",
"predecessors",
"(",
"node",
")",
"states",
"=",
"[",
"self",
".",
"_state_map",
"[",
"n",
"]",
"for",
"n",
"in",
"preds",
"if"... | Get abstract states for all predecessors of the node, merge them, and return the merged state.
:param node: The node in graph.
:return: A merged state, or None if no predecessor is available. | [
"Get",
"abstract",
"states",
"for",
"all",
"predecessors",
"of",
"the",
"node",
"merge",
"them",
"and",
"return",
"the",
"merged",
"state",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/forward_analysis.py#L652-L667 | train |
angr/angr | angr/analyses/forward_analysis.py | ForwardAnalysis._process_job_and_get_successors | def _process_job_and_get_successors(self, job_info):
"""
Process a job, get all successors of this job, and call _handle_successor() to handle each successor.
:param JobInfo job_info: The JobInfo instance
:return: None
"""
job = job_info.job
successors = self._... | python | def _process_job_and_get_successors(self, job_info):
"""
Process a job, get all successors of this job, and call _handle_successor() to handle each successor.
:param JobInfo job_info: The JobInfo instance
:return: None
"""
job = job_info.job
successors = self._... | [
"def",
"_process_job_and_get_successors",
"(",
"self",
",",
"job_info",
")",
":",
"job",
"=",
"job_info",
".",
"job",
"successors",
"=",
"self",
".",
"_get_successors",
"(",
"job",
")",
"all_new_jobs",
"=",
"[",
"]",
"for",
"successor",
"in",
"successors",
"... | Process a job, get all successors of this job, and call _handle_successor() to handle each successor.
:param JobInfo job_info: The JobInfo instance
:return: None | [
"Process",
"a",
"job",
"get",
"all",
"successors",
"of",
"this",
"job",
"and",
"call",
"_handle_successor",
"()",
"to",
"handle",
"each",
"successor",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/forward_analysis.py#L716-L739 | train |
angr/angr | angr/analyses/forward_analysis.py | ForwardAnalysis._insert_job | def _insert_job(self, job):
"""
Insert a new job into the job queue. If the job queue is ordered, this job will be inserted at the correct
position.
:param job: The job to insert
:return: None
"""
key = self._job_key(job)
if self._allow_merging:
... | python | def _insert_job(self, job):
"""
Insert a new job into the job queue. If the job queue is ordered, this job will be inserted at the correct
position.
:param job: The job to insert
:return: None
"""
key = self._job_key(job)
if self._allow_merging:
... | [
"def",
"_insert_job",
"(",
"self",
",",
"job",
")",
":",
"key",
"=",
"self",
".",
"_job_key",
"(",
"job",
")",
"if",
"self",
".",
"_allow_merging",
":",
"if",
"key",
"in",
"self",
".",
"_job_map",
":",
"job_info",
"=",
"self",
".",
"_job_map",
"[",
... | Insert a new job into the job queue. If the job queue is ordered, this job will be inserted at the correct
position.
:param job: The job to insert
:return: None | [
"Insert",
"a",
"new",
"job",
"into",
"the",
"job",
"queue",
".",
"If",
"the",
"job",
"queue",
"is",
"ordered",
"this",
"job",
"will",
"be",
"inserted",
"at",
"the",
"correct",
"position",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/forward_analysis.py#L741-L798 | train |
angr/angr | angr/analyses/forward_analysis.py | ForwardAnalysis._peek_job | def _peek_job(self, pos):
"""
Return the job currently at position `pos`, but still keep it in the job queue. An IndexError will be raised
if that position does not currently exist in the job list.
:param int pos: Position of the job to get.
:return: The job
"""
... | python | def _peek_job(self, pos):
"""
Return the job currently at position `pos`, but still keep it in the job queue. An IndexError will be raised
if that position does not currently exist in the job list.
:param int pos: Position of the job to get.
:return: The job
"""
... | [
"def",
"_peek_job",
"(",
"self",
",",
"pos",
")",
":",
"if",
"pos",
"<",
"len",
"(",
"self",
".",
"_job_info_queue",
")",
":",
"return",
"self",
".",
"_job_info_queue",
"[",
"pos",
"]",
".",
"job",
"raise",
"IndexError",
"(",
")"
] | Return the job currently at position `pos`, but still keep it in the job queue. An IndexError will be raised
if that position does not currently exist in the job list.
:param int pos: Position of the job to get.
:return: The job | [
"Return",
"the",
"job",
"currently",
"at",
"position",
"pos",
"but",
"still",
"keep",
"it",
"in",
"the",
"job",
"queue",
".",
"An",
"IndexError",
"will",
"be",
"raised",
"if",
"that",
"position",
"does",
"not",
"currently",
"exist",
"in",
"the",
"job",
"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/forward_analysis.py#L800-L812 | train |
angr/angr | angr/analyses/forward_analysis.py | ForwardAnalysis._binary_insert | def _binary_insert(lst, elem, key, lo=0, hi=None):
"""
Insert an element into a sorted list, and keep the list sorted.
The major difference from bisect.bisect_left is that this function supports a key method, so user doesn't have
to create the key array for each insertion.
:par... | python | def _binary_insert(lst, elem, key, lo=0, hi=None):
"""
Insert an element into a sorted list, and keep the list sorted.
The major difference from bisect.bisect_left is that this function supports a key method, so user doesn't have
to create the key array for each insertion.
:par... | [
"def",
"_binary_insert",
"(",
"lst",
",",
"elem",
",",
"key",
",",
"lo",
"=",
"0",
",",
"hi",
"=",
"None",
")",
":",
"if",
"lo",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"lo must be a non-negative number\"",
")",
"if",
"hi",
"is",
"None",
":",
"h... | Insert an element into a sorted list, and keep the list sorted.
The major difference from bisect.bisect_left is that this function supports a key method, so user doesn't have
to create the key array for each insertion.
:param list lst: The list. Must be pre-ordered.
:param object eleme... | [
"Insert",
"an",
"element",
"into",
"a",
"sorted",
"list",
"and",
"keep",
"the",
"list",
"sorted",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/forward_analysis.py#L819-L847 | train |
angr/angr | angr/state_plugins/symbolic_memory.py | SimSymbolicMemory.merge | def merge(self, others, merge_conditions, common_ancestor=None): # pylint: disable=unused-argument
"""
Merge this SimMemory with the other SimMemory
"""
changed_bytes = self._changes_to_merge(others)
l.info("Merging %d bytes", len(changed_bytes))
l.info("... %s has chan... | python | def merge(self, others, merge_conditions, common_ancestor=None): # pylint: disable=unused-argument
"""
Merge this SimMemory with the other SimMemory
"""
changed_bytes = self._changes_to_merge(others)
l.info("Merging %d bytes", len(changed_bytes))
l.info("... %s has chan... | [
"def",
"merge",
"(",
"self",
",",
"others",
",",
"merge_conditions",
",",
"common_ancestor",
"=",
"None",
")",
":",
"# pylint: disable=unused-argument",
"changed_bytes",
"=",
"self",
".",
"_changes_to_merge",
"(",
"others",
")",
"l",
".",
"info",
"(",
"\"Merging... | Merge this SimMemory with the other SimMemory | [
"Merge",
"this",
"SimMemory",
"with",
"the",
"other",
"SimMemory"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/symbolic_memory.py#L96-L114 | train |
angr/angr | angr/state_plugins/symbolic_memory.py | SimSymbolicMemory.make_symbolic | def make_symbolic(self, name, addr, length=None):
"""
Replaces `length` bytes starting at `addr` with a symbolic variable named name. Adds a constraint equaling that
symbolic variable to the value previously at `addr`, and returns the variable.
"""
l.debug("making %s bytes symbol... | python | def make_symbolic(self, name, addr, length=None):
"""
Replaces `length` bytes starting at `addr` with a symbolic variable named name. Adds a constraint equaling that
symbolic variable to the value previously at `addr`, and returns the variable.
"""
l.debug("making %s bytes symbol... | [
"def",
"make_symbolic",
"(",
"self",
",",
"name",
",",
"addr",
",",
"length",
"=",
"None",
")",
":",
"l",
".",
"debug",
"(",
"\"making %s bytes symbolic\"",
",",
"length",
")",
"if",
"isinstance",
"(",
"addr",
",",
"str",
")",
":",
"addr",
",",
"length... | Replaces `length` bytes starting at `addr` with a symbolic variable named name. Adds a constraint equaling that
symbolic variable to the value previously at `addr`, and returns the variable. | [
"Replaces",
"length",
"bytes",
"starting",
"at",
"addr",
"with",
"a",
"symbolic",
"variable",
"named",
"name",
".",
"Adds",
"a",
"constraint",
"equaling",
"that",
"symbolic",
"variable",
"to",
"the",
"value",
"previously",
"at",
"addr",
"and",
"returns",
"the"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/symbolic_memory.py#L297-L316 | train |
angr/angr | angr/state_plugins/symbolic_memory.py | SimSymbolicMemory._apply_concretization_strategies | def _apply_concretization_strategies(self, addr, strategies, action):
"""
Applies concretization strategies on the address until one of them succeeds.
"""
# we try all the strategies in order
for s in strategies:
# first, we trigger the SimInspect breakpoint and give... | python | def _apply_concretization_strategies(self, addr, strategies, action):
"""
Applies concretization strategies on the address until one of them succeeds.
"""
# we try all the strategies in order
for s in strategies:
# first, we trigger the SimInspect breakpoint and give... | [
"def",
"_apply_concretization_strategies",
"(",
"self",
",",
"addr",
",",
"strategies",
",",
"action",
")",
":",
"# we try all the strategies in order",
"for",
"s",
"in",
"strategies",
":",
"# first, we trigger the SimInspect breakpoint and give it a chance to intervene",
"e",
... | Applies concretization strategies on the address until one of them succeeds. | [
"Applies",
"concretization",
"strategies",
"on",
"the",
"address",
"until",
"one",
"of",
"them",
"succeeds",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/symbolic_memory.py#L352-L393 | train |
angr/angr | angr/state_plugins/symbolic_memory.py | SimSymbolicMemory.concretize_write_addr | def concretize_write_addr(self, addr, strategies=None):
"""
Concretizes an address meant for writing.
:param addr: An expression for the address.
:param strategies: A list of concretization strategies (to override the default).
:returns: ... | python | def concretize_write_addr(self, addr, strategies=None):
"""
Concretizes an address meant for writing.
:param addr: An expression for the address.
:param strategies: A list of concretization strategies (to override the default).
:returns: ... | [
"def",
"concretize_write_addr",
"(",
"self",
",",
"addr",
",",
"strategies",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"addr",
",",
"int",
")",
":",
"return",
"[",
"addr",
"]",
"elif",
"not",
"self",
".",
"state",
".",
"solver",
".",
"symbolic",
... | Concretizes an address meant for writing.
:param addr: An expression for the address.
:param strategies: A list of concretization strategies (to override the default).
:returns: A list of concrete addresses. | [
"Concretizes",
"an",
"address",
"meant",
"for",
"writing",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/symbolic_memory.py#L395-L410 | train |
angr/angr | angr/state_plugins/symbolic_memory.py | SimSymbolicMemory.concretize_read_addr | def concretize_read_addr(self, addr, strategies=None):
"""
Concretizes an address meant for reading.
:param addr: An expression for the address.
:param strategies: A list of concretization strategies (to override the default).
:returns: ... | python | def concretize_read_addr(self, addr, strategies=None):
"""
Concretizes an address meant for reading.
:param addr: An expression for the address.
:param strategies: A list of concretization strategies (to override the default).
:returns: ... | [
"def",
"concretize_read_addr",
"(",
"self",
",",
"addr",
",",
"strategies",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"addr",
",",
"int",
")",
":",
"return",
"[",
"addr",
"]",
"elif",
"not",
"self",
".",
"state",
".",
"solver",
".",
"symbolic",
... | Concretizes an address meant for reading.
:param addr: An expression for the address.
:param strategies: A list of concretization strategies (to override the default).
:returns: A list of concrete addresses. | [
"Concretizes",
"an",
"address",
"meant",
"for",
"reading",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/symbolic_memory.py#L412-L427 | train |
angr/angr | angr/state_plugins/symbolic_memory.py | SimSymbolicMemory.dbg_print | def dbg_print(self, indent=0):
"""
Print out debugging information.
"""
lst = []
more_data = False
for i, addr in enumerate(self.mem.keys()):
lst.append(addr)
if i >= 20:
more_data = True
break
for addr in s... | python | def dbg_print(self, indent=0):
"""
Print out debugging information.
"""
lst = []
more_data = False
for i, addr in enumerate(self.mem.keys()):
lst.append(addr)
if i >= 20:
more_data = True
break
for addr in s... | [
"def",
"dbg_print",
"(",
"self",
",",
"indent",
"=",
"0",
")",
":",
"lst",
"=",
"[",
"]",
"more_data",
"=",
"False",
"for",
"i",
",",
"addr",
"in",
"enumerate",
"(",
"self",
".",
"mem",
".",
"keys",
"(",
")",
")",
":",
"lst",
".",
"append",
"("... | Print out debugging information. | [
"Print",
"out",
"debugging",
"information",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/symbolic_memory.py#L1134-L1154 | train |
angr/angr | angr/state_plugins/symbolic_memory.py | SimSymbolicMemory.permissions | def permissions(self, addr, permissions=None):
"""
Retrieve the permissions of the page at address `addr`.
:param addr: address to get the page permissions
:param permissions: Integer or BVV to optionally set page permissions to
:return: AST representing the pe... | python | def permissions(self, addr, permissions=None):
"""
Retrieve the permissions of the page at address `addr`.
:param addr: address to get the page permissions
:param permissions: Integer or BVV to optionally set page permissions to
:return: AST representing the pe... | [
"def",
"permissions",
"(",
"self",
",",
"addr",
",",
"permissions",
"=",
"None",
")",
":",
"out",
"=",
"self",
".",
"mem",
".",
"permissions",
"(",
"addr",
",",
"permissions",
")",
"# if unicorn is in play and we've marked a page writable, it must be uncached",
"if"... | Retrieve the permissions of the page at address `addr`.
:param addr: address to get the page permissions
:param permissions: Integer or BVV to optionally set page permissions to
:return: AST representing the permissions on the page | [
"Retrieve",
"the",
"permissions",
"of",
"the",
"page",
"at",
"address",
"addr",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/symbolic_memory.py#L1234-L1247 | train |
angr/angr | angr/state_plugins/symbolic_memory.py | SimSymbolicMemory.map_region | def map_region(self, addr, length, permissions, init_zero=False):
"""
Map a number of pages at address `addr` with permissions `permissions`.
:param addr: address to map the pages at
:param length: length in bytes of region to map, will be rounded upwards to the page size
:param ... | python | def map_region(self, addr, length, permissions, init_zero=False):
"""
Map a number of pages at address `addr` with permissions `permissions`.
:param addr: address to map the pages at
:param length: length in bytes of region to map, will be rounded upwards to the page size
:param ... | [
"def",
"map_region",
"(",
"self",
",",
"addr",
",",
"length",
",",
"permissions",
",",
"init_zero",
"=",
"False",
")",
":",
"l",
".",
"info",
"(",
"\"Mapping [%#x, %#x] as %s\"",
",",
"addr",
",",
"addr",
"+",
"length",
"-",
"1",
",",
"permissions",
")",... | Map a number of pages at address `addr` with permissions `permissions`.
:param addr: address to map the pages at
:param length: length in bytes of region to map, will be rounded upwards to the page size
:param permissions: AST of permissions to map, will be a bitvalue representing flags
... | [
"Map",
"a",
"number",
"of",
"pages",
"at",
"address",
"addr",
"with",
"permissions",
"permissions",
".",
":",
"param",
"addr",
":",
"address",
"to",
"map",
"the",
"pages",
"at",
":",
"param",
"length",
":",
"length",
"in",
"bytes",
"of",
"region",
"to",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/symbolic_memory.py#L1249-L1258 | train |
angr/angr | angr/factory.py | AngrObjectFactory.successors | def successors(self, *args, **kwargs):
"""
Perform execution using any applicable engine. Enumerate the current engines and use the
first one that works. Return a SimSuccessors object classifying the results of the run.
:param state: The state to analyze
:param addr: ... | python | def successors(self, *args, **kwargs):
"""
Perform execution using any applicable engine. Enumerate the current engines and use the
first one that works. Return a SimSuccessors object classifying the results of the run.
:param state: The state to analyze
:param addr: ... | [
"def",
"successors",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"project",
".",
"engines",
".",
"successors",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Perform execution using any applicable engine. Enumerate the current engines and use the
first one that works. Return a SimSuccessors object classifying the results of the run.
:param state: The state to analyze
:param addr: optional, an address to execute at instead of the... | [
"Perform",
"execution",
"using",
"any",
"applicable",
"engine",
".",
"Enumerate",
"the",
"current",
"engines",
"and",
"use",
"the",
"first",
"one",
"that",
"works",
".",
"Return",
"a",
"SimSuccessors",
"object",
"classifying",
"the",
"results",
"of",
"the",
"r... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/factory.py#L41-L54 | train |
angr/angr | angr/factory.py | AngrObjectFactory.call_state | def call_state(self, addr, *args, **kwargs):
"""
Returns a state object initialized to the start of a given function, as if it were called with given parameters.
:param addr: The address the state should start at instead of the entry point.
:param args: Any additio... | python | def call_state(self, addr, *args, **kwargs):
"""
Returns a state object initialized to the start of a given function, as if it were called with given parameters.
:param addr: The address the state should start at instead of the entry point.
:param args: Any additio... | [
"def",
"call_state",
"(",
"self",
",",
"addr",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"project",
".",
"simos",
".",
"state_call",
"(",
"addr",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Returns a state object initialized to the start of a given function, as if it were called with given parameters.
:param addr: The address the state should start at instead of the entry point.
:param args: Any additional positional arguments will be used as arguments to the functio... | [
"Returns",
"a",
"state",
"object",
"initialized",
"to",
"the",
"start",
"of",
"a",
"given",
"function",
"as",
"if",
"it",
"were",
"called",
"with",
"given",
"parameters",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/factory.py#L118-L160 | train |
angr/angr | angr/factory.py | AngrObjectFactory.simulation_manager | def simulation_manager(self, thing=None, **kwargs):
"""
Constructs a new simulation manager.
:param thing: Optional - What to put in the new SimulationManager's active stash (either a SimState or a list of SimStates).
:param kwargs: Any additional keyword arguments wi... | python | def simulation_manager(self, thing=None, **kwargs):
"""
Constructs a new simulation manager.
:param thing: Optional - What to put in the new SimulationManager's active stash (either a SimState or a list of SimStates).
:param kwargs: Any additional keyword arguments wi... | [
"def",
"simulation_manager",
"(",
"self",
",",
"thing",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"thing",
"is",
"None",
":",
"thing",
"=",
"[",
"self",
".",
"entry_state",
"(",
")",
"]",
"elif",
"isinstance",
"(",
"thing",
",",
"(",
"l... | Constructs a new simulation manager.
:param thing: Optional - What to put in the new SimulationManager's active stash (either a SimState or a list of SimStates).
:param kwargs: Any additional keyword arguments will be passed to the SimulationManager constructor
:returns: ... | [
"Constructs",
"a",
"new",
"simulation",
"manager",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/factory.py#L162-L188 | train |
angr/angr | angr/factory.py | AngrObjectFactory.callable | def callable(self, addr, concrete_only=False, perform_merge=True, base_state=None, toc=None, cc=None):
"""
A Callable is a representation of a function in the binary that can be interacted with like a native python
function.
:param addr: The address of the function to use
... | python | def callable(self, addr, concrete_only=False, perform_merge=True, base_state=None, toc=None, cc=None):
"""
A Callable is a representation of a function in the binary that can be interacted with like a native python
function.
:param addr: The address of the function to use
... | [
"def",
"callable",
"(",
"self",
",",
"addr",
",",
"concrete_only",
"=",
"False",
",",
"perform_merge",
"=",
"True",
",",
"base_state",
"=",
"None",
",",
"toc",
"=",
"None",
",",
"cc",
"=",
"None",
")",
":",
"return",
"Callable",
"(",
"self",
".",
"pr... | A Callable is a representation of a function in the binary that can be interacted with like a native python
function.
:param addr: The address of the function to use
:param concrete_only: Throw an exception if the execution splits into multiple states
:param perform_merge: ... | [
"A",
"Callable",
"is",
"a",
"representation",
"of",
"a",
"function",
"in",
"the",
"binary",
"that",
"can",
"be",
"interacted",
"with",
"like",
"a",
"native",
"python",
"function",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/factory.py#L196-L217 | train |
angr/angr | angr/factory.py | AngrObjectFactory.cc | def cc(self, args=None, ret_val=None, sp_delta=None, func_ty=None):
"""
Return a SimCC (calling convention) parametrized for this project and, optionally, a given function.
:param args: A list of argument storage locations, as SimFunctionArguments.
:param ret_val: The return ... | python | def cc(self, args=None, ret_val=None, sp_delta=None, func_ty=None):
"""
Return a SimCC (calling convention) parametrized for this project and, optionally, a given function.
:param args: A list of argument storage locations, as SimFunctionArguments.
:param ret_val: The return ... | [
"def",
"cc",
"(",
"self",
",",
"args",
"=",
"None",
",",
"ret_val",
"=",
"None",
",",
"sp_delta",
"=",
"None",
",",
"func_ty",
"=",
"None",
")",
":",
"return",
"self",
".",
"_default_cc",
"(",
"arch",
"=",
"self",
".",
"project",
".",
"arch",
",",
... | Return a SimCC (calling convention) parametrized for this project and, optionally, a given function.
:param args: A list of argument storage locations, as SimFunctionArguments.
:param ret_val: The return value storage location, as a SimFunctionArgument.
:param sp_delta: Does this ... | [
"Return",
"a",
"SimCC",
"(",
"calling",
"convention",
")",
"parametrized",
"for",
"this",
"project",
"and",
"optionally",
"a",
"given",
"function",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/factory.py#L219-L244 | train |
angr/angr | angr/factory.py | AngrObjectFactory.cc_from_arg_kinds | def cc_from_arg_kinds(self, fp_args, ret_fp=None, sizes=None, sp_delta=None, func_ty=None):
"""
Get a SimCC (calling convention) that will extract floating-point/integral args correctly.
:param arch: The Archinfo arch for this CC
:param fp_args: A list, with one entry for eac... | python | def cc_from_arg_kinds(self, fp_args, ret_fp=None, sizes=None, sp_delta=None, func_ty=None):
"""
Get a SimCC (calling convention) that will extract floating-point/integral args correctly.
:param arch: The Archinfo arch for this CC
:param fp_args: A list, with one entry for eac... | [
"def",
"cc_from_arg_kinds",
"(",
"self",
",",
"fp_args",
",",
"ret_fp",
"=",
"None",
",",
"sizes",
"=",
"None",
",",
"sp_delta",
"=",
"None",
",",
"func_ty",
"=",
"None",
")",
":",
"return",
"self",
".",
"_default_cc",
".",
"from_arg_kinds",
"(",
"arch",... | Get a SimCC (calling convention) that will extract floating-point/integral args correctly.
:param arch: The Archinfo arch for this CC
:param fp_args: A list, with one entry for each argument the function can take. True if the argument is fp,
false if it is integra... | [
"Get",
"a",
"SimCC",
"(",
"calling",
"convention",
")",
"that",
"will",
"extract",
"floating",
"-",
"point",
"/",
"integral",
"args",
"correctly",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/factory.py#L246-L271 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function.blocks | def blocks(self):
"""
An iterator of all local blocks in the current function.
:return: angr.lifter.Block instances.
"""
for block_addr, block in self._local_blocks.items():
try:
yield self._get_block(block_addr, size=block.size,
... | python | def blocks(self):
"""
An iterator of all local blocks in the current function.
:return: angr.lifter.Block instances.
"""
for block_addr, block in self._local_blocks.items():
try:
yield self._get_block(block_addr, size=block.size,
... | [
"def",
"blocks",
"(",
"self",
")",
":",
"for",
"block_addr",
",",
"block",
"in",
"self",
".",
"_local_blocks",
".",
"items",
"(",
")",
":",
"try",
":",
"yield",
"self",
".",
"_get_block",
"(",
"block_addr",
",",
"size",
"=",
"block",
".",
"size",
","... | An iterator of all local blocks in the current function.
:return: angr.lifter.Block instances. | [
"An",
"iterator",
"of",
"all",
"local",
"blocks",
"in",
"the",
"current",
"function",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L204-L216 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function.operations | def operations(self):
"""
All of the operations that are done by this functions.
"""
return [op for block in self.blocks for op in block.vex.operations] | python | def operations(self):
"""
All of the operations that are done by this functions.
"""
return [op for block in self.blocks for op in block.vex.operations] | [
"def",
"operations",
"(",
"self",
")",
":",
"return",
"[",
"op",
"for",
"block",
"in",
"self",
".",
"blocks",
"for",
"op",
"in",
"block",
".",
"vex",
".",
"operations",
"]"
] | All of the operations that are done by this functions. | [
"All",
"of",
"the",
"operations",
"that",
"are",
"done",
"by",
"this",
"functions",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L285-L289 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function.code_constants | def code_constants(self):
"""
All of the constants that are used by this functions's code.
"""
# TODO: remove link register values
return [const.value for block in self.blocks for const in block.vex.constants] | python | def code_constants(self):
"""
All of the constants that are used by this functions's code.
"""
# TODO: remove link register values
return [const.value for block in self.blocks for const in block.vex.constants] | [
"def",
"code_constants",
"(",
"self",
")",
":",
"# TODO: remove link register values",
"return",
"[",
"const",
".",
"value",
"for",
"block",
"in",
"self",
".",
"blocks",
"for",
"const",
"in",
"block",
".",
"vex",
".",
"constants",
"]"
] | All of the constants that are used by this functions's code. | [
"All",
"of",
"the",
"constants",
"that",
"are",
"used",
"by",
"this",
"functions",
"s",
"code",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L292-L297 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function.string_references | def string_references(self, minimum_length=2, vex_only=False):
"""
All of the constant string references used by this function.
:param minimum_length: The minimum length of strings to find (default is 1)
:param vex_only: Only analyze VEX IR, don't interpret the entry state to de... | python | def string_references(self, minimum_length=2, vex_only=False):
"""
All of the constant string references used by this function.
:param minimum_length: The minimum length of strings to find (default is 1)
:param vex_only: Only analyze VEX IR, don't interpret the entry state to de... | [
"def",
"string_references",
"(",
"self",
",",
"minimum_length",
"=",
"2",
",",
"vex_only",
"=",
"False",
")",
":",
"strings",
"=",
"[",
"]",
"memory",
"=",
"self",
".",
"_project",
".",
"loader",
".",
"memory",
"# get known instruction addresses and call targets... | All of the constant string references used by this function.
:param minimum_length: The minimum length of strings to find (default is 1)
:param vex_only: Only analyze VEX IR, don't interpret the entry state to detect additional constants.
:return: A list of tuples of (add... | [
"All",
"of",
"the",
"constant",
"string",
"references",
"used",
"by",
"this",
"function",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L435-L477 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function.local_runtime_values | def local_runtime_values(self):
"""
Tries to find all runtime values of this function which do not come from inputs.
These values are generated by starting from a blank state and reanalyzing the basic blocks once each.
Function calls are skipped, and back edges are never taken so these v... | python | def local_runtime_values(self):
"""
Tries to find all runtime values of this function which do not come from inputs.
These values are generated by starting from a blank state and reanalyzing the basic blocks once each.
Function calls are skipped, and back edges are never taken so these v... | [
"def",
"local_runtime_values",
"(",
"self",
")",
":",
"constants",
"=",
"set",
"(",
")",
"if",
"not",
"self",
".",
"_project",
".",
"loader",
".",
"main_object",
".",
"contains_addr",
"(",
"self",
".",
"addr",
")",
":",
"return",
"constants",
"# FIXME the ... | Tries to find all runtime values of this function which do not come from inputs.
These values are generated by starting from a blank state and reanalyzing the basic blocks once each.
Function calls are skipped, and back edges are never taken so these values are often unreliable,
This function is... | [
"Tries",
"to",
"find",
"all",
"runtime",
"values",
"of",
"this",
"function",
"which",
"do",
"not",
"come",
"from",
"inputs",
".",
"These",
"values",
"are",
"generated",
"by",
"starting",
"from",
"a",
"blank",
"state",
"and",
"reanalyzing",
"the",
"basic",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L480-L570 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function.runtime_values | def runtime_values(self):
"""
All of the concrete values used by this function at runtime (i.e., including passed-in arguments and global
values).
"""
constants = set()
for b in self.block_addrs:
for sirsb in self._function_manager._cfg.get_all_irsbs(b):
... | python | def runtime_values(self):
"""
All of the concrete values used by this function at runtime (i.e., including passed-in arguments and global
values).
"""
constants = set()
for b in self.block_addrs:
for sirsb in self._function_manager._cfg.get_all_irsbs(b):
... | [
"def",
"runtime_values",
"(",
"self",
")",
":",
"constants",
"=",
"set",
"(",
")",
"for",
"b",
"in",
"self",
".",
"block_addrs",
":",
"for",
"sirsb",
"in",
"self",
".",
"_function_manager",
".",
"_cfg",
".",
"get_all_irsbs",
"(",
"b",
")",
":",
"for",
... | All of the concrete values used by this function at runtime (i.e., including passed-in arguments and global
values). | [
"All",
"of",
"the",
"concrete",
"values",
"used",
"by",
"this",
"function",
"at",
"runtime",
"(",
"i",
".",
"e",
".",
"including",
"passed",
"-",
"in",
"arguments",
"and",
"global",
"values",
")",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L573-L588 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function.binary | def binary(self):
"""
Get the object this function belongs to.
:return: The object this function belongs to.
"""
return self._project.loader.find_object_containing(self.addr, membership_check=False) | python | def binary(self):
"""
Get the object this function belongs to.
:return: The object this function belongs to.
"""
return self._project.loader.find_object_containing(self.addr, membership_check=False) | [
"def",
"binary",
"(",
"self",
")",
":",
"return",
"self",
".",
"_project",
".",
"loader",
".",
"find_object_containing",
"(",
"self",
".",
"addr",
",",
"membership_check",
"=",
"False",
")"
] | Get the object this function belongs to.
:return: The object this function belongs to. | [
"Get",
"the",
"object",
"this",
"function",
"belongs",
"to",
".",
":",
"return",
":",
"The",
"object",
"this",
"function",
"belongs",
"to",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L647-L653 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function.add_jumpout_site | def add_jumpout_site(self, node):
"""
Add a custom jumpout site.
:param node: The address of the basic block that control flow leaves during this transition.
:return: None
"""
self._register_nodes(True, node)
self._jumpout_sites.add(node)
self.... | python | def add_jumpout_site(self, node):
"""
Add a custom jumpout site.
:param node: The address of the basic block that control flow leaves during this transition.
:return: None
"""
self._register_nodes(True, node)
self._jumpout_sites.add(node)
self.... | [
"def",
"add_jumpout_site",
"(",
"self",
",",
"node",
")",
":",
"self",
".",
"_register_nodes",
"(",
"True",
",",
"node",
")",
"self",
".",
"_jumpout_sites",
".",
"add",
"(",
"node",
")",
"self",
".",
"_add_endpoint",
"(",
"node",
",",
"'transition'",
")"... | Add a custom jumpout site.
:param node: The address of the basic block that control flow leaves during this transition.
:return: None | [
"Add",
"a",
"custom",
"jumpout",
"site",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L655-L665 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function.add_retout_site | def add_retout_site(self, node):
"""
Add a custom retout site.
Retout (returning to outside of the function) sites are very rare. It mostly occurs during CFG recovery when we
incorrectly identify the beginning of a function in the first iteration, and then correctly identify that
... | python | def add_retout_site(self, node):
"""
Add a custom retout site.
Retout (returning to outside of the function) sites are very rare. It mostly occurs during CFG recovery when we
incorrectly identify the beginning of a function in the first iteration, and then correctly identify that
... | [
"def",
"add_retout_site",
"(",
"self",
",",
"node",
")",
":",
"self",
".",
"_register_nodes",
"(",
"True",
",",
"node",
")",
"self",
".",
"_retout_sites",
".",
"add",
"(",
"node",
")",
"self",
".",
"_add_endpoint",
"(",
"node",
",",
"'return'",
")"
] | Add a custom retout site.
Retout (returning to outside of the function) sites are very rare. It mostly occurs during CFG recovery when we
incorrectly identify the beginning of a function in the first iteration, and then correctly identify that
function later in the same iteration (function alig... | [
"Add",
"a",
"custom",
"retout",
"site",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L667-L685 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function._get_initial_name | def _get_initial_name(self):
"""
Determine the most suitable name of the function.
:return: The initial function name.
:rtype: string
"""
name = None
addr = self.addr
# Try to get a name from existing labels
if self._function_manager is n... | python | def _get_initial_name(self):
"""
Determine the most suitable name of the function.
:return: The initial function name.
:rtype: string
"""
name = None
addr = self.addr
# Try to get a name from existing labels
if self._function_manager is n... | [
"def",
"_get_initial_name",
"(",
"self",
")",
":",
"name",
"=",
"None",
"addr",
"=",
"self",
".",
"addr",
"# Try to get a name from existing labels",
"if",
"self",
".",
"_function_manager",
"is",
"not",
"None",
":",
"if",
"addr",
"in",
"self",
".",
"_function_... | Determine the most suitable name of the function.
:return: The initial function name.
:rtype: string | [
"Determine",
"the",
"most",
"suitable",
"name",
"of",
"the",
"function",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L687-L717 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function._get_initial_binary_name | def _get_initial_binary_name(self):
"""
Determine the name of the binary where this function is.
:return: None
"""
binary_name = None
# if this function is a simprocedure but not a syscall, use its library name as
# its binary name
# if it is a syscall,... | python | def _get_initial_binary_name(self):
"""
Determine the name of the binary where this function is.
:return: None
"""
binary_name = None
# if this function is a simprocedure but not a syscall, use its library name as
# its binary name
# if it is a syscall,... | [
"def",
"_get_initial_binary_name",
"(",
"self",
")",
":",
"binary_name",
"=",
"None",
"# if this function is a simprocedure but not a syscall, use its library name as",
"# its binary name",
"# if it is a syscall, fall back to use self.binary.binary which explicitly says cle##kernel",
"if",
... | Determine the name of the binary where this function is.
:return: None | [
"Determine",
"the",
"name",
"of",
"the",
"binary",
"where",
"this",
"function",
"is",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L719-L739 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function._get_initial_returning | def _get_initial_returning(self):
"""
Determine if this function returns or not *if it is hooked by a SimProcedure or a user hook*.
:return: True if the hooker returns, False otherwise.
:rtype: bool
"""
hooker = None
if self.is_syscall:
hooker... | python | def _get_initial_returning(self):
"""
Determine if this function returns or not *if it is hooked by a SimProcedure or a user hook*.
:return: True if the hooker returns, False otherwise.
:rtype: bool
"""
hooker = None
if self.is_syscall:
hooker... | [
"def",
"_get_initial_returning",
"(",
"self",
")",
":",
"hooker",
"=",
"None",
"if",
"self",
".",
"is_syscall",
":",
"hooker",
"=",
"self",
".",
"project",
".",
"simos",
".",
"syscall_from_addr",
"(",
"self",
".",
"addr",
")",
"elif",
"self",
".",
"is_si... | Determine if this function returns or not *if it is hooked by a SimProcedure or a user hook*.
:return: True if the hooker returns, False otherwise.
:rtype: bool | [
"Determine",
"if",
"this",
"function",
"returns",
"or",
"not",
"*",
"if",
"it",
"is",
"hooked",
"by",
"a",
"SimProcedure",
"or",
"a",
"user",
"hook",
"*",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L741-L758 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function._transit_to | def _transit_to(self, from_node, to_node, outside=False, ins_addr=None, stmt_idx=None):
"""
Registers an edge between basic blocks in this function's transition graph.
Arguments are CodeNode objects.
:param from_node The address of the basic block that control
... | python | def _transit_to(self, from_node, to_node, outside=False, ins_addr=None, stmt_idx=None):
"""
Registers an edge between basic blocks in this function's transition graph.
Arguments are CodeNode objects.
:param from_node The address of the basic block that control
... | [
"def",
"_transit_to",
"(",
"self",
",",
"from_node",
",",
"to_node",
",",
"outside",
"=",
"False",
",",
"ins_addr",
"=",
"None",
",",
"stmt_idx",
"=",
"None",
")",
":",
"if",
"outside",
":",
"self",
".",
"_register_nodes",
"(",
"True",
",",
"from_node",
... | Registers an edge between basic blocks in this function's transition graph.
Arguments are CodeNode objects.
:param from_node The address of the basic block that control
flow leaves during this transition.
:param to_node The address of ... | [
"Registers",
"an",
"edge",
"between",
"basic",
"blocks",
"in",
"this",
"function",
"s",
"transition",
"graph",
".",
"Arguments",
"are",
"CodeNode",
"objects",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L783-L818 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function._call_to | def _call_to(self, from_node, to_func, ret_node, stmt_idx=None, ins_addr=None, return_to_outside=False):
"""
Registers an edge between the caller basic block and callee function.
:param from_addr: The basic block that control flow leaves during the transition.
:type from_addr: angr... | python | def _call_to(self, from_node, to_func, ret_node, stmt_idx=None, ins_addr=None, return_to_outside=False):
"""
Registers an edge between the caller basic block and callee function.
:param from_addr: The basic block that control flow leaves during the transition.
:type from_addr: angr... | [
"def",
"_call_to",
"(",
"self",
",",
"from_node",
",",
"to_func",
",",
"ret_node",
",",
"stmt_idx",
"=",
"None",
",",
"ins_addr",
"=",
"None",
",",
"return_to_outside",
"=",
"False",
")",
":",
"self",
".",
"_register_nodes",
"(",
"True",
",",
"from_node",
... | Registers an edge between the caller basic block and callee function.
:param from_addr: The basic block that control flow leaves during the transition.
:type from_addr: angr.knowledge.CodeNode
:param to_func: The function that we are calling
:type to_func: Function
... | [
"Registers",
"an",
"edge",
"between",
"the",
"caller",
"basic",
"block",
"and",
"callee",
"function",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L820-L846 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function._add_return_site | def _add_return_site(self, return_site):
"""
Registers a basic block as a site for control flow to return from this function.
:param CodeNode return_site: The block node that ends with a return.
"""
self._register_nodes(True, return_site)
self._ret_sites.add(return_... | python | def _add_return_site(self, return_site):
"""
Registers a basic block as a site for control flow to return from this function.
:param CodeNode return_site: The block node that ends with a return.
"""
self._register_nodes(True, return_site)
self._ret_sites.add(return_... | [
"def",
"_add_return_site",
"(",
"self",
",",
"return_site",
")",
":",
"self",
".",
"_register_nodes",
"(",
"True",
",",
"return_site",
")",
"self",
".",
"_ret_sites",
".",
"add",
"(",
"return_site",
")",
"# A return site must be an endpoint of the function - you canno... | Registers a basic block as a site for control flow to return from this function.
:param CodeNode return_site: The block node that ends with a return. | [
"Registers",
"a",
"basic",
"block",
"as",
"a",
"site",
"for",
"control",
"flow",
"to",
"return",
"from",
"this",
"function",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L898-L909 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function._add_call_site | def _add_call_site(self, call_site_addr, call_target_addr, retn_addr):
"""
Registers a basic block as calling a function and returning somewhere.
:param call_site_addr: The address of a basic block that ends in a call.
:param call_target_addr: The address of the target of said... | python | def _add_call_site(self, call_site_addr, call_target_addr, retn_addr):
"""
Registers a basic block as calling a function and returning somewhere.
:param call_site_addr: The address of a basic block that ends in a call.
:param call_target_addr: The address of the target of said... | [
"def",
"_add_call_site",
"(",
"self",
",",
"call_site_addr",
",",
"call_target_addr",
",",
"retn_addr",
")",
":",
"self",
".",
"_call_sites",
"[",
"call_site_addr",
"]",
"=",
"(",
"call_target_addr",
",",
"retn_addr",
")"
] | Registers a basic block as calling a function and returning somewhere.
:param call_site_addr: The address of a basic block that ends in a call.
:param call_target_addr: The address of the target of said call.
:param retn_addr: The address that said call will return to. | [
"Registers",
"a",
"basic",
"block",
"as",
"calling",
"a",
"function",
"and",
"returning",
"somewhere",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L911-L919 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function.mark_nonreturning_calls_endpoints | def mark_nonreturning_calls_endpoints(self):
"""
Iterate through all call edges in transition graph. For each call a non-returning function, mark the source
basic block as an endpoint.
This method should only be executed once all functions are recovered and analyzed by CFG recovery, so ... | python | def mark_nonreturning_calls_endpoints(self):
"""
Iterate through all call edges in transition graph. For each call a non-returning function, mark the source
basic block as an endpoint.
This method should only be executed once all functions are recovered and analyzed by CFG recovery, so ... | [
"def",
"mark_nonreturning_calls_endpoints",
"(",
"self",
")",
":",
"for",
"src",
",",
"dst",
",",
"data",
"in",
"self",
".",
"transition_graph",
".",
"edges",
"(",
"data",
"=",
"True",
")",
":",
"if",
"'type'",
"in",
"data",
"and",
"data",
"[",
"'type'",... | Iterate through all call edges in transition graph. For each call a non-returning function, mark the source
basic block as an endpoint.
This method should only be executed once all functions are recovered and analyzed by CFG recovery, so we know
whether each function returns or not.
:r... | [
"Iterate",
"through",
"all",
"call",
"edges",
"in",
"transition",
"graph",
".",
"For",
"each",
"call",
"a",
"non",
"-",
"returning",
"function",
"mark",
"the",
"source",
"basic",
"block",
"as",
"an",
"endpoint",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L972-L992 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function.graph | def graph(self):
"""
Return a local transition graph that only contain nodes in current function.
"""
if self._local_transition_graph is not None:
return self._local_transition_graph
g = networkx.DiGraph()
if self.startpoint is not None:
g.add_no... | python | def graph(self):
"""
Return a local transition graph that only contain nodes in current function.
"""
if self._local_transition_graph is not None:
return self._local_transition_graph
g = networkx.DiGraph()
if self.startpoint is not None:
g.add_no... | [
"def",
"graph",
"(",
"self",
")",
":",
"if",
"self",
".",
"_local_transition_graph",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_local_transition_graph",
"g",
"=",
"networkx",
".",
"DiGraph",
"(",
")",
"if",
"self",
".",
"startpoint",
"is",
"not",
... | Return a local transition graph that only contain nodes in current function. | [
"Return",
"a",
"local",
"transition",
"graph",
"that",
"only",
"contain",
"nodes",
"in",
"current",
"function",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L1027-L1050 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function.subgraph | def subgraph(self, ins_addrs):
"""
Generate a sub control flow graph of instruction addresses based on self.graph
:param iterable ins_addrs: A collection of instruction addresses that should be included in the subgraph.
:return: A subgraph.
:rtype: networkx.DiGraph
"""
... | python | def subgraph(self, ins_addrs):
"""
Generate a sub control flow graph of instruction addresses based on self.graph
:param iterable ins_addrs: A collection of instruction addresses that should be included in the subgraph.
:return: A subgraph.
:rtype: networkx.DiGraph
"""
... | [
"def",
"subgraph",
"(",
"self",
",",
"ins_addrs",
")",
":",
"# find all basic blocks that include those instructions",
"blocks",
"=",
"[",
"]",
"block_addr_to_insns",
"=",
"{",
"}",
"for",
"b",
"in",
"self",
".",
"_local_blocks",
".",
"values",
"(",
")",
":",
... | Generate a sub control flow graph of instruction addresses based on self.graph
:param iterable ins_addrs: A collection of instruction addresses that should be included in the subgraph.
:return: A subgraph.
:rtype: networkx.DiGraph | [
"Generate",
"a",
"sub",
"control",
"flow",
"graph",
"of",
"instruction",
"addresses",
"based",
"on",
"self",
".",
"graph"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L1052-L1094 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function.instruction_size | def instruction_size(self, insn_addr):
"""
Get the size of the instruction specified by `insn_addr`.
:param int insn_addr: Address of the instruction
:return: Size of the instruction in bytes, or None if the instruction is not found.
:rtype: int
"""
for b in sel... | python | def instruction_size(self, insn_addr):
"""
Get the size of the instruction specified by `insn_addr`.
:param int insn_addr: Address of the instruction
:return: Size of the instruction in bytes, or None if the instruction is not found.
:rtype: int
"""
for b in sel... | [
"def",
"instruction_size",
"(",
"self",
",",
"insn_addr",
")",
":",
"for",
"b",
"in",
"self",
".",
"blocks",
":",
"block",
"=",
"self",
".",
"_get_block",
"(",
"b",
".",
"addr",
",",
"size",
"=",
"b",
".",
"size",
",",
"byte_string",
"=",
"b",
".",... | Get the size of the instruction specified by `insn_addr`.
:param int insn_addr: Address of the instruction
:return: Size of the instruction in bytes, or None if the instruction is not found.
:rtype: int | [
"Get",
"the",
"size",
"of",
"the",
"instruction",
"specified",
"by",
"insn_addr",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L1096-L1116 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function.dbg_draw | def dbg_draw(self, filename):
"""
Draw the graph and save it to a PNG file.
"""
import matplotlib.pyplot as pyplot # pylint: disable=import-error
from networkx.drawing.nx_agraph import graphviz_layout # pylint: disable=import-error
tmp_graph = networkx.DiGraph()
... | python | def dbg_draw(self, filename):
"""
Draw the graph and save it to a PNG file.
"""
import matplotlib.pyplot as pyplot # pylint: disable=import-error
from networkx.drawing.nx_agraph import graphviz_layout # pylint: disable=import-error
tmp_graph = networkx.DiGraph()
... | [
"def",
"dbg_draw",
"(",
"self",
",",
"filename",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"pyplot",
"# pylint: disable=import-error",
"from",
"networkx",
".",
"drawing",
".",
"nx_agraph",
"import",
"graphviz_layout",
"# pylint: disable=import-error",
"tm... | Draw the graph and save it to a PNG file. | [
"Draw",
"the",
"graph",
"and",
"save",
"it",
"to",
"a",
"PNG",
"file",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L1124-L1142 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function._add_argument_register | def _add_argument_register(self, reg_offset):
"""
Registers a register offset as being used as an argument to the function.
:param reg_offset: The offset of the register to register.
"""
if reg_offset in self._function_manager._arg_registers and \
re... | python | def _add_argument_register(self, reg_offset):
"""
Registers a register offset as being used as an argument to the function.
:param reg_offset: The offset of the register to register.
"""
if reg_offset in self._function_manager._arg_registers and \
re... | [
"def",
"_add_argument_register",
"(",
"self",
",",
"reg_offset",
")",
":",
"if",
"reg_offset",
"in",
"self",
".",
"_function_manager",
".",
"_arg_registers",
"and",
"reg_offset",
"not",
"in",
"self",
".",
"_argument_registers",
":",
"self",
".",
"_argument_registe... | Registers a register offset as being used as an argument to the function.
:param reg_offset: The offset of the register to register. | [
"Registers",
"a",
"register",
"offset",
"as",
"being",
"used",
"as",
"an",
"argument",
"to",
"the",
"function",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L1144-L1152 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function.normalize | def normalize(self):
"""
Make sure all basic blocks in the transition graph of this function do not overlap. You will end up with a CFG
that IDA Pro generates.
This method does not touch the CFG result. You may call CFG{Emulated, Fast}.normalize() for that matter.
:return: None... | python | def normalize(self):
"""
Make sure all basic blocks in the transition graph of this function do not overlap. You will end up with a CFG
that IDA Pro generates.
This method does not touch the CFG result. You may call CFG{Emulated, Fast}.normalize() for that matter.
:return: None... | [
"def",
"normalize",
"(",
"self",
")",
":",
"# let's put a check here",
"if",
"self",
".",
"startpoint",
"is",
"None",
":",
"# this function is empty",
"l",
".",
"debug",
"(",
"'Unexpected error: %s does not have any blocks. normalize() fails.'",
",",
"repr",
"(",
"self"... | Make sure all basic blocks in the transition graph of this function do not overlap. You will end up with a CFG
that IDA Pro generates.
This method does not touch the CFG result. You may call CFG{Emulated, Fast}.normalize() for that matter.
:return: None | [
"Make",
"sure",
"all",
"basic",
"blocks",
"in",
"the",
"transition",
"graph",
"of",
"this",
"function",
"do",
"not",
"overlap",
".",
"You",
"will",
"end",
"up",
"with",
"a",
"CFG",
"that",
"IDA",
"Pro",
"generates",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L1173-L1294 | train |
angr/angr | angr/knowledge_plugins/functions/function.py | Function.find_declaration | def find_declaration(self):
"""
Find the most likely function declaration from the embedded collection of prototypes, set it to self.prototype,
and update self.calling_convention with the declaration.
:return: None
"""
# determine the library name
if not self.i... | python | def find_declaration(self):
"""
Find the most likely function declaration from the embedded collection of prototypes, set it to self.prototype,
and update self.calling_convention with the declaration.
:return: None
"""
# determine the library name
if not self.i... | [
"def",
"find_declaration",
"(",
"self",
")",
":",
"# determine the library name",
"if",
"not",
"self",
".",
"is_plt",
":",
"binary_name",
"=",
"self",
".",
"binary_name",
"if",
"binary_name",
"not",
"in",
"SIM_LIBRARIES",
":",
"return",
"else",
":",
"binary_name... | Find the most likely function declaration from the embedded collection of prototypes, set it to self.prototype,
and update self.calling_convention with the declaration.
:return: None | [
"Find",
"the",
"most",
"likely",
"function",
"declaration",
"from",
"the",
"embedded",
"collection",
"of",
"prototypes",
"set",
"it",
"to",
"self",
".",
"prototype",
"and",
"update",
"self",
".",
"calling_convention",
"with",
"the",
"declaration",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L1296-L1338 | train |
angr/angr | angr/state_plugins/callstack.py | CallStack._rfind | def _rfind(lst, item):
"""
Reverse look-up.
:param list lst: The list to look up in.
:param item: The item to look for.
:return: Offset of the item if found. A ValueError is raised if the item is not in the list.
:rtype: int
"""
try:
return d... | python | def _rfind(lst, item):
"""
Reverse look-up.
:param list lst: The list to look up in.
:param item: The item to look for.
:return: Offset of the item if found. A ValueError is raised if the item is not in the list.
:rtype: int
"""
try:
return d... | [
"def",
"_rfind",
"(",
"lst",
",",
"item",
")",
":",
"try",
":",
"return",
"dropwhile",
"(",
"lambda",
"x",
":",
"lst",
"[",
"x",
"]",
"!=",
"item",
",",
"next",
"(",
"reversed",
"(",
"range",
"(",
"len",
"(",
"lst",
")",
")",
")",
")",
")",
"... | Reverse look-up.
:param list lst: The list to look up in.
:param item: The item to look for.
:return: Offset of the item if found. A ValueError is raised if the item is not in the list.
:rtype: int | [
"Reverse",
"look",
"-",
"up",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/callstack.py#L203-L217 | train |
angr/angr | angr/state_plugins/callstack.py | CallStack.push | def push(self, cf):
"""
Push the frame cf onto the stack. Return the new stack.
"""
cf.next = self
if self.state is not None:
self.state.register_plugin('callstack', cf)
self.state.history.recent_stack_actions.append(CallStackAction(
hash(c... | python | def push(self, cf):
"""
Push the frame cf onto the stack. Return the new stack.
"""
cf.next = self
if self.state is not None:
self.state.register_plugin('callstack', cf)
self.state.history.recent_stack_actions.append(CallStackAction(
hash(c... | [
"def",
"push",
"(",
"self",
",",
"cf",
")",
":",
"cf",
".",
"next",
"=",
"self",
"if",
"self",
".",
"state",
"is",
"not",
"None",
":",
"self",
".",
"state",
".",
"register_plugin",
"(",
"'callstack'",
",",
"cf",
")",
"self",
".",
"state",
".",
"h... | Push the frame cf onto the stack. Return the new stack. | [
"Push",
"the",
"frame",
"cf",
"onto",
"the",
"stack",
".",
"Return",
"the",
"new",
"stack",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/callstack.py#L232-L243 | train |
angr/angr | angr/state_plugins/callstack.py | CallStack.pop | def pop(self):
"""
Pop the top frame from the stack. Return the new stack.
"""
if self.next is None:
raise SimEmptyCallStackError("Cannot pop a frame from an empty call stack.")
new_list = self.next.copy({})
if self.state is not None:
self.state.r... | python | def pop(self):
"""
Pop the top frame from the stack. Return the new stack.
"""
if self.next is None:
raise SimEmptyCallStackError("Cannot pop a frame from an empty call stack.")
new_list = self.next.copy({})
if self.state is not None:
self.state.r... | [
"def",
"pop",
"(",
"self",
")",
":",
"if",
"self",
".",
"next",
"is",
"None",
":",
"raise",
"SimEmptyCallStackError",
"(",
"\"Cannot pop a frame from an empty call stack.\"",
")",
"new_list",
"=",
"self",
".",
"next",
".",
"copy",
"(",
"{",
"}",
")",
"if",
... | Pop the top frame from the stack. Return the new stack. | [
"Pop",
"the",
"top",
"frame",
"from",
"the",
"stack",
".",
"Return",
"the",
"new",
"stack",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/callstack.py#L245-L259 | train |
angr/angr | angr/state_plugins/callstack.py | CallStack.call | def call(self, callsite_addr, addr, retn_target=None, stack_pointer=None):
"""
Push a stack frame into the call stack. This method is called when calling a function in CFG recovery.
:param int callsite_addr: Address of the call site
:param int addr: Address of the call target
:p... | python | def call(self, callsite_addr, addr, retn_target=None, stack_pointer=None):
"""
Push a stack frame into the call stack. This method is called when calling a function in CFG recovery.
:param int callsite_addr: Address of the call site
:param int addr: Address of the call target
:p... | [
"def",
"call",
"(",
"self",
",",
"callsite_addr",
",",
"addr",
",",
"retn_target",
"=",
"None",
",",
"stack_pointer",
"=",
"None",
")",
":",
"frame",
"=",
"CallStack",
"(",
"call_site_addr",
"=",
"callsite_addr",
",",
"func_addr",
"=",
"addr",
",",
"ret_ad... | Push a stack frame into the call stack. This method is called when calling a function in CFG recovery.
:param int callsite_addr: Address of the call site
:param int addr: Address of the call target
:param int or None retn_target: Address of the return target
:param int stack_pointer: Va... | [
"Push",
"a",
"stack",
"frame",
"into",
"the",
"call",
"stack",
".",
"This",
"method",
"is",
"called",
"when",
"calling",
"a",
"function",
"in",
"CFG",
"recovery",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/callstack.py#L261-L274 | train |
angr/angr | angr/state_plugins/callstack.py | CallStack.ret | def ret(self, retn_target=None):
"""
Pop one or many call frames from the stack. This method is called when returning from a function in CFG
recovery.
:param int retn_target: The target to return to.
:return: None
"""
if retn_target is None:
return s... | python | def ret(self, retn_target=None):
"""
Pop one or many call frames from the stack. This method is called when returning from a function in CFG
recovery.
:param int retn_target: The target to return to.
:return: None
"""
if retn_target is None:
return s... | [
"def",
"ret",
"(",
"self",
",",
"retn_target",
"=",
"None",
")",
":",
"if",
"retn_target",
"is",
"None",
":",
"return",
"self",
".",
"pop",
"(",
")",
"# We may want to return to several levels up there, not only a",
"# single stack frame",
"return_target_index",
"=",
... | Pop one or many call frames from the stack. This method is called when returning from a function in CFG
recovery.
:param int retn_target: The target to return to.
:return: None | [
"Pop",
"one",
"or",
"many",
"call",
"frames",
"from",
"the",
"stack",
".",
"This",
"method",
"is",
"called",
"when",
"returning",
"from",
"a",
"function",
"in",
"CFG",
"recovery",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/callstack.py#L276-L301 | train |
angr/angr | angr/state_plugins/callstack.py | CallStack.dbg_repr | def dbg_repr(self):
"""
Debugging representation of this CallStack object.
:return: Details of this CalLStack
:rtype: str
"""
stack = [ ]
for i, frame in enumerate(self):
s = "%d | %s -> %s, returning to %s" % (
i,
"No... | python | def dbg_repr(self):
"""
Debugging representation of this CallStack object.
:return: Details of this CalLStack
:rtype: str
"""
stack = [ ]
for i, frame in enumerate(self):
s = "%d | %s -> %s, returning to %s" % (
i,
"No... | [
"def",
"dbg_repr",
"(",
"self",
")",
":",
"stack",
"=",
"[",
"]",
"for",
"i",
",",
"frame",
"in",
"enumerate",
"(",
"self",
")",
":",
"s",
"=",
"\"%d | %s -> %s, returning to %s\"",
"%",
"(",
"i",
",",
"\"None\"",
"if",
"frame",
".",
"call_site_addr",
... | Debugging representation of this CallStack object.
:return: Details of this CalLStack
:rtype: str | [
"Debugging",
"representation",
"of",
"this",
"CallStack",
"object",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/callstack.py#L308-L326 | train |
angr/angr | angr/state_plugins/callstack.py | CallStack.stack_suffix | def stack_suffix(self, context_sensitivity_level):
"""
Generate the stack suffix. A stack suffix can be used as the key to a SimRun in CFG recovery.
:param int context_sensitivity_level: Level of context sensitivity.
:return: A tuple of stack suffix.
:rtype: tuple
"""
... | python | def stack_suffix(self, context_sensitivity_level):
"""
Generate the stack suffix. A stack suffix can be used as the key to a SimRun in CFG recovery.
:param int context_sensitivity_level: Level of context sensitivity.
:return: A tuple of stack suffix.
:rtype: tuple
"""
... | [
"def",
"stack_suffix",
"(",
"self",
",",
"context_sensitivity_level",
")",
":",
"ret",
"=",
"(",
")",
"for",
"frame",
"in",
"self",
":",
"if",
"len",
"(",
"ret",
")",
">=",
"context_sensitivity_level",
"*",
"2",
":",
"break",
"ret",
"=",
"(",
"frame",
... | Generate the stack suffix. A stack suffix can be used as the key to a SimRun in CFG recovery.
:param int context_sensitivity_level: Level of context sensitivity.
:return: A tuple of stack suffix.
:rtype: tuple | [
"Generate",
"the",
"stack",
"suffix",
".",
"A",
"stack",
"suffix",
"can",
"be",
"used",
"as",
"the",
"key",
"to",
"a",
"SimRun",
"in",
"CFG",
"recovery",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/callstack.py#L328-L347 | train |
angr/angr | angr/state_plugins/callstack.py | CallStack._find_return_target | def _find_return_target(self, target):
"""
Check if the return target exists in the stack, and return the index if exists. We always search from the most
recent call stack frame since the most recent frame has a higher chance to be hit in normal CFG recovery.
:param int target: Target o... | python | def _find_return_target(self, target):
"""
Check if the return target exists in the stack, and return the index if exists. We always search from the most
recent call stack frame since the most recent frame has a higher chance to be hit in normal CFG recovery.
:param int target: Target o... | [
"def",
"_find_return_target",
"(",
"self",
",",
"target",
")",
":",
"for",
"i",
",",
"frame",
"in",
"enumerate",
"(",
"self",
")",
":",
"if",
"frame",
".",
"ret_addr",
"==",
"target",
":",
"return",
"i",
"return",
"None"
] | Check if the return target exists in the stack, and return the index if exists. We always search from the most
recent call stack frame since the most recent frame has a higher chance to be hit in normal CFG recovery.
:param int target: Target of the return.
:return: The index of the object
... | [
"Check",
"if",
"the",
"return",
"target",
"exists",
"in",
"the",
"stack",
"and",
"return",
"the",
"index",
"if",
"exists",
".",
"We",
"always",
"search",
"from",
"the",
"most",
"recent",
"call",
"stack",
"frame",
"since",
"the",
"most",
"recent",
"frame",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/callstack.py#L353-L366 | train |
shidenggui/easyquotation | easyquotation/helpers.py | update_stock_codes | def update_stock_codes():
"""获取所有股票 ID 到 all_stock_code 目录下"""
all_stock_codes_url = "http://www.shdjt.com/js/lib/astock.js"
grep_stock_codes = re.compile(r"~(\d+)`")
response = requests.get(all_stock_codes_url)
all_stock_codes = grep_stock_codes.findall(response.text)
with open(stock_code_path(... | python | def update_stock_codes():
"""获取所有股票 ID 到 all_stock_code 目录下"""
all_stock_codes_url = "http://www.shdjt.com/js/lib/astock.js"
grep_stock_codes = re.compile(r"~(\d+)`")
response = requests.get(all_stock_codes_url)
all_stock_codes = grep_stock_codes.findall(response.text)
with open(stock_code_path(... | [
"def",
"update_stock_codes",
"(",
")",
":",
"all_stock_codes_url",
"=",
"\"http://www.shdjt.com/js/lib/astock.js\"",
"grep_stock_codes",
"=",
"re",
".",
"compile",
"(",
"r\"~(\\d+)`\"",
")",
"response",
"=",
"requests",
".",
"get",
"(",
"all_stock_codes_url",
")",
"al... | 获取所有股票 ID 到 all_stock_code 目录下 | [
"获取所有股票",
"ID",
"到",
"all_stock_code",
"目录下"
] | a75820db4f05f5386e1c1024d05b0bfc1de6cbda | https://github.com/shidenggui/easyquotation/blob/a75820db4f05f5386e1c1024d05b0bfc1de6cbda/easyquotation/helpers.py#L11-L18 | train |
shidenggui/easyquotation | easyquotation/helpers.py | get_stock_codes | def get_stock_codes(realtime=False):
"""获取所有股票 ID 到 all_stock_code 目录下"""
if realtime:
all_stock_codes_url = "http://www.shdjt.com/js/lib/astock.js"
grep_stock_codes = re.compile(r"~(\d+)`")
response = requests.get(all_stock_codes_url)
stock_codes = grep_stock_codes.findall(respo... | python | def get_stock_codes(realtime=False):
"""获取所有股票 ID 到 all_stock_code 目录下"""
if realtime:
all_stock_codes_url = "http://www.shdjt.com/js/lib/astock.js"
grep_stock_codes = re.compile(r"~(\d+)`")
response = requests.get(all_stock_codes_url)
stock_codes = grep_stock_codes.findall(respo... | [
"def",
"get_stock_codes",
"(",
"realtime",
"=",
"False",
")",
":",
"if",
"realtime",
":",
"all_stock_codes_url",
"=",
"\"http://www.shdjt.com/js/lib/astock.js\"",
"grep_stock_codes",
"=",
"re",
".",
"compile",
"(",
"r\"~(\\d+)`\"",
")",
"response",
"=",
"requests",
... | 获取所有股票 ID 到 all_stock_code 目录下 | [
"获取所有股票",
"ID",
"到",
"all_stock_code",
"目录下"
] | a75820db4f05f5386e1c1024d05b0bfc1de6cbda | https://github.com/shidenggui/easyquotation/blob/a75820db4f05f5386e1c1024d05b0bfc1de6cbda/easyquotation/helpers.py#L21-L33 | train |
shidenggui/easyquotation | easyquotation/basequotation.py | BaseQuotation.real | def real(self, stock_codes, prefix=False):
"""return specific stocks real quotation
:param stock_codes: stock code or list of stock code,
when prefix is True, stock code must start with sh/sz
:param prefix: if prefix i True, stock_codes must contain sh/sz market
flag.... | python | def real(self, stock_codes, prefix=False):
"""return specific stocks real quotation
:param stock_codes: stock code or list of stock code,
when prefix is True, stock code must start with sh/sz
:param prefix: if prefix i True, stock_codes must contain sh/sz market
flag.... | [
"def",
"real",
"(",
"self",
",",
"stock_codes",
",",
"prefix",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"stock_codes",
",",
"list",
")",
":",
"stock_codes",
"=",
"[",
"stock_codes",
"]",
"stock_list",
"=",
"self",
".",
"gen_stock_list",
"(... | return specific stocks real quotation
:param stock_codes: stock code or list of stock code,
when prefix is True, stock code must start with sh/sz
:param prefix: if prefix i True, stock_codes must contain sh/sz market
flag. If prefix is False, index quotation can't return
... | [
"return",
"specific",
"stocks",
"real",
"quotation",
":",
"param",
"stock_codes",
":",
"stock",
"code",
"or",
"list",
"of",
"stock",
"code",
"when",
"prefix",
"is",
"True",
"stock",
"code",
"must",
"start",
"with",
"sh",
"/",
"sz",
":",
"param",
"prefix",
... | a75820db4f05f5386e1c1024d05b0bfc1de6cbda | https://github.com/shidenggui/easyquotation/blob/a75820db4f05f5386e1c1024d05b0bfc1de6cbda/easyquotation/basequotation.py#L73-L87 | train |
shidenggui/easyquotation | easyquotation/basequotation.py | BaseQuotation.market_snapshot | def market_snapshot(self, prefix=False):
"""return all market quotation snapshot
:param prefix: if prefix is True, return quotation dict's stock_code
key start with sh/sz market flag
"""
return self.get_stock_data(self.stock_list, prefix=prefix) | python | def market_snapshot(self, prefix=False):
"""return all market quotation snapshot
:param prefix: if prefix is True, return quotation dict's stock_code
key start with sh/sz market flag
"""
return self.get_stock_data(self.stock_list, prefix=prefix) | [
"def",
"market_snapshot",
"(",
"self",
",",
"prefix",
"=",
"False",
")",
":",
"return",
"self",
".",
"get_stock_data",
"(",
"self",
".",
"stock_list",
",",
"prefix",
"=",
"prefix",
")"
] | return all market quotation snapshot
:param prefix: if prefix is True, return quotation dict's stock_code
key start with sh/sz market flag | [
"return",
"all",
"market",
"quotation",
"snapshot",
":",
"param",
"prefix",
":",
"if",
"prefix",
"is",
"True",
"return",
"quotation",
"dict",
"s",
"stock_code",
"key",
"start",
"with",
"sh",
"/",
"sz",
"market",
"flag"
] | a75820db4f05f5386e1c1024d05b0bfc1de6cbda | https://github.com/shidenggui/easyquotation/blob/a75820db4f05f5386e1c1024d05b0bfc1de6cbda/easyquotation/basequotation.py#L89-L94 | train |
shidenggui/easyquotation | easyquotation/basequotation.py | BaseQuotation.get_stock_data | def get_stock_data(self, stock_list, **kwargs):
"""获取并格式化股票信息"""
res = self._fetch_stock_data(stock_list)
return self.format_response_data(res, **kwargs) | python | def get_stock_data(self, stock_list, **kwargs):
"""获取并格式化股票信息"""
res = self._fetch_stock_data(stock_list)
return self.format_response_data(res, **kwargs) | [
"def",
"get_stock_data",
"(",
"self",
",",
"stock_list",
",",
"*",
"*",
"kwargs",
")",
":",
"res",
"=",
"self",
".",
"_fetch_stock_data",
"(",
"stock_list",
")",
"return",
"self",
".",
"format_response_data",
"(",
"res",
",",
"*",
"*",
"kwargs",
")"
] | 获取并格式化股票信息 | [
"获取并格式化股票信息"
] | a75820db4f05f5386e1c1024d05b0bfc1de6cbda | https://github.com/shidenggui/easyquotation/blob/a75820db4f05f5386e1c1024d05b0bfc1de6cbda/easyquotation/basequotation.py#L109-L112 | train |
shidenggui/easyquotation | easyquotation/basequotation.py | BaseQuotation._fetch_stock_data | def _fetch_stock_data(self, stock_list):
"""获取股票信息"""
pool = multiprocessing.pool.ThreadPool(len(stock_list))
try:
res = pool.map(self.get_stocks_by_range, stock_list)
finally:
pool.close()
return [d for d in res if d is not None] | python | def _fetch_stock_data(self, stock_list):
"""获取股票信息"""
pool = multiprocessing.pool.ThreadPool(len(stock_list))
try:
res = pool.map(self.get_stocks_by_range, stock_list)
finally:
pool.close()
return [d for d in res if d is not None] | [
"def",
"_fetch_stock_data",
"(",
"self",
",",
"stock_list",
")",
":",
"pool",
"=",
"multiprocessing",
".",
"pool",
".",
"ThreadPool",
"(",
"len",
"(",
"stock_list",
")",
")",
"try",
":",
"res",
"=",
"pool",
".",
"map",
"(",
"self",
".",
"get_stocks_by_ra... | 获取股票信息 | [
"获取股票信息"
] | a75820db4f05f5386e1c1024d05b0bfc1de6cbda | https://github.com/shidenggui/easyquotation/blob/a75820db4f05f5386e1c1024d05b0bfc1de6cbda/easyquotation/basequotation.py#L114-L121 | train |
shidenggui/easyquotation | easyquotation/timekline.py | TimeKline._fetch_stock_data | def _fetch_stock_data(self, stock_list):
"""因为 timekline 的返回没有带对应的股票代码,所以要手动带上"""
res = super()._fetch_stock_data(stock_list)
with_stock = []
for stock, resp in zip(stock_list, res):
if resp is not None:
with_stock.append((stock, resp))
return with_st... | python | def _fetch_stock_data(self, stock_list):
"""因为 timekline 的返回没有带对应的股票代码,所以要手动带上"""
res = super()._fetch_stock_data(stock_list)
with_stock = []
for stock, resp in zip(stock_list, res):
if resp is not None:
with_stock.append((stock, resp))
return with_st... | [
"def",
"_fetch_stock_data",
"(",
"self",
",",
"stock_list",
")",
":",
"res",
"=",
"super",
"(",
")",
".",
"_fetch_stock_data",
"(",
"stock_list",
")",
"with_stock",
"=",
"[",
"]",
"for",
"stock",
",",
"resp",
"in",
"zip",
"(",
"stock_list",
",",
"res",
... | 因为 timekline 的返回没有带对应的股票代码,所以要手动带上 | [
"因为",
"timekline",
"的返回没有带对应的股票代码,所以要手动带上"
] | a75820db4f05f5386e1c1024d05b0bfc1de6cbda | https://github.com/shidenggui/easyquotation/blob/a75820db4f05f5386e1c1024d05b0bfc1de6cbda/easyquotation/timekline.py#L29-L37 | train |
shidenggui/easyquotation | easyquotation/jsl.py | Jsl.formatfundajson | def formatfundajson(fundajson):
"""格式化集思录返回的json数据,以字典形式保存"""
result = {}
for row in fundajson["rows"]:
funda_id = row["id"]
cell = row["cell"]
result[funda_id] = cell
return result | python | def formatfundajson(fundajson):
"""格式化集思录返回的json数据,以字典形式保存"""
result = {}
for row in fundajson["rows"]:
funda_id = row["id"]
cell = row["cell"]
result[funda_id] = cell
return result | [
"def",
"formatfundajson",
"(",
"fundajson",
")",
":",
"result",
"=",
"{",
"}",
"for",
"row",
"in",
"fundajson",
"[",
"\"rows\"",
"]",
":",
"funda_id",
"=",
"row",
"[",
"\"id\"",
"]",
"cell",
"=",
"row",
"[",
"\"cell\"",
"]",
"result",
"[",
"funda_id",
... | 格式化集思录返回的json数据,以字典形式保存 | [
"格式化集思录返回的json数据",
"以字典形式保存"
] | a75820db4f05f5386e1c1024d05b0bfc1de6cbda | https://github.com/shidenggui/easyquotation/blob/a75820db4f05f5386e1c1024d05b0bfc1de6cbda/easyquotation/jsl.py#L101-L108 | train |
shidenggui/easyquotation | easyquotation/jsl.py | Jsl.formatfundbjson | def formatfundbjson(fundbjson):
"""格式化集思录返回的json数据,以字典形式保存"""
result = {}
for row in fundbjson["rows"]:
cell = row["cell"]
fundb_id = cell["fundb_id"]
result[fundb_id] = cell
return result | python | def formatfundbjson(fundbjson):
"""格式化集思录返回的json数据,以字典形式保存"""
result = {}
for row in fundbjson["rows"]:
cell = row["cell"]
fundb_id = cell["fundb_id"]
result[fundb_id] = cell
return result | [
"def",
"formatfundbjson",
"(",
"fundbjson",
")",
":",
"result",
"=",
"{",
"}",
"for",
"row",
"in",
"fundbjson",
"[",
"\"rows\"",
"]",
":",
"cell",
"=",
"row",
"[",
"\"cell\"",
"]",
"fundb_id",
"=",
"cell",
"[",
"\"fundb_id\"",
"]",
"result",
"[",
"fund... | 格式化集思录返回的json数据,以字典形式保存 | [
"格式化集思录返回的json数据",
"以字典形式保存"
] | a75820db4f05f5386e1c1024d05b0bfc1de6cbda | https://github.com/shidenggui/easyquotation/blob/a75820db4f05f5386e1c1024d05b0bfc1de6cbda/easyquotation/jsl.py#L111-L118 | train |
shidenggui/easyquotation | easyquotation/jsl.py | Jsl.formatetfindexjson | def formatetfindexjson(fundbjson):
"""格式化集思录返回 指数ETF 的json数据,以字典形式保存"""
result = {}
for row in fundbjson["rows"]:
cell = row["cell"]
fundb_id = cell["fund_id"]
result[fundb_id] = cell
return result | python | def formatetfindexjson(fundbjson):
"""格式化集思录返回 指数ETF 的json数据,以字典形式保存"""
result = {}
for row in fundbjson["rows"]:
cell = row["cell"]
fundb_id = cell["fund_id"]
result[fundb_id] = cell
return result | [
"def",
"formatetfindexjson",
"(",
"fundbjson",
")",
":",
"result",
"=",
"{",
"}",
"for",
"row",
"in",
"fundbjson",
"[",
"\"rows\"",
"]",
":",
"cell",
"=",
"row",
"[",
"\"cell\"",
"]",
"fundb_id",
"=",
"cell",
"[",
"\"fund_id\"",
"]",
"result",
"[",
"fu... | 格式化集思录返回 指数ETF 的json数据,以字典形式保存 | [
"格式化集思录返回",
"指数ETF",
"的json数据",
"以字典形式保存"
] | a75820db4f05f5386e1c1024d05b0bfc1de6cbda | https://github.com/shidenggui/easyquotation/blob/a75820db4f05f5386e1c1024d05b0bfc1de6cbda/easyquotation/jsl.py#L121-L128 | train |
shidenggui/easyquotation | easyquotation/jsl.py | Jsl.funda | def funda(
self,
fields=None,
min_volume=0,
min_discount=0,
ignore_nodown=False,
forever=False,
):
"""以字典形式返回分级A数据
:param fields:利率范围,形如['+3.0%', '6.0%']
:param min_volume:最小交易量,单位万元
:param min_discount:最小折价率, 单位%
:param ignore_... | python | def funda(
self,
fields=None,
min_volume=0,
min_discount=0,
ignore_nodown=False,
forever=False,
):
"""以字典形式返回分级A数据
:param fields:利率范围,形如['+3.0%', '6.0%']
:param min_volume:最小交易量,单位万元
:param min_discount:最小折价率, 单位%
:param ignore_... | [
"def",
"funda",
"(",
"self",
",",
"fields",
"=",
"None",
",",
"min_volume",
"=",
"0",
",",
"min_discount",
"=",
"0",
",",
"ignore_nodown",
"=",
"False",
",",
"forever",
"=",
"False",
",",
")",
":",
"if",
"fields",
"is",
"None",
":",
"fields",
"=",
... | 以字典形式返回分级A数据
:param fields:利率范围,形如['+3.0%', '6.0%']
:param min_volume:最小交易量,单位万元
:param min_discount:最小折价率, 单位%
:param ignore_nodown:是否忽略无下折品种,默认 False
:param forever: 是否选择永续品种,默认 False | [
"以字典形式返回分级A数据",
":",
"param",
"fields",
":",
"利率范围,形如",
"[",
"+",
"3",
".",
"0%",
"6",
".",
"0%",
"]",
":",
"param",
"min_volume",
":",
"最小交易量,单位万元",
":",
"param",
"min_discount",
":",
"最小折价率",
"单位%",
":",
"param",
"ignore_nodown",
":",
"是否忽略无下折品种",
"默认"... | a75820db4f05f5386e1c1024d05b0bfc1de6cbda | https://github.com/shidenggui/easyquotation/blob/a75820db4f05f5386e1c1024d05b0bfc1de6cbda/easyquotation/jsl.py#L148-L207 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.