pyplugins.apis.signals module

Signals Plugin (signals.py) for Penguin

This module provides the Signals plugin for the Penguin framework, enabling the triggering of core dumps, crash snapshots, and custom signals in the guest OS via the hypervisor portal. It is useful for debugging, analysis, and automation of guest process state.

Features

  • Trigger a full snapshot and core dump in the guest.

  • Send SIGABRT or custom signals to the current process in the guest.

  • Coroutine-based API for integration with other Penguin plugins.

Example Usage

from penguin import plugins

# Trigger a full snapshot and core dump
pid = yield from plugins.signals.crash_snapshot()

# Send SIGABRT to the current process
pid = yield from plugins.signals.self_abort()

# Send a custom signal
pid = yield from plugins.signals.self_signal("SIGTERM")
class pyplugins.apis.signals.Signals[source]

Bases: Plugin

Signals Plugin

Provides methods to trigger core dumps, crash snapshots, and send signals to guest processes via the hypervisor portal.

crash_snapshot()[source]

Create a snapshot and core dump in the guest (default dump mode).

Returns

Optional[int]

PID of the process that received the signal, or error code, or None on failure.

Return type:

Generator[Any, None, int | None]

dump(mode=0, signal=0)[source]

Trigger a core dump or signal in the guest.

Parameters

modeint, optional

Dump mode (0=full snapshot and coredump, 1=self abort, 2=custom signal). Default is 0.

signalint, optional

Signal number to send (only used with mode=2). Default is 0.

Returns

Optional[int]

PID of the process that received the signal, or error code, or None on failure.

Parameters:
  • mode (int)

  • signal (int)

Return type:

Generator[Any, None, int | None]

self_abort()[source]

Send SIGABRT to the current process in the guest.

Returns

Optional[int]

PID of the process that received SIGABRT, or error code, or None on failure.

Return type:

Generator[Any, None, int | None]

self_signal(signal)[source]

Send a custom signal to the current process in the guest.

Parameters

signalint

Signal number (1-31) or name to send.

Returns

Optional[int]

PID of the process that received the signal, or error code, or None on failure.

Raises

ValueError

If the signal number is not between 1 and 31 or the signal name is unrecognized.

Parameters:

signal (int | str)

Return type:

Generator[Any, None, int | None]

signal_name_to_num(name)[source]
Parameters:

name (str)

Return type:

int | None