Functions¶
Functions¶
-
class
revenge.functions.
Functions
(process)[source]¶ Bases:
object
Represents functions.
Examples
# This is meant to be used like a dictionary # Lookup MemoryBlock for function main main = functions["main"] # Lookup what function an address belongs to assert functions[main.address] == b"main" # Add function info functions["func1"] = process.memory[<func1 range here>] # Loop through function names for name in functions: pass # Print out functions as table print(functions) # Check if a function name exists assert "main" in functions # Check if an address belongs to one of the known functions assert 0x12345 in functions # Not sure why you'd want to do this, but you can functions[0x1000:0x2000] = "some_function"
-
lookup_address
(address)[source]¶ Lookup a function based on address.
- Parameters
address (int, MemoryBytes) – Address to lookup
- Returns
Name of function or None
- Return type
bytes
Examples
functions.lookup_address(0x12345) == b"some_function"
-
lookup_name
(name)[source]¶ Lookup MemoryBytes for a given name.
- Parameters
name (str, bytes) – Name of function
- Returns
Corresponding MemoryBytes object or None.
- Return type
Examples
main = functions.lookup_name("main")
-
set_function
(name, memory_bytes)[source]¶ Adds a function entry. Usually not done manually…
- Parameters
name (str, bytes) – Name of function
memory_bytes (MemoryBytes) – MemoryBytes for function
-