pyplugins.interventions.kernelversion module

Kernel Version Utilities

This module provides utilities for parsing, comparing, and representing Linux kernel version strings. It is intended to help plugins and scripts that need to reason about kernel versions in the Penguin framework or similar environments.

Features

  • Parse kernel version strings into structured objects

  • Compare kernel versions for ordering and equality

  • Convert kernel version objects back to string representation

Classes

  • KernelVersion: Represents a parsed kernel version and supports comparison.

class pyplugins.interventions.kernelversion.KernelVersion[source]

Bases: Plugin

Represents a Linux kernel version and supports comparison operations.

Attributes - outdir (Optional[str]): Output directory. - sysname (Optional[str]): System name. - nodename (Optional[str]): Node name. - release (Optional[str]): Kernel release string. - version (Optional[str]): Kernel version string. - machine (Optional[str]): Machine architecture. - domainname (Optional[str]): Domain name.

Example `python v = KernelVersion(5, 10, 0, "-rc1") `

change_uname(cpu, buf_ptr, filler)[source]

Event handler to change the uname string in the guest.

Args:

cpu (Any): The CPU context. buf_ptr (int): Pointer to the buffer where uname is written. filler (Any): Unused filler argument.

Returns:

None

Parameters:
  • cpu (Any)

  • buf_ptr (int)

  • filler (Any)

Return type:

None

create_string()[source]

Construct a comma-separated string of uname fields.

Returns:

str: The constructed uname string, with ‘none’ for missing fields.

Return type:

str

domainname: str | None
machine: str | None
nodename: str | None
outdir: str | None
release: str | None
sysname: str | None
version: str | None