Uefivariablesupport
uefivariablesupport ¶
Exports UefiVariables class to allow OS level interaction with Uefi Variables. Includes Windows and Linux support.
This module provides: - UefiVariable: Class to interfact with Uefi Variables from OS.
UefiVariable ¶
Class to interact with Uefi Variables under Windows or Linux.
Methods:¶
GetUefiVar - Get a single Uefi Variable's data GetUefiAllVarNames - Get all Uefi variables SetUefiVar - Set (or delete) a single Uefi variable.
GetUefiVar ¶
GetUefiVar(name: str, guid: str) -> tuple[int, str]
Get a Uefi Variable from the system.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
String corresponding to the Unicode Name of the variable. |
required |
guid |
str
|
String corresponding to the Uefi Guid of the variable. |
required |
Returns:
Name | Type | Description |
---|---|---|
Tuple |
tuple[int, str]
|
(error code, string of variable data) |
GetUefiAllVarNames ¶
GetUefiAllVarNames() -> tuple[int, bytes]
Get all Uefi Variables in the system, and return a byte packed byte string.
Raises:
Type | Description |
---|---|
Exception
|
Returned variable could not be parsed. |
Returns:
Type | Description |
---|---|
tuple[int, bytes]
|
tuple[int, bytes]: Integer is return status, 0 for error, non-zero for success. Bytes are the packed structure for each variable. struct _VARIABLE_NAME { ULONG NextEntryOffset; GUID VendorGuid; WCHAR Name[ANYSIZE_ARRAY]; } |
SetUefiVar ¶
SetUefiVar(
name: str, guid: str, var: str = None, attrs: int = None
) -> int
Set a Uefi Variable into the system.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Unicode name of variable to set |
required |
guid |
str
|
Guid to use when setting the variable |
required |
var |
Optional[bytes]
|
Bytes to set to the variable. Defaults to None. |
None
|
attrs |
Optional[int]
|
Attributes to use when setting the variable. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
0 for a failure, non-zero for success |