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/state_plugins/heap/heap_freelist.py
Chunk.get_size
def get_size(self): """ Returns the actual size of a chunk (as opposed to the entire size field, which may include some flags). """ raise NotImplementedError("%s not implemented for %s" % (self.get_size.__func__.__name__, s...
python
def get_size(self): """ Returns the actual size of a chunk (as opposed to the entire size field, which may include some flags). """ raise NotImplementedError("%s not implemented for %s" % (self.get_size.__func__.__name__, s...
[ "def", "get_size", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "get_size", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__name__", ")", ")" ]
Returns the actual size of a chunk (as opposed to the entire size field, which may include some flags).
[ "Returns", "the", "actual", "size", "of", "a", "chunk", "(", "as", "opposed", "to", "the", "entire", "size", "field", "which", "may", "include", "some", "flags", ")", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_freelist.py#L31-L36
train
angr/angr
angr/state_plugins/heap/heap_freelist.py
Chunk.set_size
def set_size(self, size): """ Sets the size of the chunk, preserving any flags. """ raise NotImplementedError("%s not implemented for %s" % (self.set_size.__func__.__name__, self.__class__.__name__))
python
def set_size(self, size): """ Sets the size of the chunk, preserving any flags. """ raise NotImplementedError("%s not implemented for %s" % (self.set_size.__func__.__name__, self.__class__.__name__))
[ "def", "set_size", "(", "self", ",", "size", ")", ":", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "set_size", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__name__", ")", ")" ]
Sets the size of the chunk, preserving any flags.
[ "Sets", "the", "size", "of", "the", "chunk", "preserving", "any", "flags", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_freelist.py#L38-L43
train
angr/angr
angr/state_plugins/heap/heap_freelist.py
Chunk.data_ptr
def data_ptr(self): """ Returns the address of the payload of the chunk. """ raise NotImplementedError("%s not implemented for %s" % (self.data_ptr.__func__.__name__, self.__class__.__name__))
python
def data_ptr(self): """ Returns the address of the payload of the chunk. """ raise NotImplementedError("%s not implemented for %s" % (self.data_ptr.__func__.__name__, self.__class__.__name__))
[ "def", "data_ptr", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "data_ptr", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__name__", ")", ")" ]
Returns the address of the payload of the chunk.
[ "Returns", "the", "address", "of", "the", "payload", "of", "the", "chunk", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_freelist.py#L45-L50
train
angr/angr
angr/state_plugins/heap/heap_freelist.py
Chunk.is_free
def is_free(self): """ Returns a concrete determination as to whether the chunk is free. """ raise NotImplementedError("%s not implemented for %s" % (self.is_free.__func__.__name__, self.__class__.__name__))
python
def is_free(self): """ Returns a concrete determination as to whether the chunk is free. """ raise NotImplementedError("%s not implemented for %s" % (self.is_free.__func__.__name__, self.__class__.__name__))
[ "def", "is_free", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "is_free", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__name__", ")", ")" ]
Returns a concrete determination as to whether the chunk is free.
[ "Returns", "a", "concrete", "determination", "as", "to", "whether", "the", "chunk", "is", "free", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_freelist.py#L52-L57
train
angr/angr
angr/state_plugins/heap/heap_freelist.py
Chunk.next_chunk
def next_chunk(self): """ Returns the chunk immediately following (and adjacent to) this one. """ raise NotImplementedError("%s not implemented for %s" % (self.next_chunk.__func__.__name__, self.__class__.__name__))
python
def next_chunk(self): """ Returns the chunk immediately following (and adjacent to) this one. """ raise NotImplementedError("%s not implemented for %s" % (self.next_chunk.__func__.__name__, self.__class__.__name__))
[ "def", "next_chunk", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "next_chunk", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__name__", ")", ")" ]
Returns the chunk immediately following (and adjacent to) this one.
[ "Returns", "the", "chunk", "immediately", "following", "(", "and", "adjacent", "to", ")", "this", "one", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_freelist.py#L59-L64
train
angr/angr
angr/state_plugins/heap/heap_freelist.py
Chunk.prev_chunk
def prev_chunk(self): """ Returns the chunk immediately prior (and adjacent) to this one. """ raise NotImplementedError("%s not implemented for %s" % (self.prev_chunk.__func__.__name__, self.__class__.__name__))
python
def prev_chunk(self): """ Returns the chunk immediately prior (and adjacent) to this one. """ raise NotImplementedError("%s not implemented for %s" % (self.prev_chunk.__func__.__name__, self.__class__.__name__))
[ "def", "prev_chunk", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "prev_chunk", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__name__", ")", ")" ]
Returns the chunk immediately prior (and adjacent) to this one.
[ "Returns", "the", "chunk", "immediately", "prior", "(", "and", "adjacent", ")", "to", "this", "one", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_freelist.py#L66-L71
train
angr/angr
angr/state_plugins/heap/heap_freelist.py
Chunk.fwd_chunk
def fwd_chunk(self): """ Returns the chunk following this chunk in the list of free chunks. """ raise NotImplementedError("%s not implemented for %s" % (self.fwd_chunk.__func__.__name__, self.__class__.__name__))
python
def fwd_chunk(self): """ Returns the chunk following this chunk in the list of free chunks. """ raise NotImplementedError("%s not implemented for %s" % (self.fwd_chunk.__func__.__name__, self.__class__.__name__))
[ "def", "fwd_chunk", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "fwd_chunk", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__name__", ")", ")" ]
Returns the chunk following this chunk in the list of free chunks.
[ "Returns", "the", "chunk", "following", "this", "chunk", "in", "the", "list", "of", "free", "chunks", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_freelist.py#L73-L78
train
angr/angr
angr/state_plugins/heap/heap_freelist.py
Chunk.set_fwd_chunk
def set_fwd_chunk(self, fwd): """ Sets the chunk following this chunk in the list of free chunks. :param fwd: the chunk to follow this chunk in the list of free chunks """ raise NotImplementedError("%s not implemented for %s" % (self.set_fwd_chunk.__func__.__name__, ...
python
def set_fwd_chunk(self, fwd): """ Sets the chunk following this chunk in the list of free chunks. :param fwd: the chunk to follow this chunk in the list of free chunks """ raise NotImplementedError("%s not implemented for %s" % (self.set_fwd_chunk.__func__.__name__, ...
[ "def", "set_fwd_chunk", "(", "self", ",", "fwd", ")", ":", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "set_fwd_chunk", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__name__", ")", ")" ...
Sets the chunk following this chunk in the list of free chunks. :param fwd: the chunk to follow this chunk in the list of free chunks
[ "Sets", "the", "chunk", "following", "this", "chunk", "in", "the", "list", "of", "free", "chunks", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_freelist.py#L80-L87
train
angr/angr
angr/state_plugins/heap/heap_freelist.py
Chunk.bck_chunk
def bck_chunk(self): """ Returns the chunk backward from this chunk in the list of free chunks. """ raise NotImplementedError("%s not implemented for %s" % (self.bck_chunk.__func__.__name__, self.__class__.__name__))
python
def bck_chunk(self): """ Returns the chunk backward from this chunk in the list of free chunks. """ raise NotImplementedError("%s not implemented for %s" % (self.bck_chunk.__func__.__name__, self.__class__.__name__))
[ "def", "bck_chunk", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "bck_chunk", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__name__", ")", ")" ]
Returns the chunk backward from this chunk in the list of free chunks.
[ "Returns", "the", "chunk", "backward", "from", "this", "chunk", "in", "the", "list", "of", "free", "chunks", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_freelist.py#L89-L94
train
angr/angr
angr/state_plugins/heap/heap_freelist.py
Chunk.set_bck_chunk
def set_bck_chunk(self, bck): """ Sets the chunk backward from this chunk in the list of free chunks. :param bck: the chunk to precede this chunk in the list of free chunks """ raise NotImplementedError("%s not implemented for %s" % (self.set_bck_chunk.__func__.__name__, ...
python
def set_bck_chunk(self, bck): """ Sets the chunk backward from this chunk in the list of free chunks. :param bck: the chunk to precede this chunk in the list of free chunks """ raise NotImplementedError("%s not implemented for %s" % (self.set_bck_chunk.__func__.__name__, ...
[ "def", "set_bck_chunk", "(", "self", ",", "bck", ")", ":", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "set_bck_chunk", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__name__", ")", ")" ...
Sets the chunk backward from this chunk in the list of free chunks. :param bck: the chunk to precede this chunk in the list of free chunks
[ "Sets", "the", "chunk", "backward", "from", "this", "chunk", "in", "the", "list", "of", "free", "chunks", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_freelist.py#L96-L103
train
angr/angr
angr/state_plugins/heap/heap_freelist.py
SimHeapFreelist.chunks
def chunks(self): """ Returns an iterator over all the chunks in the heap. """ raise NotImplementedError("%s not implemented for %s" % (self.chunks.__func__.__name__, self.__class__.__name__))
python
def chunks(self): """ Returns an iterator over all the chunks in the heap. """ raise NotImplementedError("%s not implemented for %s" % (self.chunks.__func__.__name__, self.__class__.__name__))
[ "def", "chunks", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "chunks", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__name__", ")", ")" ]
Returns an iterator over all the chunks in the heap.
[ "Returns", "an", "iterator", "over", "all", "the", "chunks", "in", "the", "heap", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_freelist.py#L159-L164
train
angr/angr
angr/state_plugins/heap/heap_freelist.py
SimHeapFreelist.allocated_chunks
def allocated_chunks(self): """ Returns an iterator over all the allocated chunks in the heap. """ raise NotImplementedError("%s not implemented for %s" % (self.allocated_chunks.__func__.__name__, self.__class__.__name__))
python
def allocated_chunks(self): """ Returns an iterator over all the allocated chunks in the heap. """ raise NotImplementedError("%s not implemented for %s" % (self.allocated_chunks.__func__.__name__, self.__class__.__name__))
[ "def", "allocated_chunks", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "allocated_chunks", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__name__", ")", ")" ]
Returns an iterator over all the allocated chunks in the heap.
[ "Returns", "an", "iterator", "over", "all", "the", "allocated", "chunks", "in", "the", "heap", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_freelist.py#L166-L171
train
angr/angr
angr/state_plugins/heap/heap_freelist.py
SimHeapFreelist.free_chunks
def free_chunks(self): """ Returns an iterator over all the free chunks in the heap. """ raise NotImplementedError("%s not implemented for %s" % (self.free_chunks.__func__.__name__, self.__class__.__name__))
python
def free_chunks(self): """ Returns an iterator over all the free chunks in the heap. """ raise NotImplementedError("%s not implemented for %s" % (self.free_chunks.__func__.__name__, self.__class__.__name__))
[ "def", "free_chunks", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "free_chunks", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__name__", ")", ")" ]
Returns an iterator over all the free chunks in the heap.
[ "Returns", "an", "iterator", "over", "all", "the", "free", "chunks", "in", "the", "heap", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_freelist.py#L173-L178
train
angr/angr
angr/state_plugins/heap/heap_freelist.py
SimHeapFreelist.chunk_from_mem
def chunk_from_mem(self, ptr): """ Given a pointer to a user payload, return the chunk associated with that payload. :param ptr: a pointer to the base of a user payload in the heap :returns: the associated heap chunk """ raise NotImplementedError("%s not implemented for ...
python
def chunk_from_mem(self, ptr): """ Given a pointer to a user payload, return the chunk associated with that payload. :param ptr: a pointer to the base of a user payload in the heap :returns: the associated heap chunk """ raise NotImplementedError("%s not implemented for ...
[ "def", "chunk_from_mem", "(", "self", ",", "ptr", ")", ":", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "chunk_from_mem", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__name__", ")", ")...
Given a pointer to a user payload, return the chunk associated with that payload. :param ptr: a pointer to the base of a user payload in the heap :returns: the associated heap chunk
[ "Given", "a", "pointer", "to", "a", "user", "payload", "return", "the", "chunk", "associated", "with", "that", "payload", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_freelist.py#L180-L188
train
angr/angr
angr/engines/hub.py
EngineHub.successors
def successors(self, state, addr=None, jumpkind=None, default_engine=False, procedure_engine=False, engines=None, **kwargs): """ Perform execution using any applicable engine. Enumerate the current engines and use the first one that works. Engines are enumerated in order, spec...
python
def successors(self, state, addr=None, jumpkind=None, default_engine=False, procedure_engine=False, engines=None, **kwargs): """ Perform execution using any applicable engine. Enumerate the current engines and use the first one that works. Engines are enumerated in order, spec...
[ "def", "successors", "(", "self", ",", "state", ",", "addr", "=", "None", ",", "jumpkind", "=", "None", ",", "default_engine", "=", "False", ",", "procedure_engine", "=", "False", ",", "engines", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", ...
Perform execution using any applicable engine. Enumerate the current engines and use the first one that works. Engines are enumerated in order, specified by the ``order`` attribute. :param state: The state to analyze :param addr: optional, an address to execute at i...
[ "Perform", "execution", "using", "any", "applicable", "engine", ".", "Enumerate", "the", "current", "engines", "and", "use", "the", "first", "one", "that", "works", ".", "Engines", "are", "enumerated", "in", "order", "specified", "by", "the", "order", "attribu...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/hub.py#L92-L132
train
angr/angr
angr/analyses/girlscout.py
GirlScout._get_next_code_addr
def _get_next_code_addr(self, initial_state): """ Besides calling _get_next_addr, we will check if data locates at that address seems to be code or not. If not, we'll move on to request for next valid address. """ next_addr = self._get_next_addr_to_search() if next_addr ...
python
def _get_next_code_addr(self, initial_state): """ Besides calling _get_next_addr, we will check if data locates at that address seems to be code or not. If not, we'll move on to request for next valid address. """ next_addr = self._get_next_addr_to_search() if next_addr ...
[ "def", "_get_next_code_addr", "(", "self", ",", "initial_state", ")", ":", "next_addr", "=", "self", ".", "_get_next_addr_to_search", "(", ")", "if", "next_addr", "is", "None", ":", "return", "None", "start_addr", "=", "next_addr", "sz", "=", "\"\"", "is_sz", ...
Besides calling _get_next_addr, we will check if data locates at that address seems to be code or not. If not, we'll move on to request for next valid address.
[ "Besides", "calling", "_get_next_addr", "we", "will", "check", "if", "data", "locates", "at", "that", "address", "seems", "to", "be", "code", "or", "not", ".", "If", "not", "we", "ll", "move", "on", "to", "request", "for", "next", "valid", "address", "."...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/girlscout.py#L118-L172
train
angr/angr
angr/analyses/girlscout.py
GirlScout._symbolic_reconnoiter
def _symbolic_reconnoiter(self, addr, target_addr, max_depth=10): """ When an IRSB has more than two exits (for example, a jumptable), we cannot concretize their exits in concrete mode. Hence we statically execute the function from beginning in this method, and then switch to sym...
python
def _symbolic_reconnoiter(self, addr, target_addr, max_depth=10): """ When an IRSB has more than two exits (for example, a jumptable), we cannot concretize their exits in concrete mode. Hence we statically execute the function from beginning in this method, and then switch to sym...
[ "def", "_symbolic_reconnoiter", "(", "self", ",", "addr", ",", "target_addr", ",", "max_depth", "=", "10", ")", ":", "state", "=", "self", ".", "project", ".", "factory", ".", "blank_state", "(", "addr", "=", "addr", ",", "mode", "=", "\"symbolic\"", ","...
When an IRSB has more than two exits (for example, a jumptable), we cannot concretize their exits in concrete mode. Hence we statically execute the function from beginning in this method, and then switch to symbolic mode for the final IRSB to get all possible exits of that IRSB.
[ "When", "an", "IRSB", "has", "more", "than", "two", "exits", "(", "for", "example", "a", "jumptable", ")", "we", "cannot", "concretize", "their", "exits", "in", "concrete", "mode", ".", "Hence", "we", "statically", "execute", "the", "function", "from", "be...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/girlscout.py#L174-L196
train
angr/angr
angr/analyses/girlscout.py
GirlScout._scan_function_prologues
def _scan_function_prologues(self, traced_address, function_exits, initial_state): """ Scan the entire program space for prologues, and start code scanning at those positions :param traced_address: :param function_exits: :param initial_state: :param next_addr: :re...
python
def _scan_function_prologues(self, traced_address, function_exits, initial_state): """ Scan the entire program space for prologues, and start code scanning at those positions :param traced_address: :param function_exits: :param initial_state: :param next_addr: :re...
[ "def", "_scan_function_prologues", "(", "self", ",", "traced_address", ",", "function_exits", ",", "initial_state", ")", ":", "# Precompile all regexes", "regexes", "=", "set", "(", ")", "for", "ins_regex", "in", "self", ".", "project", ".", "arch", ".", "functi...
Scan the entire program space for prologues, and start code scanning at those positions :param traced_address: :param function_exits: :param initial_state: :param next_addr: :returns:
[ "Scan", "the", "entire", "program", "space", "for", "prologues", "and", "start", "code", "scanning", "at", "those", "positions", ":", "param", "traced_address", ":", ":", "param", "function_exits", ":", ":", "param", "initial_state", ":", ":", "param", "next_a...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/girlscout.py#L434-L468
train
angr/angr
angr/analyses/girlscout.py
GirlScout._process_indirect_jumps
def _process_indirect_jumps(self): """ Execute each basic block with an indeterminiable exit target :returns: """ function_starts = set() l.info("We have %d indirect jumps", len(self._indirect_jumps)) for jumpkind, irsb_addr in self._indirect_jumps: ...
python
def _process_indirect_jumps(self): """ Execute each basic block with an indeterminiable exit target :returns: """ function_starts = set() l.info("We have %d indirect jumps", len(self._indirect_jumps)) for jumpkind, irsb_addr in self._indirect_jumps: ...
[ "def", "_process_indirect_jumps", "(", "self", ")", ":", "function_starts", "=", "set", "(", ")", "l", ".", "info", "(", "\"We have %d indirect jumps\"", ",", "len", "(", "self", ".", "_indirect_jumps", ")", ")", "for", "jumpkind", ",", "irsb_addr", "in", "s...
Execute each basic block with an indeterminiable exit target :returns:
[ "Execute", "each", "basic", "block", "with", "an", "indeterminiable", "exit", "target", ":", "returns", ":" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/girlscout.py#L470-L557
train
angr/angr
angr/analyses/girlscout.py
GirlScout._solve_forbase_address
def _solve_forbase_address(self, function_starts, functions): """ Voting for the most possible base address. :param function_starts: :param functions: :returns: """ pseudo_base_addr = self.project.loader.main_object.min_addr base_addr_ctr = { } ...
python
def _solve_forbase_address(self, function_starts, functions): """ Voting for the most possible base address. :param function_starts: :param functions: :returns: """ pseudo_base_addr = self.project.loader.main_object.min_addr base_addr_ctr = { } ...
[ "def", "_solve_forbase_address", "(", "self", ",", "function_starts", ",", "functions", ")", ":", "pseudo_base_addr", "=", "self", ".", "project", ".", "loader", ".", "main_object", ".", "min_addr", "base_addr_ctr", "=", "{", "}", "for", "s", "in", "function_s...
Voting for the most possible base address. :param function_starts: :param functions: :returns:
[ "Voting", "for", "the", "most", "possible", "base", "address", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/girlscout.py#L559-L589
train
angr/angr
angr/analyses/girlscout.py
GirlScout._determinebase_address
def _determinebase_address(self): """ The basic idea is simple: start from a specific point, try to construct functions as much as we can, and maintain a function distribution graph and a call graph simultaneously. Repeat searching until we come to the end that there is no new fu...
python
def _determinebase_address(self): """ The basic idea is simple: start from a specific point, try to construct functions as much as we can, and maintain a function distribution graph and a call graph simultaneously. Repeat searching until we come to the end that there is no new fu...
[ "def", "_determinebase_address", "(", "self", ")", ":", "traced_address", "=", "set", "(", ")", "self", ".", "functions", "=", "set", "(", ")", "self", ".", "call_map", "=", "networkx", ".", "DiGraph", "(", ")", "self", ".", "cfg", "=", "networkx", "."...
The basic idea is simple: start from a specific point, try to construct functions as much as we can, and maintain a function distribution graph and a call graph simultaneously. Repeat searching until we come to the end that there is no new function to be found. A function should start wi...
[ "The", "basic", "idea", "is", "simple", ":", "start", "from", "a", "specific", "point", "try", "to", "construct", "functions", "as", "much", "as", "we", "can", "and", "maintain", "a", "function", "distribution", "graph", "and", "a", "call", "graph", "simul...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/girlscout.py#L600-L691
train
angr/angr
angr/analyses/girlscout.py
GirlScout._full_code_scan
def _full_code_scan(self): """ Perform a full code scan on the target binary. """ # We gotta time this function start_time = datetime.now() traced_address = set() self.functions = set() self.call_map = networkx.DiGraph() self.cfg = networkx.DiGra...
python
def _full_code_scan(self): """ Perform a full code scan on the target binary. """ # We gotta time this function start_time = datetime.now() traced_address = set() self.functions = set() self.call_map = networkx.DiGraph() self.cfg = networkx.DiGra...
[ "def", "_full_code_scan", "(", "self", ")", ":", "# We gotta time this function", "start_time", "=", "datetime", ".", "now", "(", ")", "traced_address", "=", "set", "(", ")", "self", ".", "functions", "=", "set", "(", ")", "self", ".", "call_map", "=", "ne...
Perform a full code scan on the target binary.
[ "Perform", "a", "full", "code", "scan", "on", "the", "target", "binary", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/girlscout.py#L693-L746
train
angr/angr
angr/analyses/girlscout.py
GirlScout.genenare_callmap_sif
def genenare_callmap_sif(self, filepath): """ Generate a sif file from the call map """ graph = self.call_map if graph is None: raise AngrGirlScoutError('Please generate the call graph first.') f = open(filepath, "wb") for src, dst in graph.edges():...
python
def genenare_callmap_sif(self, filepath): """ Generate a sif file from the call map """ graph = self.call_map if graph is None: raise AngrGirlScoutError('Please generate the call graph first.') f = open(filepath, "wb") for src, dst in graph.edges():...
[ "def", "genenare_callmap_sif", "(", "self", ",", "filepath", ")", ":", "graph", "=", "self", ".", "call_map", "if", "graph", "is", "None", ":", "raise", "AngrGirlScoutError", "(", "'Please generate the call graph first.'", ")", "f", "=", "open", "(", "filepath",...
Generate a sif file from the call map
[ "Generate", "a", "sif", "file", "from", "the", "call", "map" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/girlscout.py#L771-L785
train
angr/angr
angr/analyses/girlscout.py
GirlScout.generate_code_cover
def generate_code_cover(self): """ Generate a list of all recovered basic blocks. """ lst = [ ] for irsb_addr in self.cfg.nodes(): if irsb_addr not in self._block_size: continue irsb_size = self._block_size[irsb_addr] lst.appen...
python
def generate_code_cover(self): """ Generate a list of all recovered basic blocks. """ lst = [ ] for irsb_addr in self.cfg.nodes(): if irsb_addr not in self._block_size: continue irsb_size = self._block_size[irsb_addr] lst.appen...
[ "def", "generate_code_cover", "(", "self", ")", ":", "lst", "=", "[", "]", "for", "irsb_addr", "in", "self", ".", "cfg", ".", "nodes", "(", ")", ":", "if", "irsb_addr", "not", "in", "self", ".", "_block_size", ":", "continue", "irsb_size", "=", "self",...
Generate a list of all recovered basic blocks.
[ "Generate", "a", "list", "of", "all", "recovered", "basic", "blocks", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/girlscout.py#L787-L801
train
angr/angr
angr/state_plugins/solver.py
SimSolver.reload_solver
def reload_solver(self, constraints=None): """ Reloads the solver. Useful when changing solver options. :param list constraints: A new list of constraints to use in the reloaded solver instead of the current one """ if constraints is None: constraints = self._sol...
python
def reload_solver(self, constraints=None): """ Reloads the solver. Useful when changing solver options. :param list constraints: A new list of constraints to use in the reloaded solver instead of the current one """ if constraints is None: constraints = self._sol...
[ "def", "reload_solver", "(", "self", ",", "constraints", "=", "None", ")", ":", "if", "constraints", "is", "None", ":", "constraints", "=", "self", ".", "_solver", ".", "constraints", "self", ".", "_stored_solver", "=", "None", "self", ".", "_solver", ".",...
Reloads the solver. Useful when changing solver options. :param list constraints: A new list of constraints to use in the reloaded solver instead of the current one
[ "Reloads", "the", "solver", ".", "Useful", "when", "changing", "solver", "options", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L189-L199
train
angr/angr
angr/state_plugins/solver.py
SimSolver.get_variables
def get_variables(self, *keys): """ Iterate over all variables for which their tracking key is a prefix of the values provided. Elements are a tuple, the first element is the full tracking key, the second is the symbol. >>> list(s.solver.get_variables('mem')) [(('mem', 0x1000),...
python
def get_variables(self, *keys): """ Iterate over all variables for which their tracking key is a prefix of the values provided. Elements are a tuple, the first element is the full tracking key, the second is the symbol. >>> list(s.solver.get_variables('mem')) [(('mem', 0x1000),...
[ "def", "get_variables", "(", "self", ",", "*", "keys", ")", ":", "for", "k", ",", "v", "in", "self", ".", "eternal_tracked_variables", ".", "items", "(", ")", ":", "if", "len", "(", "k", ")", ">=", "len", "(", "keys", ")", "and", "all", "(", "x",...
Iterate over all variables for which their tracking key is a prefix of the values provided. Elements are a tuple, the first element is the full tracking key, the second is the symbol. >>> list(s.solver.get_variables('mem')) [(('mem', 0x1000), <BV64 mem_1000_4_64>), (('mem', 0x1008), <BV64 mem_...
[ "Iterate", "over", "all", "variables", "for", "which", "their", "tracking", "key", "is", "a", "prefix", "of", "the", "values", "provided", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L201-L226
train
angr/angr
angr/state_plugins/solver.py
SimSolver.register_variable
def register_variable(self, v, key, eternal=True): """ Register a value with the variable tracking system :param v: The BVS to register :param key: A tuple to register the variable under :parma eternal: Whether this is an eternal variable, default True. If False, an in...
python
def register_variable(self, v, key, eternal=True): """ Register a value with the variable tracking system :param v: The BVS to register :param key: A tuple to register the variable under :parma eternal: Whether this is an eternal variable, default True. If False, an in...
[ "def", "register_variable", "(", "self", ",", "v", ",", "key", ",", "eternal", "=", "True", ")", ":", "if", "type", "(", "key", ")", "is", "not", "tuple", ":", "raise", "TypeError", "(", "\"Variable tracking key must be a tuple\"", ")", "if", "eternal", ":...
Register a value with the variable tracking system :param v: The BVS to register :param key: A tuple to register the variable under :parma eternal: Whether this is an eternal variable, default True. If False, an incrementing counter will be appended to the key.
[ "Register", "a", "value", "with", "the", "variable", "tracking", "system" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L228-L247
train
angr/angr
angr/state_plugins/solver.py
SimSolver.describe_variables
def describe_variables(self, v): """ Given an AST, iterate over all the keys of all the BVS leaves in the tree which are registered. """ reverse_mapping = {next(iter(var.variables)): k for k, var in self.eternal_tracked_variables.items()} reverse_mapping.update({next(iter(var.var...
python
def describe_variables(self, v): """ Given an AST, iterate over all the keys of all the BVS leaves in the tree which are registered. """ reverse_mapping = {next(iter(var.variables)): k for k, var in self.eternal_tracked_variables.items()} reverse_mapping.update({next(iter(var.var...
[ "def", "describe_variables", "(", "self", ",", "v", ")", ":", "reverse_mapping", "=", "{", "next", "(", "iter", "(", "var", ".", "variables", ")", ")", ":", "k", "for", "k", ",", "var", "in", "self", ".", "eternal_tracked_variables", ".", "items", "(",...
Given an AST, iterate over all the keys of all the BVS leaves in the tree which are registered.
[ "Given", "an", "AST", "iterate", "over", "all", "the", "keys", "of", "all", "the", "BVS", "leaves", "in", "the", "tree", "which", "are", "registered", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L249-L258
train
angr/angr
angr/state_plugins/solver.py
SimSolver._solver
def _solver(self): """ Creates or gets a Claripy solver, based on the state options. """ if self._stored_solver is not None: return self._stored_solver track = o.CONSTRAINT_TRACKING_IN_SOLVER in self.state.options approximate_first = o.APPROXIMATE_FIRST in se...
python
def _solver(self): """ Creates or gets a Claripy solver, based on the state options. """ if self._stored_solver is not None: return self._stored_solver track = o.CONSTRAINT_TRACKING_IN_SOLVER in self.state.options approximate_first = o.APPROXIMATE_FIRST in se...
[ "def", "_solver", "(", "self", ")", ":", "if", "self", ".", "_stored_solver", "is", "not", "None", ":", "return", "self", ".", "_stored_solver", "track", "=", "o", ".", "CONSTRAINT_TRACKING_IN_SOLVER", "in", "self", ".", "state", ".", "options", "approximate...
Creates or gets a Claripy solver, based on the state options.
[ "Creates", "or", "gets", "a", "Claripy", "solver", "based", "on", "the", "state", "options", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L261-L301
train
angr/angr
angr/state_plugins/solver.py
SimSolver.Unconstrained
def Unconstrained(self, name, bits, uninitialized=True, inspect=True, events=True, key=None, eternal=False, **kwargs): """ Creates an unconstrained symbol or a default concrete value (0), based on the state options. :param name: The name of the symbol. :param bits: ...
python
def Unconstrained(self, name, bits, uninitialized=True, inspect=True, events=True, key=None, eternal=False, **kwargs): """ Creates an unconstrained symbol or a default concrete value (0), based on the state options. :param name: The name of the symbol. :param bits: ...
[ "def", "Unconstrained", "(", "self", ",", "name", ",", "bits", ",", "uninitialized", "=", "True", ",", "inspect", "=", "True", ",", "events", "=", "True", ",", "key", "=", "None", ",", "eternal", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if...
Creates an unconstrained symbol or a default concrete value (0), based on the state options. :param name: The name of the symbol. :param bits: The size (in bits) of the symbol. :param uninitialized: Whether this value should be counted as an "uninitialized" value in the ...
[ "Creates", "an", "unconstrained", "symbol", "or", "a", "default", "concrete", "value", "(", "0", ")", "based", "on", "the", "state", "options", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L306-L340
train
angr/angr
angr/state_plugins/solver.py
SimSolver.BVS
def BVS(self, name, size, min=None, max=None, stride=None, uninitialized=False, explicit_name=None, key=None, eternal=False, inspect=True, events=True, **kwargs): #pylint:disable=redefined-builtin """ Creates a bit-vector symbol (i.e., a variab...
python
def BVS(self, name, size, min=None, max=None, stride=None, uninitialized=False, explicit_name=None, key=None, eternal=False, inspect=True, events=True, **kwargs): #pylint:disable=redefined-builtin """ Creates a bit-vector symbol (i.e., a variab...
[ "def", "BVS", "(", "self", ",", "name", ",", "size", ",", "min", "=", "None", ",", "max", "=", "None", ",", "stride", "=", "None", ",", "uninitialized", "=", "False", ",", "explicit_name", "=", "None", ",", "key", "=", "None", ",", "eternal", "=", ...
Creates a bit-vector symbol (i.e., a variable). Other keyword parameters are passed directly on to the constructor of claripy.ast.BV. :param name: The name of the symbol. :param size: The size (in bits) of the bit-vector. :param min: The minimum value o...
[ "Creates", "a", "bit", "-", "vector", "symbol", "(", "i", ".", "e", ".", "a", "variable", ")", ".", "Other", "keyword", "parameters", "are", "passed", "directly", "on", "to", "the", "constructor", "of", "claripy", ".", "ast", ".", "BV", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L342-L390
train
angr/angr
angr/state_plugins/solver.py
SimSolver.eval_to_ast
def eval_to_ast(self, e, n, extra_constraints=(), exact=None): """ Evaluate an expression, using the solver if necessary. Returns AST objects. :param e: the expression :param n: the number of desired solutions :param extra_constraints: extra constraints to apply to the solver ...
python
def eval_to_ast(self, e, n, extra_constraints=(), exact=None): """ Evaluate an expression, using the solver if necessary. Returns AST objects. :param e: the expression :param n: the number of desired solutions :param extra_constraints: extra constraints to apply to the solver ...
[ "def", "eval_to_ast", "(", "self", ",", "e", ",", "n", ",", "extra_constraints", "=", "(", ")", ",", "exact", "=", "None", ")", ":", "return", "self", ".", "_solver", ".", "eval_to_ast", "(", "e", ",", "n", ",", "extra_constraints", "=", "self", ".",...
Evaluate an expression, using the solver if necessary. Returns AST objects. :param e: the expression :param n: the number of desired solutions :param extra_constraints: extra constraints to apply to the solver :param exact: if False, returns approximate solutions :return: a tupl...
[ "Evaluate", "an", "expression", "using", "the", "solver", "if", "necessary", ".", "Returns", "AST", "objects", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L471-L482
train
angr/angr
angr/state_plugins/solver.py
SimSolver._eval
def _eval(self, e, n, extra_constraints=(), exact=None): """ Evaluate an expression, using the solver if necessary. Returns primitives. :param e: the expression :param n: the number of desired solutions :param extra_constraints: extra constraints to apply to the solver :...
python
def _eval(self, e, n, extra_constraints=(), exact=None): """ Evaluate an expression, using the solver if necessary. Returns primitives. :param e: the expression :param n: the number of desired solutions :param extra_constraints: extra constraints to apply to the solver :...
[ "def", "_eval", "(", "self", ",", "e", ",", "n", ",", "extra_constraints", "=", "(", ")", ",", "exact", "=", "None", ")", ":", "return", "self", ".", "_solver", ".", "eval", "(", "e", ",", "n", ",", "extra_constraints", "=", "self", ".", "_adjust_c...
Evaluate an expression, using the solver if necessary. Returns primitives. :param e: the expression :param n: the number of desired solutions :param extra_constraints: extra constraints to apply to the solver :param exact: if False, returns approximate solutions :return: a tuple...
[ "Evaluate", "an", "expression", "using", "the", "solver", "if", "necessary", ".", "Returns", "primitives", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L488-L499
train
angr/angr
angr/state_plugins/solver.py
SimSolver.max
def max(self, e, extra_constraints=(), exact=None): """ Return the maximum value of expression `e`. :param e : expression (an AST) to evaluate :param extra_constraints: extra constraints (as ASTs) to add to the solver for this solve :param exact : if Fa...
python
def max(self, e, extra_constraints=(), exact=None): """ Return the maximum value of expression `e`. :param e : expression (an AST) to evaluate :param extra_constraints: extra constraints (as ASTs) to add to the solver for this solve :param exact : if Fa...
[ "def", "max", "(", "self", ",", "e", ",", "extra_constraints", "=", "(", ")", ",", "exact", "=", "None", ")", ":", "if", "exact", "is", "False", "and", "o", ".", "VALIDATE_APPROXIMATIONS", "in", "self", ".", "state", ".", "options", ":", "ar", "=", ...
Return the maximum value of expression `e`. :param e : expression (an AST) to evaluate :param extra_constraints: extra constraints (as ASTs) to add to the solver for this solve :param exact : if False, return approximate solutions. :return: the maximum possible...
[ "Return", "the", "maximum", "value", "of", "expression", "e", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L505-L519
train
angr/angr
angr/state_plugins/solver.py
SimSolver.solution
def solution(self, e, v, extra_constraints=(), exact=None): """ Return True if `v` is a solution of `expr` with the extra constraints, False otherwise. :param e: An expression (an AST) to evaluate :param v: The proposed solution (an AST) :para...
python
def solution(self, e, v, extra_constraints=(), exact=None): """ Return True if `v` is a solution of `expr` with the extra constraints, False otherwise. :param e: An expression (an AST) to evaluate :param v: The proposed solution (an AST) :para...
[ "def", "solution", "(", "self", ",", "e", ",", "v", ",", "extra_constraints", "=", "(", ")", ",", "exact", "=", "None", ")", ":", "if", "exact", "is", "False", "and", "o", ".", "VALIDATE_APPROXIMATIONS", "in", "self", ".", "state", ".", "options", ":...
Return True if `v` is a solution of `expr` with the extra constraints, False otherwise. :param e: An expression (an AST) to evaluate :param v: The proposed solution (an AST) :param extra_constraints: Extra constraints (as ASTs) to add to the solver for this...
[ "Return", "True", "if", "v", "is", "a", "solution", "of", "expr", "with", "the", "extra", "constraints", "False", "otherwise", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L544-L560
train
angr/angr
angr/state_plugins/solver.py
SimSolver.unsat_core
def unsat_core(self, extra_constraints=()): """ This function returns the unsat core from the backend solver. :param extra_constraints: Extra constraints (as ASTs) to add to the solver for this solve. :return: The unsat core. """ if o.CONSTRAINT_TRACKING_IN_SOLVER not ...
python
def unsat_core(self, extra_constraints=()): """ This function returns the unsat core from the backend solver. :param extra_constraints: Extra constraints (as ASTs) to add to the solver for this solve. :return: The unsat core. """ if o.CONSTRAINT_TRACKING_IN_SOLVER not ...
[ "def", "unsat_core", "(", "self", ",", "extra_constraints", "=", "(", ")", ")", ":", "if", "o", ".", "CONSTRAINT_TRACKING_IN_SOLVER", "not", "in", "self", ".", "state", ".", "options", ":", "raise", "SimSolverOptionError", "(", "'CONSTRAINT_TRACKING_IN_SOLVER must...
This function returns the unsat core from the backend solver. :param extra_constraints: Extra constraints (as ASTs) to add to the solver for this solve. :return: The unsat core.
[ "This", "function", "returns", "the", "unsat", "core", "from", "the", "backend", "solver", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L611-L620
train
angr/angr
angr/state_plugins/solver.py
SimSolver.satisfiable
def satisfiable(self, extra_constraints=(), exact=None): """ This function does a constraint check and checks if the solver is in a sat state. :param extra_constraints: Extra constraints (as ASTs) to add to s for this solve :param exact: If False, return approximate solu...
python
def satisfiable(self, extra_constraints=(), exact=None): """ This function does a constraint check and checks if the solver is in a sat state. :param extra_constraints: Extra constraints (as ASTs) to add to s for this solve :param exact: If False, return approximate solu...
[ "def", "satisfiable", "(", "self", ",", "extra_constraints", "=", "(", ")", ",", "exact", "=", "None", ")", ":", "if", "exact", "is", "False", "and", "o", ".", "VALIDATE_APPROXIMATIONS", "in", "self", ".", "state", ".", "options", ":", "er", "=", "self...
This function does a constraint check and checks if the solver is in a sat state. :param extra_constraints: Extra constraints (as ASTs) to add to s for this solve :param exact: If False, return approximate solutions. :return: True if sat, otherwise false
[ "This", "function", "does", "a", "constraint", "check", "and", "checks", "if", "the", "solver", "is", "in", "a", "sat", "state", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L625-L640
train
angr/angr
angr/state_plugins/solver.py
SimSolver.add
def add(self, *constraints): """ Add some constraints to the solver. :param constraints: Pass any constraints that you want to add (ASTs) as varargs. """ cc = self._adjust_constraint_list(constraints) return self._solver.add(cc)
python
def add(self, *constraints): """ Add some constraints to the solver. :param constraints: Pass any constraints that you want to add (ASTs) as varargs. """ cc = self._adjust_constraint_list(constraints) return self._solver.add(cc)
[ "def", "add", "(", "self", ",", "*", "constraints", ")", ":", "cc", "=", "self", ".", "_adjust_constraint_list", "(", "constraints", ")", "return", "self", ".", "_solver", ".", "add", "(", "cc", ")" ]
Add some constraints to the solver. :param constraints: Pass any constraints that you want to add (ASTs) as varargs.
[ "Add", "some", "constraints", "to", "the", "solver", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L645-L652
train
angr/angr
angr/state_plugins/solver.py
SimSolver._cast_to
def _cast_to(e, solution, cast_to): """ Casts a solution for the given expression to type `cast_to`. :param e: The expression `value` is a solution for :param value: The solution to be cast :param cast_to: The type `value` should be cast to. Must be one of the currently supporte...
python
def _cast_to(e, solution, cast_to): """ Casts a solution for the given expression to type `cast_to`. :param e: The expression `value` is a solution for :param value: The solution to be cast :param cast_to: The type `value` should be cast to. Must be one of the currently supporte...
[ "def", "_cast_to", "(", "e", ",", "solution", ",", "cast_to", ")", ":", "if", "cast_to", "is", "None", ":", "return", "solution", "if", "type", "(", "solution", ")", "is", "bool", ":", "if", "cast_to", "is", "bytes", ":", "return", "bytes", "(", "[",...
Casts a solution for the given expression to type `cast_to`. :param e: The expression `value` is a solution for :param value: The solution to be cast :param cast_to: The type `value` should be cast to. Must be one of the currently supported types (bytes|int) :raise ValueError: If cast_t...
[ "Casts", "a", "solution", "for", "the", "given", "expression", "to", "type", "cast_to", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L659-L688
train
angr/angr
angr/state_plugins/solver.py
SimSolver.eval_upto
def eval_upto(self, e, n, cast_to=None, **kwargs): """ Evaluate an expression, using the solver if necessary. Returns primitives as specified by the `cast_to` parameter. Only certain primitives are supported, check the implementation of `_cast_to` to see which ones. :param e: the expres...
python
def eval_upto(self, e, n, cast_to=None, **kwargs): """ Evaluate an expression, using the solver if necessary. Returns primitives as specified by the `cast_to` parameter. Only certain primitives are supported, check the implementation of `_cast_to` to see which ones. :param e: the expres...
[ "def", "eval_upto", "(", "self", ",", "e", ",", "n", ",", "cast_to", "=", "None", ",", "*", "*", "kwargs", ")", ":", "concrete_val", "=", "_concrete_value", "(", "e", ")", "if", "concrete_val", "is", "not", "None", ":", "return", "[", "self", ".", ...
Evaluate an expression, using the solver if necessary. Returns primitives as specified by the `cast_to` parameter. Only certain primitives are supported, check the implementation of `_cast_to` to see which ones. :param e: the expression :param n: the number of desired solutions :param e...
[ "Evaluate", "an", "expression", "using", "the", "solver", "if", "necessary", ".", "Returns", "primitives", "as", "specified", "by", "the", "cast_to", "parameter", ".", "Only", "certain", "primitives", "are", "supported", "check", "the", "implementation", "of", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L690-L710
train
angr/angr
angr/state_plugins/solver.py
SimSolver.eval_one
def eval_one(self, e, **kwargs): """ Evaluate an expression to get the only possible solution. Errors if either no or more than one solution is returned. A kwarg parameter `default` can be specified to be returned instead of failure! :param e: the expression to get a solution for ...
python
def eval_one(self, e, **kwargs): """ Evaluate an expression to get the only possible solution. Errors if either no or more than one solution is returned. A kwarg parameter `default` can be specified to be returned instead of failure! :param e: the expression to get a solution for ...
[ "def", "eval_one", "(", "self", ",", "e", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "self", ".", "eval_exact", "(", "e", ",", "1", ",", "*", "*", "{", "k", ":", "v", "for", "(", "k", ",", "v", ")", "in", "kwargs", ".", "items...
Evaluate an expression to get the only possible solution. Errors if either no or more than one solution is returned. A kwarg parameter `default` can be specified to be returned instead of failure! :param e: the expression to get a solution for :param default: A value can be passed as a kwarg he...
[ "Evaluate", "an", "expression", "to", "get", "the", "only", "possible", "solution", ".", "Errors", "if", "either", "no", "or", "more", "than", "one", "solution", "is", "returned", ".", "A", "kwarg", "parameter", "default", "can", "be", "specified", "to", "...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L726-L743
train
angr/angr
angr/state_plugins/solver.py
SimSolver.eval_atmost
def eval_atmost(self, e, n, **kwargs): """ Evaluate an expression to get at most `n` possible solutions. Errors if either none or more than `n` solutions are returned. :param e: the expression to get a solution for :param n: the inclusive upper limit on the number of solutions ...
python
def eval_atmost(self, e, n, **kwargs): """ Evaluate an expression to get at most `n` possible solutions. Errors if either none or more than `n` solutions are returned. :param e: the expression to get a solution for :param n: the inclusive upper limit on the number of solutions ...
[ "def", "eval_atmost", "(", "self", ",", "e", ",", "n", ",", "*", "*", "kwargs", ")", ":", "r", "=", "self", ".", "eval_upto", "(", "e", ",", "n", "+", "1", ",", "*", "*", "kwargs", ")", "if", "len", "(", "r", ")", ">", "n", ":", "raise", ...
Evaluate an expression to get at most `n` possible solutions. Errors if either none or more than `n` solutions are returned. :param e: the expression to get a solution for :param n: the inclusive upper limit on the number of solutions :param kwargs: Any additional kwargs will be passed ...
[ "Evaluate", "an", "expression", "to", "get", "at", "most", "n", "possible", "solutions", ".", "Errors", "if", "either", "none", "or", "more", "than", "n", "solutions", "are", "returned", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L745-L760
train
angr/angr
angr/state_plugins/solver.py
SimSolver.unique
def unique(self, e, **kwargs): """ Returns True if the expression `e` has only one solution by querying the constraint solver. It does also add that unique solution to the solver's constraints. """ if not isinstance(e, claripy.ast.Base): return True #...
python
def unique(self, e, **kwargs): """ Returns True if the expression `e` has only one solution by querying the constraint solver. It does also add that unique solution to the solver's constraints. """ if not isinstance(e, claripy.ast.Base): return True #...
[ "def", "unique", "(", "self", ",", "e", ",", "*", "*", "kwargs", ")", ":", "if", "not", "isinstance", "(", "e", ",", "claripy", ".", "ast", ".", "Base", ")", ":", "return", "True", "# if we don't want to do symbolic checks, assume symbolic variables are multival...
Returns True if the expression `e` has only one solution by querying the constraint solver. It does also add that unique solution to the solver's constraints.
[ "Returns", "True", "if", "the", "expression", "e", "has", "only", "one", "solution", "by", "querying", "the", "constraint", "solver", ".", "It", "does", "also", "add", "that", "unique", "solution", "to", "the", "solver", "s", "constraints", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L804-L824
train
angr/angr
angr/state_plugins/solver.py
SimSolver.symbolic
def symbolic(self, e): # pylint:disable=R0201 """ Returns True if the expression `e` is symbolic. """ if type(e) in (int, bytes, float, bool): return False return e.symbolic
python
def symbolic(self, e): # pylint:disable=R0201 """ Returns True if the expression `e` is symbolic. """ if type(e) in (int, bytes, float, bool): return False return e.symbolic
[ "def", "symbolic", "(", "self", ",", "e", ")", ":", "# pylint:disable=R0201", "if", "type", "(", "e", ")", "in", "(", "int", ",", "bytes", ",", "float", ",", "bool", ")", ":", "return", "False", "return", "e", ".", "symbolic" ]
Returns True if the expression `e` is symbolic.
[ "Returns", "True", "if", "the", "expression", "e", "is", "symbolic", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L826-L832
train
angr/angr
angr/state_plugins/solver.py
SimSolver.single_valued
def single_valued(self, e): """ Returns True whether `e` is a concrete value or is a value set with only 1 possible value. This differs from `unique` in that this *does* not query the constraint solver. """ if self.state.mode == 'static': if type(e) in (int, b...
python
def single_valued(self, e): """ Returns True whether `e` is a concrete value or is a value set with only 1 possible value. This differs from `unique` in that this *does* not query the constraint solver. """ if self.state.mode == 'static': if type(e) in (int, b...
[ "def", "single_valued", "(", "self", ",", "e", ")", ":", "if", "self", ".", "state", ".", "mode", "==", "'static'", ":", "if", "type", "(", "e", ")", "in", "(", "int", ",", "bytes", ",", "float", ",", "bool", ")", ":", "return", "True", "else", ...
Returns True whether `e` is a concrete value or is a value set with only 1 possible value. This differs from `unique` in that this *does* not query the constraint solver.
[ "Returns", "True", "whether", "e", "is", "a", "concrete", "value", "or", "is", "a", "value", "set", "with", "only", "1", "possible", "value", ".", "This", "differs", "from", "unique", "in", "that", "this", "*", "does", "*", "not", "query", "the", "cons...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L834-L848
train
angr/angr
angr/state_plugins/solver.py
SimSolver.simplify
def simplify(self, e=None): """ Simplifies `e`. If `e` is None, simplifies the constraints of this state. """ if e is None: return self._solver.simplify() elif isinstance(e, (int, float, bool)): return e elif isinstance(e, claripy.ast.Base)...
python
def simplify(self, e=None): """ Simplifies `e`. If `e` is None, simplifies the constraints of this state. """ if e is None: return self._solver.simplify() elif isinstance(e, (int, float, bool)): return e elif isinstance(e, claripy.ast.Base)...
[ "def", "simplify", "(", "self", ",", "e", "=", "None", ")", ":", "if", "e", "is", "None", ":", "return", "self", ".", "_solver", ".", "simplify", "(", ")", "elif", "isinstance", "(", "e", ",", "(", "int", ",", "float", ",", "bool", ")", ")", ":...
Simplifies `e`. If `e` is None, simplifies the constraints of this state.
[ "Simplifies", "e", ".", "If", "e", "is", "None", "simplifies", "the", "constraints", "of", "this", "state", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/solver.py#L850-L866
train
angr/angr
angr/state_plugins/preconstrainer.py
SimStatePreconstrainer.preconstrain
def preconstrain(self, value, variable): """ Add a preconstraint that ``variable == value`` to the state. :param value: The concrete value. Can be a bitvector or a bytestring or an integer. :param variable: The BVS to preconstrain. """ if not isinstance(value, c...
python
def preconstrain(self, value, variable): """ Add a preconstraint that ``variable == value`` to the state. :param value: The concrete value. Can be a bitvector or a bytestring or an integer. :param variable: The BVS to preconstrain. """ if not isinstance(value, c...
[ "def", "preconstrain", "(", "self", ",", "value", ",", "variable", ")", ":", "if", "not", "isinstance", "(", "value", ",", "claripy", ".", "ast", ".", "Base", ")", ":", "value", "=", "self", ".", "state", ".", "solver", ".", "BVV", "(", "value", ",...
Add a preconstraint that ``variable == value`` to the state. :param value: The concrete value. Can be a bitvector or a bytestring or an integer. :param variable: The BVS to preconstrain.
[ "Add", "a", "preconstraint", "that", "variable", "==", "value", "to", "the", "state", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/preconstrainer.py#L46-L74
train
angr/angr
angr/state_plugins/preconstrainer.py
SimStatePreconstrainer.preconstrain_file
def preconstrain_file(self, content, simfile, set_length=False): """ Preconstrain the contents of a file. :param content: The content to preconstrain the file to. Can be a bytestring or a list thereof. :param simfile: The actual simfile to preconstrain """ repair...
python
def preconstrain_file(self, content, simfile, set_length=False): """ Preconstrain the contents of a file. :param content: The content to preconstrain the file to. Can be a bytestring or a list thereof. :param simfile: The actual simfile to preconstrain """ repair...
[ "def", "preconstrain_file", "(", "self", ",", "content", ",", "simfile", ",", "set_length", "=", "False", ")", ":", "repair_entry_state_opts", "=", "False", "if", "o", ".", "TRACK_ACTION_HISTORY", "in", "self", ".", "state", ".", "options", ":", "repair_entry_...
Preconstrain the contents of a file. :param content: The content to preconstrain the file to. Can be a bytestring or a list thereof. :param simfile: The actual simfile to preconstrain
[ "Preconstrain", "the", "contents", "of", "a", "file", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/preconstrainer.py#L76-L108
train
angr/angr
angr/state_plugins/preconstrainer.py
SimStatePreconstrainer.preconstrain_flag_page
def preconstrain_flag_page(self, magic_content): """ Preconstrain the data in the flag page. :param magic_content: The content of the magic page as a bytestring. """ for m, v in zip(magic_content, self.state.cgc.flag_bytes): self.preconstrain(m, v)
python
def preconstrain_flag_page(self, magic_content): """ Preconstrain the data in the flag page. :param magic_content: The content of the magic page as a bytestring. """ for m, v in zip(magic_content, self.state.cgc.flag_bytes): self.preconstrain(m, v)
[ "def", "preconstrain_flag_page", "(", "self", ",", "magic_content", ")", ":", "for", "m", ",", "v", "in", "zip", "(", "magic_content", ",", "self", ".", "state", ".", "cgc", ".", "flag_bytes", ")", ":", "self", ".", "preconstrain", "(", "m", ",", "v", ...
Preconstrain the data in the flag page. :param magic_content: The content of the magic page as a bytestring.
[ "Preconstrain", "the", "data", "in", "the", "flag", "page", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/preconstrainer.py#L110-L117
train
angr/angr
angr/state_plugins/preconstrainer.py
SimStatePreconstrainer.remove_preconstraints
def remove_preconstraints(self, to_composite_solver=True, simplify=True): """ Remove the preconstraints from the state. If you are using the zen plugin, this will also use that to filter the constraints. :param to_composite_solver: Whether to convert the replacement solver to a com...
python
def remove_preconstraints(self, to_composite_solver=True, simplify=True): """ Remove the preconstraints from the state. If you are using the zen plugin, this will also use that to filter the constraints. :param to_composite_solver: Whether to convert the replacement solver to a com...
[ "def", "remove_preconstraints", "(", "self", ",", "to_composite_solver", "=", "True", ",", "simplify", "=", "True", ")", ":", "if", "not", "self", ".", "preconstraints", ":", "return", "# cache key set creation", "precon_cache_keys", "=", "set", "(", ")", "for",...
Remove the preconstraints from the state. If you are using the zen plugin, this will also use that to filter the constraints. :param to_composite_solver: Whether to convert the replacement solver to a composite solver. You probably want this if you're switch...
[ "Remove", "the", "preconstraints", "from", "the", "state", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/preconstrainer.py#L119-L158
train
angr/angr
angr/state_plugins/preconstrainer.py
SimStatePreconstrainer.reconstrain
def reconstrain(self): """ Split the solver. If any of the subsolvers time out after a short timeout (10 seconds), re-add the preconstraints associated with each of its variables. Hopefully these constraints still allow us to do meaningful things to the state. """ # test...
python
def reconstrain(self): """ Split the solver. If any of the subsolvers time out after a short timeout (10 seconds), re-add the preconstraints associated with each of its variables. Hopefully these constraints still allow us to do meaningful things to the state. """ # test...
[ "def", "reconstrain", "(", "self", ")", ":", "# test all solver splits", "subsolvers", "=", "self", ".", "state", ".", "solver", ".", "_solver", ".", "split", "(", ")", "for", "solver", "in", "subsolvers", ":", "solver", ".", "timeout", "=", "1000", "*", ...
Split the solver. If any of the subsolvers time out after a short timeout (10 seconds), re-add the preconstraints associated with each of its variables. Hopefully these constraints still allow us to do meaningful things to the state.
[ "Split", "the", "solver", ".", "If", "any", "of", "the", "subsolvers", "time", "out", "after", "a", "short", "timeout", "(", "10", "seconds", ")", "re", "-", "add", "the", "preconstraints", "associated", "with", "each", "of", "its", "variables", ".", "Ho...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/preconstrainer.py#L160-L177
train
angr/angr
angr/knowledge_plugins/cfg/cfg_model.py
ReferenceManager.add_ref
def add_ref(self, ref): """ Add a reference to a memory data object. :param CodeReference ref: The reference. :return: None """ self.refs[ref.insn_addr].append(ref) self.data_addr_to_ref[ref.memory_data.addr].append(ref)
python
def add_ref(self, ref): """ Add a reference to a memory data object. :param CodeReference ref: The reference. :return: None """ self.refs[ref.insn_addr].append(ref) self.data_addr_to_ref[ref.memory_data.addr].append(ref)
[ "def", "add_ref", "(", "self", ",", "ref", ")", ":", "self", ".", "refs", "[", "ref", ".", "insn_addr", "]", ".", "append", "(", "ref", ")", "self", ".", "data_addr_to_ref", "[", "ref", ".", "memory_data", ".", "addr", "]", ".", "append", "(", "ref...
Add a reference to a memory data object. :param CodeReference ref: The reference. :return: None
[ "Add", "a", "reference", "to", "a", "memory", "data", "object", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/cfg/cfg_model.py#L25-L34
train
angr/angr
angr/knowledge_plugins/cfg/cfg_model.py
CFGModel.get_any_node
def get_any_node(self, addr, is_syscall=None, anyaddr=False, force_fastpath=False): """ Get an arbitrary CFGNode (without considering their contexts) from our graph. :param int addr: Address of the beginning of the basic block. Set anyaddr to True to support arbitrary ...
python
def get_any_node(self, addr, is_syscall=None, anyaddr=False, force_fastpath=False): """ Get an arbitrary CFGNode (without considering their contexts) from our graph. :param int addr: Address of the beginning of the basic block. Set anyaddr to True to support arbitrary ...
[ "def", "get_any_node", "(", "self", ",", "addr", ",", "is_syscall", "=", "None", ",", "anyaddr", "=", "False", ",", "force_fastpath", "=", "False", ")", ":", "# fastpath: directly look in the nodes list", "if", "not", "anyaddr", ":", "try", ":", "return", "sel...
Get an arbitrary CFGNode (without considering their contexts) from our graph. :param int addr: Address of the beginning of the basic block. Set anyaddr to True to support arbitrary address. :param bool is_syscall: Whether you want to get the syscall node or any ot...
[ "Get", "an", "arbitrary", "CFGNode", "(", "without", "considering", "their", "contexts", ")", "from", "our", "graph", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/cfg/cfg_model.py#L213-L271
train
angr/angr
angr/knowledge_plugins/cfg/cfg_model.py
CFGModel.get_all_nodes
def get_all_nodes(self, addr, is_syscall=None, anyaddr=False): """ Get all CFGNodes whose address is the specified one. :param addr: Address of the node :param is_syscall: True returns the syscall node, False returns the normal CFGNode, None returns both :return: ...
python
def get_all_nodes(self, addr, is_syscall=None, anyaddr=False): """ Get all CFGNodes whose address is the specified one. :param addr: Address of the node :param is_syscall: True returns the syscall node, False returns the normal CFGNode, None returns both :return: ...
[ "def", "get_all_nodes", "(", "self", ",", "addr", ",", "is_syscall", "=", "None", ",", "anyaddr", "=", "False", ")", ":", "results", "=", "[", "]", "for", "cfg_node", "in", "self", ".", "graph", ".", "nodes", "(", ")", ":", "if", "cfg_node", ".", "...
Get all CFGNodes whose address is the specified one. :param addr: Address of the node :param is_syscall: True returns the syscall node, False returns the normal CFGNode, None returns both :return: all CFGNodes
[ "Get", "all", "CFGNodes", "whose", "address", "is", "the", "specified", "one", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/cfg/cfg_model.py#L273-L295
train
angr/angr
angr/knowledge_plugins/cfg/cfg_model.py
CFGModel.get_predecessors
def get_predecessors(self, cfgnode, excluding_fakeret=True, jumpkind=None): """ Get predecessors of a node in the control flow graph. :param CFGNode cfgnode: The node. :param bool excluding_fakeret: True if you want to exclude all predecessors that is connected to the n...
python
def get_predecessors(self, cfgnode, excluding_fakeret=True, jumpkind=None): """ Get predecessors of a node in the control flow graph. :param CFGNode cfgnode: The node. :param bool excluding_fakeret: True if you want to exclude all predecessors that is connected to the n...
[ "def", "get_predecessors", "(", "self", ",", "cfgnode", ",", "excluding_fakeret", "=", "True", ",", "jumpkind", "=", "None", ")", ":", "if", "excluding_fakeret", "and", "jumpkind", "==", "'Ijk_FakeRet'", ":", "return", "[", "]", "if", "not", "excluding_fakeret...
Get predecessors of a node in the control flow graph. :param CFGNode cfgnode: The node. :param bool excluding_fakeret: True if you want to exclude all predecessors that is connected to the node with a fakeret edge. :param str or None ...
[ "Get", "predecessors", "of", "a", "node", "in", "the", "control", "flow", "graph", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/cfg/cfg_model.py#L307-L340
train
angr/angr
angr/knowledge_plugins/cfg/cfg_model.py
CFGModel.get_successors
def get_successors(self, node, excluding_fakeret=True, jumpkind=None): """ Get successors of a node in the control flow graph. :param CFGNode node: The node. :param bool excluding_fakeret: True if you want to exclude all successors that is connected to the node ...
python
def get_successors(self, node, excluding_fakeret=True, jumpkind=None): """ Get successors of a node in the control flow graph. :param CFGNode node: The node. :param bool excluding_fakeret: True if you want to exclude all successors that is connected to the node ...
[ "def", "get_successors", "(", "self", ",", "node", ",", "excluding_fakeret", "=", "True", ",", "jumpkind", "=", "None", ")", ":", "if", "jumpkind", "is", "not", "None", ":", "if", "excluding_fakeret", "and", "jumpkind", "==", "'Ijk_FakeRet'", ":", "return", ...
Get successors of a node in the control flow graph. :param CFGNode node: The node. :param bool excluding_fakeret: True if you want to exclude all successors that is connected to the node with a fakeret edge. :param str or None jump...
[ "Get", "successors", "of", "a", "node", "in", "the", "control", "flow", "graph", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/cfg/cfg_model.py#L342-L376
train
angr/angr
angr/knowledge_plugins/cfg/cfg_model.py
CFGModel.get_successors_and_jumpkind
def get_successors_and_jumpkind(self, node, excluding_fakeret=True): """ Get a list of tuples where the first element is the successor of the CFG node and the second element is the jumpkind of the successor. :param CFGNode node: The node. :param bool excluding_fakeret...
python
def get_successors_and_jumpkind(self, node, excluding_fakeret=True): """ Get a list of tuples where the first element is the successor of the CFG node and the second element is the jumpkind of the successor. :param CFGNode node: The node. :param bool excluding_fakeret...
[ "def", "get_successors_and_jumpkind", "(", "self", ",", "node", ",", "excluding_fakeret", "=", "True", ")", ":", "successors", "=", "[", "]", "for", "_", ",", "suc", ",", "data", "in", "self", ".", "graph", ".", "out_edges", "(", "[", "node", "]", ",",...
Get a list of tuples where the first element is the successor of the CFG node and the second element is the jumpkind of the successor. :param CFGNode node: The node. :param bool excluding_fakeret: True if you want to exclude all successors that are fall-through successors. :...
[ "Get", "a", "list", "of", "tuples", "where", "the", "first", "element", "is", "the", "successor", "of", "the", "CFG", "node", "and", "the", "second", "element", "is", "the", "jumpkind", "of", "the", "successor", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/cfg/cfg_model.py#L378-L393
train
angr/angr
angr/knowledge_plugins/cfg/cfg_model.py
CFGModel.get_all_predecessors
def get_all_predecessors(self, cfgnode): """ Get all predecessors of a specific node on the control flow graph. :param CFGNode cfgnode: The CFGNode object :return: A list of predecessors in the CFG :rtype: list """ s = set() for child, parent in networkx....
python
def get_all_predecessors(self, cfgnode): """ Get all predecessors of a specific node on the control flow graph. :param CFGNode cfgnode: The CFGNode object :return: A list of predecessors in the CFG :rtype: list """ s = set() for child, parent in networkx....
[ "def", "get_all_predecessors", "(", "self", ",", "cfgnode", ")", ":", "s", "=", "set", "(", ")", "for", "child", ",", "parent", "in", "networkx", ".", "dfs_predecessors", "(", "self", ".", "graph", ",", "cfgnode", ")", ".", "items", "(", ")", ":", "s...
Get all predecessors of a specific node on the control flow graph. :param CFGNode cfgnode: The CFGNode object :return: A list of predecessors in the CFG :rtype: list
[ "Get", "all", "predecessors", "of", "a", "specific", "node", "on", "the", "control", "flow", "graph", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/cfg/cfg_model.py#L395-L407
train
angr/angr
angr/knowledge_plugins/cfg/cfg_model.py
CFGModel.get_branching_nodes
def get_branching_nodes(self): """ Returns all nodes that has an out degree >= 2 """ nodes = set() for n in self.graph.nodes(): if self.graph.out_degree(n) >= 2: nodes.add(n) return nodes
python
def get_branching_nodes(self): """ Returns all nodes that has an out degree >= 2 """ nodes = set() for n in self.graph.nodes(): if self.graph.out_degree(n) >= 2: nodes.add(n) return nodes
[ "def", "get_branching_nodes", "(", "self", ")", ":", "nodes", "=", "set", "(", ")", "for", "n", "in", "self", ".", "graph", ".", "nodes", "(", ")", ":", "if", "self", ".", "graph", ".", "out_degree", "(", "n", ")", ">=", "2", ":", "nodes", ".", ...
Returns all nodes that has an out degree >= 2
[ "Returns", "all", "nodes", "that", "has", "an", "out", "degree", ">", "=", "2" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/cfg/cfg_model.py#L416-L424
train
angr/angr
angr/knowledge_plugins/cfg/cfg_model.py
CFGModel.get_exit_stmt_idx
def get_exit_stmt_idx(self, src_block, dst_block): """ Get the corresponding exit statement ID for control flow to reach destination block from source block. The exit statement ID was put on the edge when creating the CFG. Note that there must be a direct edge between the two blocks, oth...
python
def get_exit_stmt_idx(self, src_block, dst_block): """ Get the corresponding exit statement ID for control flow to reach destination block from source block. The exit statement ID was put on the edge when creating the CFG. Note that there must be a direct edge between the two blocks, oth...
[ "def", "get_exit_stmt_idx", "(", "self", ",", "src_block", ",", "dst_block", ")", ":", "if", "not", "self", ".", "graph", ".", "has_edge", "(", "src_block", ",", "dst_block", ")", ":", "raise", "AngrCFGError", "(", "'Edge (%s, %s) does not exist in CFG'", "%", ...
Get the corresponding exit statement ID for control flow to reach destination block from source block. The exit statement ID was put on the edge when creating the CFG. Note that there must be a direct edge between the two blocks, otherwise an exception will be raised. :return: The exit statemen...
[ "Get", "the", "corresponding", "exit", "statement", "ID", "for", "control", "flow", "to", "reach", "destination", "block", "from", "source", "block", ".", "The", "exit", "statement", "ID", "was", "put", "on", "the", "edge", "when", "creating", "the", "CFG", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/cfg/cfg_model.py#L426-L438
train
angr/angr
angr/engines/soot/engine.py
SimEngineSoot.prepare_native_return_state
def prepare_native_return_state(native_state): """ Hook target for native function call returns. Recovers and stores the return value from native memory and toggles the state, s.t. execution continues in the Soot engine. """ javavm_simos = native_state.project.simos ...
python
def prepare_native_return_state(native_state): """ Hook target for native function call returns. Recovers and stores the return value from native memory and toggles the state, s.t. execution continues in the Soot engine. """ javavm_simos = native_state.project.simos ...
[ "def", "prepare_native_return_state", "(", "native_state", ")", ":", "javavm_simos", "=", "native_state", ".", "project", ".", "simos", "ret_state", "=", "native_state", ".", "copy", "(", ")", "# set successor flags", "ret_state", ".", "regs", ".", "_ip", "=", "...
Hook target for native function call returns. Recovers and stores the return value from native memory and toggles the state, s.t. execution continues in the Soot engine.
[ "Hook", "target", "for", "native", "function", "call", "returns", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/soot/engine.py#L334-L378
train
angr/angr
angr/storage/file.py
SimFile.concretize
def concretize(self, **kwargs): """ Return a concretization of the contents of the file, as a flat bytestring. """ size = self.state.solver.min(self._size, **kwargs) data = self.load(0, size) kwargs['cast_to'] = kwargs.get('cast_to', bytes) kwargs['extra_constrai...
python
def concretize(self, **kwargs): """ Return a concretization of the contents of the file, as a flat bytestring. """ size = self.state.solver.min(self._size, **kwargs) data = self.load(0, size) kwargs['cast_to'] = kwargs.get('cast_to', bytes) kwargs['extra_constrai...
[ "def", "concretize", "(", "self", ",", "*", "*", "kwargs", ")", ":", "size", "=", "self", ".", "state", ".", "solver", ".", "min", "(", "self", ".", "_size", ",", "*", "*", "kwargs", ")", "data", "=", "self", ".", "load", "(", "0", ",", "size",...
Return a concretization of the contents of the file, as a flat bytestring.
[ "Return", "a", "concretization", "of", "the", "contents", "of", "the", "file", "as", "a", "flat", "bytestring", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/file.py#L215-L224
train
angr/angr
angr/storage/file.py
SimPackets.concretize
def concretize(self, **kwargs): """ Returns a list of the packets read or written as bytestrings. """ lengths = [self.state.solver.eval(x[1], **kwargs) for x in self.content] kwargs['cast_to'] = bytes return [b'' if i == 0 else self.state.solver.eval(x[0][i*self.state.arc...
python
def concretize(self, **kwargs): """ Returns a list of the packets read or written as bytestrings. """ lengths = [self.state.solver.eval(x[1], **kwargs) for x in self.content] kwargs['cast_to'] = bytes return [b'' if i == 0 else self.state.solver.eval(x[0][i*self.state.arc...
[ "def", "concretize", "(", "self", ",", "*", "*", "kwargs", ")", ":", "lengths", "=", "[", "self", ".", "state", ".", "solver", ".", "eval", "(", "x", "[", "1", "]", ",", "*", "*", "kwargs", ")", "for", "x", "in", "self", ".", "content", "]", ...
Returns a list of the packets read or written as bytestrings.
[ "Returns", "a", "list", "of", "the", "packets", "read", "or", "written", "as", "bytestrings", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/file.py#L405-L411
train
angr/angr
angr/storage/file.py
SimPackets.read
def read(self, pos, size, **kwargs): """ Read a packet from the stream. :param int pos: The packet number to read from the sequence of the stream. May be None to append to the stream. :param size: The size to read. May be symbolic. :param short_reads: Whether to repla...
python
def read(self, pos, size, **kwargs): """ Read a packet from the stream. :param int pos: The packet number to read from the sequence of the stream. May be None to append to the stream. :param size: The size to read. May be symbolic. :param short_reads: Whether to repla...
[ "def", "read", "(", "self", ",", "pos", ",", "size", ",", "*", "*", "kwargs", ")", ":", "short_reads", "=", "kwargs", ".", "pop", "(", "'short_reads'", ",", "None", ")", "# sanity check on read/write modes", "if", "self", ".", "write_mode", "is", "None", ...
Read a packet from the stream. :param int pos: The packet number to read from the sequence of the stream. May be None to append to the stream. :param size: The size to read. May be symbolic. :param short_reads: Whether to replace the size with a symbolic value constrained to less tha...
[ "Read", "a", "packet", "from", "the", "stream", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/file.py#L413-L477
train
angr/angr
angr/storage/file.py
SimPackets.write
def write(self, pos, data, size=None, events=True, **kwargs): """ Write a packet to the stream. :param int pos: The packet number to write in the sequence of the stream. May be None to append to the stream. :param data: The data to write, as a string or bitvector. :pa...
python
def write(self, pos, data, size=None, events=True, **kwargs): """ Write a packet to the stream. :param int pos: The packet number to write in the sequence of the stream. May be None to append to the stream. :param data: The data to write, as a string or bitvector. :pa...
[ "def", "write", "(", "self", ",", "pos", ",", "data", ",", "size", "=", "None", ",", "events", "=", "True", ",", "*", "*", "kwargs", ")", ":", "if", "events", ":", "self", ".", "state", ".", "history", ".", "add_event", "(", "'fs_write'", ",", "f...
Write a packet to the stream. :param int pos: The packet number to write in the sequence of the stream. May be None to append to the stream. :param data: The data to write, as a string or bitvector. :param size: The optional size to write. May be symbolic; must be constrained ...
[ "Write", "a", "packet", "to", "the", "stream", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/file.py#L479-L521
train
angr/angr
angr/storage/file.py
SimFileDescriptorBase.read
def read(self, pos, size, **kwargs): """ Reads some data from the file, storing it into memory. :param pos: The address to write the read data into memory :param size: The requested length of the read :return: The real length of the read """ data, r...
python
def read(self, pos, size, **kwargs): """ Reads some data from the file, storing it into memory. :param pos: The address to write the read data into memory :param size: The requested length of the read :return: The real length of the read """ data, r...
[ "def", "read", "(", "self", ",", "pos", ",", "size", ",", "*", "*", "kwargs", ")", ":", "data", ",", "realsize", "=", "self", ".", "read_data", "(", "size", ",", "*", "*", "kwargs", ")", "if", "not", "self", ".", "state", ".", "solver", ".", "i...
Reads some data from the file, storing it into memory. :param pos: The address to write the read data into memory :param size: The requested length of the read :return: The real length of the read
[ "Reads", "some", "data", "from", "the", "file", "storing", "it", "into", "memory", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/file.py#L605-L616
train
angr/angr
angr/storage/file.py
SimFileDescriptorBase.write
def write(self, pos, size, **kwargs): """ Writes some data, loaded from the state, into the file. :param pos: The address to read the data to write from in memory :param size: The requested size of the write :return: The real length of the write """ ...
python
def write(self, pos, size, **kwargs): """ Writes some data, loaded from the state, into the file. :param pos: The address to read the data to write from in memory :param size: The requested size of the write :return: The real length of the write """ ...
[ "def", "write", "(", "self", ",", "pos", ",", "size", ",", "*", "*", "kwargs", ")", ":", "if", "type", "(", "pos", ")", "is", "str", ":", "raise", "TypeError", "(", "\"SimFileDescriptor.write takes an address and size. Did you mean write_data?\"", ")", "# Find a...
Writes some data, loaded from the state, into the file. :param pos: The address to read the data to write from in memory :param size: The requested size of the write :return: The real length of the write
[ "Writes", "some", "data", "loaded", "from", "the", "state", "into", "the", "file", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/file.py#L618-L645
train
angr/angr
angr/storage/file.py
SimFileDescriptorDuplex.concretize
def concretize(self, **kwargs): """ Return a concretization of the underlying files, as a tuple of (read file, write file). """ return (self._read_file.concretize(**kwargs), self._write_file.concretize(**kwargs))
python
def concretize(self, **kwargs): """ Return a concretization of the underlying files, as a tuple of (read file, write file). """ return (self._read_file.concretize(**kwargs), self._write_file.concretize(**kwargs))
[ "def", "concretize", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "(", "self", ".", "_read_file", ".", "concretize", "(", "*", "*", "kwargs", ")", ",", "self", ".", "_write_file", ".", "concretize", "(", "*", "*", "kwargs", ")", ")" ]
Return a concretization of the underlying files, as a tuple of (read file, write file).
[ "Return", "a", "concretization", "of", "the", "underlying", "files", "as", "a", "tuple", "of", "(", "read", "file", "write", "file", ")", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/file.py#L933-L937
train
angr/angr
angr/state_plugins/cgc.py
SimStateCGC.get_max_sinkhole
def get_max_sinkhole(self, length): """ Find a sinkhole which is large enough to support `length` bytes. This uses first-fit. The first sinkhole (ordered in descending order by their address) which can hold `length` bytes is chosen. If there are more than `length` bytes in the s...
python
def get_max_sinkhole(self, length): """ Find a sinkhole which is large enough to support `length` bytes. This uses first-fit. The first sinkhole (ordered in descending order by their address) which can hold `length` bytes is chosen. If there are more than `length` bytes in the s...
[ "def", "get_max_sinkhole", "(", "self", ",", "length", ")", ":", "ordered_sinks", "=", "sorted", "(", "list", "(", "self", ".", "sinkholes", ")", ",", "key", "=", "operator", ".", "itemgetter", "(", "0", ")", ",", "reverse", "=", "True", ")", "max_pair...
Find a sinkhole which is large enough to support `length` bytes. This uses first-fit. The first sinkhole (ordered in descending order by their address) which can hold `length` bytes is chosen. If there are more than `length` bytes in the sinkhole, a new sinkhole is created representing the rema...
[ "Find", "a", "sinkhole", "which", "is", "large", "enough", "to", "support", "length", "bytes", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/cgc.py#L101-L130
train
angr/angr
angr/state_plugins/plugin.py
SimStatePlugin.memo
def memo(f): """ A decorator function you should apply to ``copy`` """ def inner(self, memo=None, **kwargs): if memo is None: memo = {} if id(self) in memo: return memo[id(self)] else: c = f(self, memo, *...
python
def memo(f): """ A decorator function you should apply to ``copy`` """ def inner(self, memo=None, **kwargs): if memo is None: memo = {} if id(self) in memo: return memo[id(self)] else: c = f(self, memo, *...
[ "def", "memo", "(", "f", ")", ":", "def", "inner", "(", "self", ",", "memo", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "memo", "is", "None", ":", "memo", "=", "{", "}", "if", "id", "(", "self", ")", "in", "memo", ":", "return", ...
A decorator function you should apply to ``copy``
[ "A", "decorator", "function", "you", "should", "apply", "to", "copy" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/plugin.py#L48-L61
train
angr/angr
angr/analyses/vfg.py
VFGNode.append_state
def append_state(self, s, is_widened_state=False): """ Appended a new state to this VFGNode. :param s: The new state to append :param is_widened_state: Whether it is a widened state or not. """ if not is_widened_state: self.all_states.append(s) se...
python
def append_state(self, s, is_widened_state=False): """ Appended a new state to this VFGNode. :param s: The new state to append :param is_widened_state: Whether it is a widened state or not. """ if not is_widened_state: self.all_states.append(s) se...
[ "def", "append_state", "(", "self", ",", "s", ",", "is_widened_state", "=", "False", ")", ":", "if", "not", "is_widened_state", ":", "self", ".", "all_states", ".", "append", "(", "s", ")", "self", ".", "state", "=", "s", "else", ":", "self", ".", "w...
Appended a new state to this VFGNode. :param s: The new state to append :param is_widened_state: Whether it is a widened state or not.
[ "Appended", "a", "new", "state", "to", "this", "VFGNode", ".", ":", "param", "s", ":", "The", "new", "state", "to", "append", ":", "param", "is_widened_state", ":", "Whether", "it", "is", "a", "widened", "state", "or", "not", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L222-L234
train
angr/angr
angr/analyses/vfg.py
VFG._top_function_analysis_task
def _top_function_analysis_task(self): """ Get the first FunctionAnalysis task in the stack. :return: The top function analysis task in the stack, or None if there isn't any. :rtype: FunctionAnalysis """ for r in reversed(self._task_stack): if isinstance(r, ...
python
def _top_function_analysis_task(self): """ Get the first FunctionAnalysis task in the stack. :return: The top function analysis task in the stack, or None if there isn't any. :rtype: FunctionAnalysis """ for r in reversed(self._task_stack): if isinstance(r, ...
[ "def", "_top_function_analysis_task", "(", "self", ")", ":", "for", "r", "in", "reversed", "(", "self", ".", "_task_stack", ")", ":", "if", "isinstance", "(", "r", ",", "FunctionAnalysis", ")", ":", "return", "r", "return", "None" ]
Get the first FunctionAnalysis task in the stack. :return: The top function analysis task in the stack, or None if there isn't any. :rtype: FunctionAnalysis
[ "Get", "the", "first", "FunctionAnalysis", "task", "in", "the", "stack", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L384-L395
train
angr/angr
angr/analyses/vfg.py
VFG.get_any_node
def get_any_node(self, addr): """ Get any VFG node corresponding to the basic block at @addr. Note that depending on the context sensitivity level, there might be multiple nodes corresponding to different contexts. This function will return the first one it encounters, which migh...
python
def get_any_node(self, addr): """ Get any VFG node corresponding to the basic block at @addr. Note that depending on the context sensitivity level, there might be multiple nodes corresponding to different contexts. This function will return the first one it encounters, which migh...
[ "def", "get_any_node", "(", "self", ",", "addr", ")", ":", "for", "n", "in", "self", ".", "graph", ".", "nodes", "(", ")", ":", "if", "n", ".", "addr", "==", "addr", ":", "return", "n" ]
Get any VFG node corresponding to the basic block at @addr. Note that depending on the context sensitivity level, there might be multiple nodes corresponding to different contexts. This function will return the first one it encounters, which might not be what you want.
[ "Get", "any", "VFG", "node", "corresponding", "to", "the", "basic", "block", "at" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L409-L418
train
angr/angr
angr/analyses/vfg.py
VFG._pre_analysis
def _pre_analysis(self): """ Executed before analysis starts. Necessary initializations are performed here. :return: None """ l.debug("Starting from %#x", self._start) # initialize the task stack self._task_stack = [ ] # initialize the execution counte...
python
def _pre_analysis(self): """ Executed before analysis starts. Necessary initializations are performed here. :return: None """ l.debug("Starting from %#x", self._start) # initialize the task stack self._task_stack = [ ] # initialize the execution counte...
[ "def", "_pre_analysis", "(", "self", ")", ":", "l", ".", "debug", "(", "\"Starting from %#x\"", ",", "self", ".", "_start", ")", "# initialize the task stack", "self", ".", "_task_stack", "=", "[", "]", "# initialize the execution counter dict", "self", ".", "_exe...
Executed before analysis starts. Necessary initializations are performed here. :return: None
[ "Executed", "before", "analysis", "starts", ".", "Necessary", "initializations", "are", "performed", "here", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L446-L511
train
angr/angr
angr/analyses/vfg.py
VFG._job_sorting_key
def _job_sorting_key(self, job): """ Get the sorting key of a VFGJob instance. :param VFGJob job: the VFGJob object. :return: An integer that determines the order of this job in the queue. :rtype: int """ MAX_BLOCKS_PER_FUNCTION = 1000000 task_functions...
python
def _job_sorting_key(self, job): """ Get the sorting key of a VFGJob instance. :param VFGJob job: the VFGJob object. :return: An integer that determines the order of this job in the queue. :rtype: int """ MAX_BLOCKS_PER_FUNCTION = 1000000 task_functions...
[ "def", "_job_sorting_key", "(", "self", ",", "job", ")", ":", "MAX_BLOCKS_PER_FUNCTION", "=", "1000000", "task_functions", "=", "list", "(", "reversed", "(", "list", "(", "task", ".", "function_address", "for", "task", "in", "self", ".", "_task_stack", "if", ...
Get the sorting key of a VFGJob instance. :param VFGJob job: the VFGJob object. :return: An integer that determines the order of this job in the queue. :rtype: int
[ "Get", "the", "sorting", "key", "of", "a", "VFGJob", "instance", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L513-L542
train
angr/angr
angr/analyses/vfg.py
VFG._pre_job_handling
def _pre_job_handling(self, job): """ Some code executed before actually processing the job. :param VFGJob job: the VFGJob object. :return: None """ # did we reach the final address? if self._final_address is not None and job.addr == self._final_address: ...
python
def _pre_job_handling(self, job): """ Some code executed before actually processing the job. :param VFGJob job: the VFGJob object. :return: None """ # did we reach the final address? if self._final_address is not None and job.addr == self._final_address: ...
[ "def", "_pre_job_handling", "(", "self", ",", "job", ")", ":", "# did we reach the final address?", "if", "self", ".", "_final_address", "is", "not", "None", "and", "job", ".", "addr", "==", "self", ".", "_final_address", ":", "# our analysis should be termianted he...
Some code executed before actually processing the job. :param VFGJob job: the VFGJob object. :return: None
[ "Some", "code", "executed", "before", "actually", "processing", "the", "job", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L557-L671
train
angr/angr
angr/analyses/vfg.py
VFG._handle_successor
def _handle_successor(self, job, successor, all_successors): """ Process each successor generated by the job, and return a new list of succeeding jobs. :param VFGJob job: The VFGJob instance. :param SimState successor: The succeeding state. :param list all_successors: A list of...
python
def _handle_successor(self, job, successor, all_successors): """ Process each successor generated by the job, and return a new list of succeeding jobs. :param VFGJob job: The VFGJob instance. :param SimState successor: The succeeding state. :param list all_successors: A list of...
[ "def", "_handle_successor", "(", "self", ",", "job", ",", "successor", ",", "all_successors", ")", ":", "# Initialize parameters", "addr", "=", "job", ".", "addr", "jumpkind", "=", "successor", ".", "history", ".", "jumpkind", "#", "# Get instruction pointer", "...
Process each successor generated by the job, and return a new list of succeeding jobs. :param VFGJob job: The VFGJob instance. :param SimState successor: The succeeding state. :param list all_successors: A list of all successors. :return: A list of newly created jobs from the successor...
[ "Process", "each", "successor", "generated", "by", "the", "job", "and", "return", "a", "new", "list", "of", "succeeding", "jobs", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L729-L864
train
angr/angr
angr/analyses/vfg.py
VFG._handle_successor_multitargets
def _handle_successor_multitargets(self, job, successor, all_successors): """ Generate new jobs for all possible successor targets when there are more than one possible concrete value for successor.ip :param VFGJob job: The VFGJob instance. :param SimState successor: The succeed...
python
def _handle_successor_multitargets(self, job, successor, all_successors): """ Generate new jobs for all possible successor targets when there are more than one possible concrete value for successor.ip :param VFGJob job: The VFGJob instance. :param SimState successor: The succeed...
[ "def", "_handle_successor_multitargets", "(", "self", ",", "job", ",", "successor", ",", "all_successors", ")", ":", "new_jobs", "=", "[", "]", "# Currently we assume a legit jumping target cannot have more than 256 concrete values", "# TODO: make it a setting on VFG", "MAX_NUMBE...
Generate new jobs for all possible successor targets when there are more than one possible concrete value for successor.ip :param VFGJob job: The VFGJob instance. :param SimState successor: The succeeding state. :param list all_successors: All succeeding states from the same VFGJob. ...
[ "Generate", "new", "jobs", "for", "all", "possible", "successor", "targets", "when", "there", "are", "more", "than", "one", "possible", "concrete", "value", "for", "successor", ".", "ip" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L866-L912
train
angr/angr
angr/analyses/vfg.py
VFG._merge_states
def _merge_states(self, old_state, new_state): """ Merge two given states, and return a new one. :param old_state: :param new_state: :returns: The merged state, and whether a merging has occurred """ # print old_state.dbg_print_stack() # print new_state....
python
def _merge_states(self, old_state, new_state): """ Merge two given states, and return a new one. :param old_state: :param new_state: :returns: The merged state, and whether a merging has occurred """ # print old_state.dbg_print_stack() # print new_state....
[ "def", "_merge_states", "(", "self", ",", "old_state", ",", "new_state", ")", ":", "# print old_state.dbg_print_stack()", "# print new_state.dbg_print_stack()", "merged_state", ",", "_", ",", "merging_occurred", "=", "old_state", ".", "merge", "(", "new_state", ",", "...
Merge two given states, and return a new one. :param old_state: :param new_state: :returns: The merged state, and whether a merging has occurred
[ "Merge", "two", "given", "states", "and", "return", "a", "new", "one", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L1088-L1105
train
angr/angr
angr/analyses/vfg.py
VFG._widen_states
def _widen_states(old_state, new_state): """ Perform widen operation on the given states, and return a new one. :param old_state: :param new_state: :returns: The widened state, and whether widening has occurred """ # print old_state.dbg_print_stack() # p...
python
def _widen_states(old_state, new_state): """ Perform widen operation on the given states, and return a new one. :param old_state: :param new_state: :returns: The widened state, and whether widening has occurred """ # print old_state.dbg_print_stack() # p...
[ "def", "_widen_states", "(", "old_state", ",", "new_state", ")", ":", "# print old_state.dbg_print_stack()", "# print new_state.dbg_print_stack()", "l", ".", "debug", "(", "'Widening state at IP %s'", ",", "old_state", ".", "ip", ")", "widened_state", ",", "widening_occur...
Perform widen operation on the given states, and return a new one. :param old_state: :param new_state: :returns: The widened state, and whether widening has occurred
[ "Perform", "widen", "operation", "on", "the", "given", "states", "and", "return", "a", "new", "one", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L1108-L1127
train
angr/angr
angr/analyses/vfg.py
VFG._narrow_states
def _narrow_states(node, old_state, new_state, previously_widened_state): # pylint:disable=unused-argument,no-self-use """ Try to narrow the state! :param old_state: :param new_state: :param previously_widened_state: :returns: The narrowed state, and whether a narrowing...
python
def _narrow_states(node, old_state, new_state, previously_widened_state): # pylint:disable=unused-argument,no-self-use """ Try to narrow the state! :param old_state: :param new_state: :param previously_widened_state: :returns: The narrowed state, and whether a narrowing...
[ "def", "_narrow_states", "(", "node", ",", "old_state", ",", "new_state", ",", "previously_widened_state", ")", ":", "# pylint:disable=unused-argument,no-self-use", "l", ".", "debug", "(", "'Narrowing state at IP %s'", ",", "previously_widened_state", ".", "ip", ")", "s...
Try to narrow the state! :param old_state: :param new_state: :param previously_widened_state: :returns: The narrowed state, and whether a narrowing has occurred
[ "Try", "to", "narrow", "the", "state!" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L1130-L1148
train
angr/angr
angr/analyses/vfg.py
VFG._prepare_initial_state
def _prepare_initial_state(self, function_start, state): """ Get the state to start the analysis for function. :param int function_start: Address of the function :param SimState state: The program state to base on. """ if state is None: state = self.project....
python
def _prepare_initial_state(self, function_start, state): """ Get the state to start the analysis for function. :param int function_start: Address of the function :param SimState state: The program state to base on. """ if state is None: state = self.project....
[ "def", "_prepare_initial_state", "(", "self", ",", "function_start", ",", "state", ")", ":", "if", "state", "is", "None", ":", "state", "=", "self", ".", "project", ".", "factory", ".", "blank_state", "(", "mode", "=", "\"static\"", ",", "remove_options", ...
Get the state to start the analysis for function. :param int function_start: Address of the function :param SimState state: The program state to base on.
[ "Get", "the", "state", "to", "start", "the", "analysis", "for", "function", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L1154-L1185
train
angr/angr
angr/analyses/vfg.py
VFG._set_return_address
def _set_return_address(self, state, ret_addr): """ Set the return address of the current state to a specific address. We assume we are at the beginning of a function, or in other words, we are about to execute the very first instruction of the function. :param SimState state: The progr...
python
def _set_return_address(self, state, ret_addr): """ Set the return address of the current state to a specific address. We assume we are at the beginning of a function, or in other words, we are about to execute the very first instruction of the function. :param SimState state: The progr...
[ "def", "_set_return_address", "(", "self", ",", "state", ",", "ret_addr", ")", ":", "# TODO: the following code is totally untested other than X86 and AMD64. Don't freak out if you find bugs :)", "# TODO: Test it", "ret_bvv", "=", "state", ".", "solver", ".", "BVV", "(", "ret...
Set the return address of the current state to a specific address. We assume we are at the beginning of a function, or in other words, we are about to execute the very first instruction of the function. :param SimState state: The program state :param int ret_addr: The return address :re...
[ "Set", "the", "return", "address", "of", "the", "current", "state", "to", "a", "specific", "address", ".", "We", "assume", "we", "are", "at", "the", "beginning", "of", "a", "function", "or", "in", "other", "words", "we", "are", "about", "to", "execute", ...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L1187-L1213
train
angr/angr
angr/analyses/vfg.py
VFG._create_graph
def _create_graph(self, return_target_sources=None): """ Create a DiGraph out of the existing edge map. :param return_target_sources: Used for making up those missing returns :returns: A networkx.DiGraph() object """ if return_target_sources is None: # We set ...
python
def _create_graph(self, return_target_sources=None): """ Create a DiGraph out of the existing edge map. :param return_target_sources: Used for making up those missing returns :returns: A networkx.DiGraph() object """ if return_target_sources is None: # We set ...
[ "def", "_create_graph", "(", "self", ",", "return_target_sources", "=", "None", ")", ":", "if", "return_target_sources", "is", "None", ":", "# We set it to a defaultdict in order to be consistent with the", "# actual parameter.", "return_target_sources", "=", "defaultdict", "...
Create a DiGraph out of the existing edge map. :param return_target_sources: Used for making up those missing returns :returns: A networkx.DiGraph() object
[ "Create", "a", "DiGraph", "out", "of", "the", "existing", "edge", "map", ".", ":", "param", "return_target_sources", ":", "Used", "for", "making", "up", "those", "missing", "returns", ":", "returns", ":", "A", "networkx", ".", "DiGraph", "()", "object" ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L1215-L1259
train
angr/angr
angr/analyses/vfg.py
VFG._graph_get_node
def _graph_get_node(self, block_id, terminator_for_nonexistent_node=False): """ Get an existing VFGNode instance from the graph. :param BlockID block_id: The block ID for the node to get. :param bool terminator_for_nonexistent_node: True if a Terminator (which is a S...
python
def _graph_get_node(self, block_id, terminator_for_nonexistent_node=False): """ Get an existing VFGNode instance from the graph. :param BlockID block_id: The block ID for the node to get. :param bool terminator_for_nonexistent_node: True if a Terminator (which is a S...
[ "def", "_graph_get_node", "(", "self", ",", "block_id", ",", "terminator_for_nonexistent_node", "=", "False", ")", ":", "if", "block_id", "not", "in", "self", ".", "_nodes", ":", "l", ".", "error", "(", "\"Trying to look up a node that we don't have yet. Is this okay?...
Get an existing VFGNode instance from the graph. :param BlockID block_id: The block ID for the node to get. :param bool terminator_for_nonexistent_node: True if a Terminator (which is a SimProcedure stub) should be created when th...
[ "Get", "an", "existing", "VFGNode", "instance", "from", "the", "graph", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L1265-L1301
train
angr/angr
angr/analyses/vfg.py
VFG._graph_add_edge
def _graph_add_edge(self, src_block_id, dst_block_id, **kwargs): """ Add an edge onto the graph. :param BlockID src_block_id: The block ID for source node. :param BlockID dst_block_id: The block Id for destination node. :param str jumpkind: The jumpkind of the edge. ...
python
def _graph_add_edge(self, src_block_id, dst_block_id, **kwargs): """ Add an edge onto the graph. :param BlockID src_block_id: The block ID for source node. :param BlockID dst_block_id: The block Id for destination node. :param str jumpkind: The jumpkind of the edge. ...
[ "def", "_graph_add_edge", "(", "self", ",", "src_block_id", ",", "dst_block_id", ",", "*", "*", "kwargs", ")", ":", "dst_node", "=", "self", ".", "_graph_get_node", "(", "dst_block_id", ",", "terminator_for_nonexistent_node", "=", "True", ")", "if", "src_block_i...
Add an edge onto the graph. :param BlockID src_block_id: The block ID for source node. :param BlockID dst_block_id: The block Id for destination node. :param str jumpkind: The jumpkind of the edge. :param exit_stmt_idx: ID of the statement in the source IRSB where this ed...
[ "Add", "an", "edge", "onto", "the", "graph", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L1303-L1322
train
angr/angr
angr/analyses/vfg.py
VFG._create_new_jobs
def _create_new_jobs(self, job, successor, new_block_id, new_call_stack): """ Create a list of new VFG jobs for the successor state. :param VFGJob job: The VFGJob instance. :param SimState successor: The succeeding state. :param BlockID new_block_id: Block ...
python
def _create_new_jobs(self, job, successor, new_block_id, new_call_stack): """ Create a list of new VFG jobs for the successor state. :param VFGJob job: The VFGJob instance. :param SimState successor: The succeeding state. :param BlockID new_block_id: Block ...
[ "def", "_create_new_jobs", "(", "self", ",", "job", ",", "successor", ",", "new_block_id", ",", "new_call_stack", ")", ":", "# TODO: basic block stack is probably useless", "jumpkind", "=", "successor", ".", "history", ".", "jumpkind", "stmt_idx", "=", "successor", ...
Create a list of new VFG jobs for the successor state. :param VFGJob job: The VFGJob instance. :param SimState successor: The succeeding state. :param BlockID new_block_id: Block ID for the new VFGJob :param new_call_stack: The new callstack. :r...
[ "Create", "a", "list", "of", "new", "VFG", "jobs", "for", "the", "successor", "state", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L1375-L1535
train
angr/angr
angr/analyses/vfg.py
VFG._remove_pending_return
def _remove_pending_return(self, job, pending_returns): """ Remove all pending returns that are related to the current job. """ # Build the tuples that we want to remove from the dict fake_func_retn_exits tpls_to_remove = [ ] call_stack_copy = job.call_stack_copy() ...
python
def _remove_pending_return(self, job, pending_returns): """ Remove all pending returns that are related to the current job. """ # Build the tuples that we want to remove from the dict fake_func_retn_exits tpls_to_remove = [ ] call_stack_copy = job.call_stack_copy() ...
[ "def", "_remove_pending_return", "(", "self", ",", "job", ",", "pending_returns", ")", ":", "# Build the tuples that we want to remove from the dict fake_func_retn_exits", "tpls_to_remove", "=", "[", "]", "call_stack_copy", "=", "job", ".", "call_stack_copy", "(", ")", "w...
Remove all pending returns that are related to the current job.
[ "Remove", "all", "pending", "returns", "that", "are", "related", "to", "the", "current", "job", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L1537-L1558
train
angr/angr
angr/analyses/vfg.py
VFG._post_job_handling_debug
def _post_job_handling_debug(self, job, successors): """ Print out debugging information after handling a VFGJob and generating the succeeding jobs. :param VFGJob job: The VFGJob instance. :param list successors: A list of succeeding states. :return: None """ fu...
python
def _post_job_handling_debug(self, job, successors): """ Print out debugging information after handling a VFGJob and generating the succeeding jobs. :param VFGJob job: The VFGJob instance. :param list successors: A list of succeeding states. :return: None """ fu...
[ "def", "_post_job_handling_debug", "(", "self", ",", "job", ",", "successors", ")", ":", "func", "=", "self", ".", "project", ".", "loader", ".", "find_symbol", "(", "job", ".", "addr", ")", "function_name", "=", "func", ".", "name", "if", "func", "is", ...
Print out debugging information after handling a VFGJob and generating the succeeding jobs. :param VFGJob job: The VFGJob instance. :param list successors: A list of succeeding states. :return: None
[ "Print", "out", "debugging", "information", "after", "handling", "a", "VFGJob", "and", "generating", "the", "succeeding", "jobs", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L1560-L1590
train
angr/angr
angr/analyses/vfg.py
VFG._save_function_initial_state
def _save_function_initial_state(self, function_key, function_address, state): """ Save the initial state of a function, and merge it with existing ones if there are any. :param FunctionKey function_key: The key to this function. :param int function_address: Address of the function. ...
python
def _save_function_initial_state(self, function_key, function_address, state): """ Save the initial state of a function, and merge it with existing ones if there are any. :param FunctionKey function_key: The key to this function. :param int function_address: Address of the function. ...
[ "def", "_save_function_initial_state", "(", "self", ",", "function_key", ",", "function_address", ",", "state", ")", ":", "l", ".", "debug", "(", "'Saving the initial state for function %#08x with function key %s'", ",", "function_address", ",", "function_key", ")", "if",...
Save the initial state of a function, and merge it with existing ones if there are any. :param FunctionKey function_key: The key to this function. :param int function_address: Address of the function. :param SimState state: Initial state of the function. :return: None
[ "Save", "the", "initial", "state", "of", "a", "function", "and", "merge", "it", "with", "existing", "ones", "if", "there", "are", "any", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L1660-L1680
train
angr/angr
angr/analyses/vfg.py
VFG._save_function_final_state
def _save_function_final_state(self, function_key, function_address, state): """ Save the final state of a function, and merge it with existing ones if there are any. :param FunctionKey function_key: The key to this function. :param int function_address: Address of the function. ...
python
def _save_function_final_state(self, function_key, function_address, state): """ Save the final state of a function, and merge it with existing ones if there are any. :param FunctionKey function_key: The key to this function. :param int function_address: Address of the function. ...
[ "def", "_save_function_final_state", "(", "self", ",", "function_key", ",", "function_address", ",", "state", ")", ":", "l", ".", "debug", "(", "'Saving the final state for function %#08x with function key %s'", ",", "function_address", ",", "function_key", ")", "if", "...
Save the final state of a function, and merge it with existing ones if there are any. :param FunctionKey function_key: The key to this function. :param int function_address: Address of the function. :param SimState state: Initial state of the function. :return: None
[ "Save", "the", "final", "state", "of", "a", "function", "and", "merge", "it", "with", "existing", "ones", "if", "there", "are", "any", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L1682-L1703
train
angr/angr
angr/analyses/vfg.py
VFG._get_nx_paths
def _get_nx_paths(self, begin, end): """ Get the possible (networkx) simple paths between two nodes or addresses corresponding to nodes. Input: addresses or node instances Return: a list of lists of nodes representing paths. """ if type(begin) is int and type(end)...
python
def _get_nx_paths(self, begin, end): """ Get the possible (networkx) simple paths between two nodes or addresses corresponding to nodes. Input: addresses or node instances Return: a list of lists of nodes representing paths. """ if type(begin) is int and type(end)...
[ "def", "_get_nx_paths", "(", "self", ",", "begin", ",", "end", ")", ":", "if", "type", "(", "begin", ")", "is", "int", "and", "type", "(", "end", ")", "is", "int", ":", "# pylint:disable=unidiomatic-typecheck", "n_begin", "=", "self", ".", "get_any_node", ...
Get the possible (networkx) simple paths between two nodes or addresses corresponding to nodes. Input: addresses or node instances Return: a list of lists of nodes representing paths.
[ "Get", "the", "possible", "(", "networkx", ")", "simple", "paths", "between", "two", "nodes", "or", "addresses", "corresponding", "to", "nodes", ".", "Input", ":", "addresses", "or", "node", "instances", "Return", ":", "a", "list", "of", "lists", "of", "no...
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L1746-L1763
train
angr/angr
angr/analyses/vfg.py
VFG._merge_points
def _merge_points(self, function_address): """ Return the ordered merge points for a specific function. :param int function_address: Address of the querying function. :return: A list of sorted merge points (addresses). :rtype: list """ # we are entering a new fu...
python
def _merge_points(self, function_address): """ Return the ordered merge points for a specific function. :param int function_address: Address of the querying function. :return: A list of sorted merge points (addresses). :rtype: list """ # we are entering a new fu...
[ "def", "_merge_points", "(", "self", ",", "function_address", ")", ":", "# we are entering a new function. now it's time to figure out how to optimally traverse the control flow", "# graph by generating the sorted merge points", "try", ":", "new_function", "=", "self", ".", "kb", "...
Return the ordered merge points for a specific function. :param int function_address: Address of the querying function. :return: A list of sorted merge points (addresses). :rtype: list
[ "Return", "the", "ordered", "merge", "points", "for", "a", "specific", "function", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L1765-L1787
train
angr/angr
angr/analyses/vfg.py
VFG._widening_points
def _widening_points(self, function_address): """ Return the ordered widening points for a specific function. :param int function_address: Address of the querying function. :return: A list of sorted merge points (addresses). :rtype: list """ # we are entering a ...
python
def _widening_points(self, function_address): """ Return the ordered widening points for a specific function. :param int function_address: Address of the querying function. :return: A list of sorted merge points (addresses). :rtype: list """ # we are entering a ...
[ "def", "_widening_points", "(", "self", ",", "function_address", ")", ":", "# we are entering a new function. now it's time to figure out how to optimally traverse the control flow", "# graph by generating the sorted merge points", "try", ":", "new_function", "=", "self", ".", "kb", ...
Return the ordered widening points for a specific function. :param int function_address: Address of the querying function. :return: A list of sorted merge points (addresses). :rtype: list
[ "Return", "the", "ordered", "widening", "points", "for", "a", "specific", "function", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L1789-L1813
train
angr/angr
angr/analyses/vfg.py
VFG._ordered_node_addrs
def _ordered_node_addrs(self, function_address): """ For a given function, return all nodes in an optimal traversal order. If the function does not exist, return an empty list. :param int function_address: Address of the function. :return: A ordered list of the nodes. :r...
python
def _ordered_node_addrs(self, function_address): """ For a given function, return all nodes in an optimal traversal order. If the function does not exist, return an empty list. :param int function_address: Address of the function. :return: A ordered list of the nodes. :r...
[ "def", "_ordered_node_addrs", "(", "self", ",", "function_address", ")", ":", "try", ":", "function", "=", "self", ".", "kb", ".", "functions", "[", "function_address", "]", "except", "KeyError", ":", "# the function does not exist", "return", "[", "]", "if", ...
For a given function, return all nodes in an optimal traversal order. If the function does not exist, return an empty list. :param int function_address: Address of the function. :return: A ordered list of the nodes. :rtype: list
[ "For", "a", "given", "function", "return", "all", "nodes", "in", "an", "optimal", "traversal", "order", ".", "If", "the", "function", "does", "not", "exist", "return", "an", "empty", "list", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L1815-L1835
train
angr/angr
angr/state_plugins/uc_manager.py
SimUCManager.assign
def assign(self, dst_addr_ast): """ Assign a new region for under-constrained symbolic execution. :param dst_addr_ast: the symbolic AST which address of the new allocated region will be assigned to. :return: as ast of memory address that points to a new region """ if ds...
python
def assign(self, dst_addr_ast): """ Assign a new region for under-constrained symbolic execution. :param dst_addr_ast: the symbolic AST which address of the new allocated region will be assigned to. :return: as ast of memory address that points to a new region """ if ds...
[ "def", "assign", "(", "self", ",", "dst_addr_ast", ")", ":", "if", "dst_addr_ast", ".", "uc_alloc_depth", ">", "self", ".", "_max_alloc_depth", ":", "raise", "SimUCManagerAllocationError", "(", "'Current allocation depth %d is greater than the cap (%d)'", "%", "(", "dst...
Assign a new region for under-constrained symbolic execution. :param dst_addr_ast: the symbolic AST which address of the new allocated region will be assigned to. :return: as ast of memory address that points to a new region
[ "Assign", "a", "new", "region", "for", "under", "-", "constrained", "symbolic", "execution", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/uc_manager.py#L33-L52
train
angr/angr
angr/state_plugins/uc_manager.py
SimUCManager.is_bounded
def is_bounded(self, ast): """ Test whether an AST is bounded by any existing constraint in the related solver. :param ast: an claripy.AST object :return: True if there is at least one related constraint, False otherwise """ return len(ast.variables.intersection(self.st...
python
def is_bounded(self, ast): """ Test whether an AST is bounded by any existing constraint in the related solver. :param ast: an claripy.AST object :return: True if there is at least one related constraint, False otherwise """ return len(ast.variables.intersection(self.st...
[ "def", "is_bounded", "(", "self", ",", "ast", ")", ":", "return", "len", "(", "ast", ".", "variables", ".", "intersection", "(", "self", ".", "state", ".", "solver", ".", "_solver", ".", "variables", ")", ")", "!=", "0" ]
Test whether an AST is bounded by any existing constraint in the related solver. :param ast: an claripy.AST object :return: True if there is at least one related constraint, False otherwise
[ "Test", "whether", "an", "AST", "is", "bounded", "by", "any", "existing", "constraint", "in", "the", "related", "solver", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/uc_manager.py#L66-L74
train
angr/angr
angr/analyses/cfg/indirect_jump_resolvers/mips_elf_fast.py
MipsElfFastResolver.resolve
def resolve(self, cfg, addr, func_addr, block, jumpkind): """ Resolves the indirect jump in MIPS ELF binaries where all external function calls are indexed using gp. :param cfg: A CFG instance. :param int addr: IRSB address. :param int func_addr: The function address. :p...
python
def resolve(self, cfg, addr, func_addr, block, jumpkind): """ Resolves the indirect jump in MIPS ELF binaries where all external function calls are indexed using gp. :param cfg: A CFG instance. :param int addr: IRSB address. :param int func_addr: The function address. :p...
[ "def", "resolve", "(", "self", ",", "cfg", ",", "addr", ",", "func_addr", ",", "block", ",", "jumpkind", ")", ":", "project", "=", "self", ".", "project", "b", "=", "Blade", "(", "cfg", ".", "graph", ",", "addr", ",", "-", "1", ",", "cfg", "=", ...
Resolves the indirect jump in MIPS ELF binaries where all external function calls are indexed using gp. :param cfg: A CFG instance. :param int addr: IRSB address. :param int func_addr: The function address. :param pyvex.IRSB block: The IRSB. :param str jumpkind: The jumpkind. ...
[ "Resolves", "the", "indirect", "jump", "in", "MIPS", "ELF", "binaries", "where", "all", "external", "function", "calls", "are", "indexed", "using", "gp", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/indirect_jump_resolvers/mips_elf_fast.py#L28-L110
train
angr/angr
angr/engines/hook.py
SimEngineHook.process
def process(self, state, procedure=None, force_addr=None, **kwargs): """ Perform execution with a state. :param state: The state with which to execute :param procedure: An instance of a SimProcedure to run, optional :param ret_to: The address to return to when this ...
python
def process(self, state, procedure=None, force_addr=None, **kwargs): """ Perform execution with a state. :param state: The state with which to execute :param procedure: An instance of a SimProcedure to run, optional :param ret_to: The address to return to when this ...
[ "def", "process", "(", "self", ",", "state", ",", "procedure", "=", "None", ",", "force_addr", "=", "None", ",", "*", "*", "kwargs", ")", ":", "addr", "=", "state", ".", "addr", "if", "force_addr", "is", "None", "else", "force_addr", "if", "procedure",...
Perform execution with a state. :param state: The state with which to execute :param procedure: An instance of a SimProcedure to run, optional :param ret_to: The address to return to when this procedure is finished :param inline: This is an inline execution. Do not bot...
[ "Perform", "execution", "with", "a", "state", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/hook.py#L29-L55
train
angr/angr
angr/sim_state_options.py
SimStateOptions.difference
def difference(self, boolean_switches): """ [COMPATIBILITY] Make a copy of the current instance, and then discard all options that are in boolean_switches. :param set boolean_switches: A collection of Boolean switches to disable. :return: A new SimState...
python
def difference(self, boolean_switches): """ [COMPATIBILITY] Make a copy of the current instance, and then discard all options that are in boolean_switches. :param set boolean_switches: A collection of Boolean switches to disable. :return: A new SimState...
[ "def", "difference", "(", "self", ",", "boolean_switches", ")", ":", "ops", "=", "SimStateOptions", "(", "self", ")", "for", "key", "in", "boolean_switches", ":", "ops", ".", "discard", "(", "key", ")", "return", "ops" ]
[COMPATIBILITY] Make a copy of the current instance, and then discard all options that are in boolean_switches. :param set boolean_switches: A collection of Boolean switches to disable. :return: A new SimStateOptions instance.
[ "[", "COMPATIBILITY", "]", "Make", "a", "copy", "of", "the", "current", "instance", "and", "then", "discard", "all", "options", "that", "are", "in", "boolean_switches", "." ]
4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_state_options.py#L317-L329
train