Skip to content

Windows

Windows

Create generic volatility3 OS wrappers.

This module provides a way to interact with Volatility3 plugins in a more abstract way. It allows to automatically get all available plugins for a specific OS and run them with the required arguments.

Example

The module can be used as follows:

$ python3
>>> from pydfirram.modules.windows import Windows
>>> from pathlib import Path
>>> dumpfile = Path("tests/data/dump.raw")
>>> generic = Windows(dumpfile)
>>> plugin = generic.pslist().to_list()

OR : $ python3 >>> from pydfirram.modules.windows import Windows >>> from pathlib import Path >>> dumpfile = Path("tests/data/dump.raw") >>> generic = Windows(dumpfile) >>> plugin = generic.pslist(pid=[4]).to_df() >>> print(plugin)

Windows

Bases: Generic

A wrapper class for utilizing Windows-specific functionalities around the base methods.

This class serves as a simplified interface for interacting with Windows operating system dumps. It inherits from the Generic class and initializes with Windows as the operating system.

Attributes:

dumpfile : str The path to the memory dump file.

Methods:

init(dumpfile) Initializes the Windows class with the given dump file.

Source code in pydfirram/modules/windows.py
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
class Windows(Generic):
    """
    A wrapper class for utilizing Windows-specific functionalities around
    the base methods.

    This class serves as a simplified interface for interacting with
    Windows operating system dumps. It inherits from the Generic class and
    initializes with Windows as the operating system.

    Attributes:
    -----------
    dumpfile : str
        The path to the memory dump file.

    Methods:
    --------
    __init__(dumpfile)
        Initializes the Windows class with the given dump file.
    """
    def __init__(self, dumpfile: str|Path) -> None:
        """
        Initializes the Windows class.

        Parameters:
        -----------
        dumpfile : str
            The path to the memory dump file.

        Example:
        --------
        >>> windows = Windows("path/to/dump.raw": Path)
        """
        if isinstance(dumpfile,str):
            dumpfile = Path(dumpfile)
        self.dump_files = dumpfile
        super().__init__(
            operating_system    = OperatingSystem.WINDOWS,
            dump_file           = dumpfile,
        )

    # (todo) : seems to be a boilerplate from `Context`
    # (todo) : add typing information
    def _set_argument(self, context, prefix, kwargs):
        for k, v in kwargs.items():
            print(k,v)
            context.config[prefix+k] = v
        return context

    def dumpfiles(self, **_kwargs: dict[str,Any]) -> None:
        """
            Dump memory files based on provided parameters.

            This method utilizes the "dumpfiles" plugin to create memory
            dumps from a Windows operating system context. The memory dumps
            can be filtered based on the provided arguments. If no
            parameters are provided, the method will dump the entire
            system by default.

            Parameters:
            -----------
            physaddr : int, optional
                The physical address offset for the memory dump.
            virtaddr : int, optional
                The virtual address offset for the memory dump.
            pid : int, optional
                The process ID for which the memory dump should be
                generated.

            Notes:
            ------
            - The method sets up the context with the operating system
                and dump files.
            - Automagic and context settings are configured before
                building the context.
            - If additional keyword arguments are provided, they are
                added as arguments to the context.
            - The resulting context is executed and rendered to a file
                using the Renderer class.
            - If no parameters are provided, the method will dump the
                entire system by default.

            Returns:
            --------
            None
            """
        plugin = self.get_plugin("dumpfiles")
        context = Context(
            operating_system    = OperatingSystem.WINDOWS,
            dump_file           = self.dump_files,
            plugin              = plugin,
        )
        context.set_automagic()
        context.set_context()
        builded_context = context.build()
        if _kwargs:
            runable_context = context.add_arguments(builded_context,_kwargs)
        else:
            runable_context = builded_context
        Renderer(runable_context.run()).file_render()

__init__(dumpfile)

Initializes the Windows class.

Parameters:

dumpfile : str The path to the memory dump file.

Example:

windows = Windows("path/to/dump.raw": Path)

Source code in pydfirram/modules/windows.py
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
def __init__(self, dumpfile: str|Path) -> None:
    """
    Initializes the Windows class.

    Parameters:
    -----------
    dumpfile : str
        The path to the memory dump file.

    Example:
    --------
    >>> windows = Windows("path/to/dump.raw": Path)
    """
    if isinstance(dumpfile,str):
        dumpfile = Path(dumpfile)
    self.dump_files = dumpfile
    super().__init__(
        operating_system    = OperatingSystem.WINDOWS,
        dump_file           = dumpfile,
    )

dumpfiles(**_kwargs)

Dump memory files based on provided parameters.

This method utilizes the "dumpfiles" plugin to create memory dumps from a Windows operating system context. The memory dumps can be filtered based on the provided arguments. If no parameters are provided, the method will dump the entire system by default.

Parameters:

physaddr : int, optional The physical address offset for the memory dump. virtaddr : int, optional The virtual address offset for the memory dump. pid : int, optional The process ID for which the memory dump should be generated.

Notes:
  • The method sets up the context with the operating system and dump files.
  • Automagic and context settings are configured before building the context.
  • If additional keyword arguments are provided, they are added as arguments to the context.
  • The resulting context is executed and rendered to a file using the Renderer class.
  • If no parameters are provided, the method will dump the entire system by default.
Returns:

None

Source code in pydfirram/modules/windows.py
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
def dumpfiles(self, **_kwargs: dict[str,Any]) -> None:
    """
        Dump memory files based on provided parameters.

        This method utilizes the "dumpfiles" plugin to create memory
        dumps from a Windows operating system context. The memory dumps
        can be filtered based on the provided arguments. If no
        parameters are provided, the method will dump the entire
        system by default.

        Parameters:
        -----------
        physaddr : int, optional
            The physical address offset for the memory dump.
        virtaddr : int, optional
            The virtual address offset for the memory dump.
        pid : int, optional
            The process ID for which the memory dump should be
            generated.

        Notes:
        ------
        - The method sets up the context with the operating system
            and dump files.
        - Automagic and context settings are configured before
            building the context.
        - If additional keyword arguments are provided, they are
            added as arguments to the context.
        - The resulting context is executed and rendered to a file
            using the Renderer class.
        - If no parameters are provided, the method will dump the
            entire system by default.

        Returns:
        --------
        None
        """
    plugin = self.get_plugin("dumpfiles")
    context = Context(
        operating_system    = OperatingSystem.WINDOWS,
        dump_file           = self.dump_files,
        plugin              = plugin,
    )
    context.set_automagic()
    context.set_context()
    builded_context = context.build()
    if _kwargs:
        runable_context = context.add_arguments(builded_context,_kwargs)
    else:
        runable_context = builded_context
    Renderer(runable_context.run()).file_render()