Handles

class revenge.plugins.handles.Handles(process)[source]

Bases: revenge.plugins.Plugin

Manage process handles.

Examples

# Grab a specific handle
handle = process.handles[4]

# Print out details about handles
print(process.handles)
values()[source]
class revenge.plugins.handles.Handle(process, handle, name=None)[source]

Bases: object

Describes a handle.

Parameters
  • process (revenge.Process) – Corresponding process.

  • handle (int) – The handle identifier.

  • name (str, optional) – File backing this handle.

Examples

handle = process.handles[4]

# What file/pipe/thing is this a handle to?
print(handle.name)

# Read 32 bytes from the beginning of the handle
stuff = handle.read(32, 0)

# Read 16 bytes from the current pointer
stuff = handle.read(16)

# Write something to the handle
handle.write(b"something")

# Write something to the handle at offset 4
handle.write(b"something", 4)

# Check the read/write ability on this handle
handle.readable
handle.writable
property handle

The actual handle identifier. This is what the OS uses to identify the handle.

Type

int

property name

Name or path to file backing this handle.

Type

str

property position

Current position in this handle.

Type

int

read(n, position=None)[source]

Reads n bytes, optionally from a given position.

Parameters
  • n (int) – How many bytes to read?

  • position (int, optional) – Where to read from? Absolute.

Returns

Data read from fd or None if there was an error

Return type

bytes

When given position argument, this call will return the fd to it’s original position after reading.

property readable

Is this handle readable?

Type

bool

property writable

Is this handle writable?

Type

bool

write(thing, position=None)[source]

Writes thing into the handle, optionally from a given position.

Parameters
  • thing (str, bytes) – What to write

  • position (int, optional) – Where to write from? Absolute.

Returns

Number of bytes written.

Return type

int