Threads

Threads

Threads class object is what you get when you request Process.threads.

class revenge.threads.Threads(process)[source]

Bases: object

create(callback)[source]

Create and start a new thread on the given callback.

Parameters

callback – Pointer to function to start the thread on. This can be created via CModule, NativeCallback or use an existing function in the binary

Returns

The new thread that was created or None if either the thread create failed or the thread finished before this method returned.

Return type

revenge.threads.Thread

Example

# Create a stupid callback that just spins
func = process.memory.create_c_function("void func() { while ( 1 ) { ; } }")

# Start the thread
t = process.threads.create(func.address)
assert isinstance(t, revenge.threads.thread.Thread)

# View it running
print(process.threads)

# Grab the return value (in this case the thread won't end though)
return_val = t.join()
property threads

Current snapshop of active threads.

Thread

The Thread class is an actual description of the thread itself.

class revenge.threads.Thread(process, info)[source]

Bases: object

property id

Thread ID

Return type

int

join()[source]

Traditional thread join. Wait for thread to exit and return the thread’s return value.

property module

What module is the thread’s program counter in? i.e.: libc-2.27.so.

Return type

str

property pc

The current program counter/instruction pointer.

Return type

int

property state

Thread state, such as ‘waiting’, ‘suspended’

Return type

str

property trace

Returns Trace object if this thread is currently being traced, otherwise None.

Type

revenge.tracer.instruction_tracer.Trace