Process¶
-
class
revenge.process.
Process
(target, resume=False, verbose=False, load_symbols=None, envp=None, engine=None, ignore_exceptions=False)[source]¶ Bases:
object
Represents a process.
- Args:
- target (str, int, list): File name or pid to attach to. If target
is a list, it will be set as argv.
resume (bool, optional): Resume the binary if need be after loading? verbose (bool, optional): Enable verbose logging load_symbols (list, optional): Only load symbols from those modules
in the list. Saves some startup time. Can use glob (‘libc*’)
- envp (dict, optional): Specify what you want the environment
pointer list to look like. Defaults to whatever the current envp is.
- engine (revenge.engines.Engine): Instantiated Engine for this
process
- ignore_exceptions (bool): Should we not attempt to generically
catch process exceptions? Default is False.
- Examples:
# Kick off ls p = revenge.Process("/bin/ls") # Kick off ls for /tmp with custom environment p = revenge.Process(["/bin/ls","/tmp/"], envp={'var1':'thing1'}) # # Interaction # # Write to stdin p.stdin(b"hello
“)
# Read from stdout p.stdout(16)
# Read up to expected output in stdout p.stdout(“expected”)
# Interact like a shell p.interactive()
-
property
BatchContext
¶ Returns a BatchContext class for this process.
Example
with process.BatchContext() as context: something(context=context)
Represents a context used to send many commands to a frida script.
- Parameters
process (revenge.Process) – Process this batch is running under.
send_buffer_size (int, optional) – How big of a buffer to have before sending. (default: 1024)
return_buffer_size (int, optional) – How big of a buffer to have before returning (default: 1024) If -1, do not return anything.
on_message (callable, optional) – Callable to be called when we recieve information back. By default, returned information will be dropped.
run_script_generic (callable, optional) – Which run_script_generic to use for calling? (default: process.run_script_generic)
handler_pre (str, optional) – Something to optionally run before iterating over the strings provided.
handler_post (str, optional) – Something to optionally run after iterating over the strings provided.
Example
with process.BatchContext(): for i in range(255): do_something
This Context will simply queue up a bunch of strings, which will be fed into the thread and executed sequentially.
-
property
alive
¶ Is this process still alive?
- Type
bool
-
property
arch
¶ What architecture? (x64, ia32, arm, others?)
- Type
str
-
property
argv
¶ argv for this process instantitation.
- Type
list
-
property
bits
¶ How many bits is the CPU?
- Type
int
-
property
device
¶ What device is this process associated with?
-
property
device_platform
¶ Wrapper to discover the device’s platform.
-
property
endianness
¶ Determine which endianness this binary is. (little, big)
-
property
engine
¶ The current engine revenge is using.
-
property
entrypoint
¶ Returns the entrypoint for this running program.
- Type
int
-
property
file_name
¶ The base file name.
- Type
str
-
property
file_type
¶ Guesses the file type.
-
property
pid
¶
-
quit
()[source]¶ Call to quit your session without exiting. Do NOT continue to use this object after.
If you spawned the process, it will be killed. If you attached to the process, frida will be cleaned out, detatched, and the process should continue normally.
-
stderr
(n)[source]¶ Read n bytes from stderr.
- Parameters
n (int, str, bytes) – Number of bytes to read or string to expect. If no value is given, it’s presumed you are trying to read all currently queued output.
- Returns
Output of stderr
- Return type
bytes
-
stdin
(thing)[source]¶ Write thing to stdin.
- Parameters
thing (str, bytes) – If str, it will be encoded as latin-1.
Note: There’s no newline auto appended. Remember to add one if you want it.
-
stdout
(n)[source]¶ Read n bytes from stdout.
- Parameters
n (int, str, bytes) – Number of bytes to read or string to expect. If no value is given, it’s presumed you are trying to read all currently queued output.
- Returns
Output of stdout
- Return type
bytes
-
property
target
¶ Target for this session.
- Type
str, int
-
property
verbose
¶ Output extra debugging information.
- Type
bool