Base
Base
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.core.base import Generic, OperatingSystem
>>> from pathlib import Path
>>> os = OperatingSystem.WINDOWS
>>> dumpfile = Path("tests/data/dump.raw")
>>> generic = Generic(os, dumpfile)
>>> plugin = generic.get_plugin("Banners")
>>> generic.run_plugin(plugin)
Example
Or it can be used as follow :
$ python3
>>> from pydfirram.core.base import Generic, OperatingSystem
>>> from pathlib import Path
>>> os = OperatingSystem.WINDOWS
>>> dumpfile = Path("tests/data/dump.raw")
>>> generic = Generic(dumpfile)
>>> plugin = generic.pslist().to_df()
>>> print(plugin)
Context
Context for a volatility3 plugin.
Attributes:
Name | Type | Description |
---|---|---|
os |
OperatingSystem: The operating system. |
|
dump_file |
Path: The dump file path. |
|
context |
V3Context: The volatility3 context. |
|
plugin |
PluginEntry: The plugin entry. |
Constants
KEY_LAYER_STACKER: str: The layer stacker key. KEY_STACKERS: str: The stackers key. KEY_SINGLE_LOCATION: str: The single location key.
Source code in pydfirram/core/base.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
|
__init__(operating_system, dump_file, plugin)
Initializes a context.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
operating_system |
OperatingSystem
|
The operating system. |
required |
dump_file |
Path
|
The dump file path. |
required |
plugin |
PluginEntry
|
The plugin entry. |
required |
Source code in pydfirram/core/base.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
add_arguments(context, kwargs)
Handle keyword arguments and set them as context config attributes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kwargs |
dict[str, Any]
|
The keyword arguments. |
required |
Raises:
Type | Description |
---|---|
AttributeError
|
If the attribute does not exist. |
Source code in pydfirram/core/base.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
|
automagics()
Returns a list of volatility3 automagics.
Returns:
Type | Description |
---|---|
list[AutomagicInterface]
|
List[V3AutomagicInterface]: A list of automagics. |
Raises:
Type | Description |
---|---|
UnsatisfiedException
|
If no automagic can be chosen. |
Source code in pydfirram/core/base.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
|
build()
Build a basic context for the provided plugin.
Returns:
Type | Description |
---|---|
PluginInterface
|
interfaces.plugins.PluginInterface: The built plugin interface. |
Raises:
Type | Description |
---|---|
UnsatisfiedException
|
If the plugin cannot be built. |
Source code in pydfirram/core/base.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
|
get_available_automagics()
Returns a list of available volatility3 automagics.
Returns:
Type | Description |
---|---|
list[AutomagicInterface]
|
List[V3AutomagicInterface]: A list of available automagics. |
Source code in pydfirram/core/base.py
241 242 243 244 245 246 247 248 249 250 |
|
get_dump_file_location()
Returns the dump file location.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The dump file location formatted as a URL. |
Source code in pydfirram/core/base.py
287 288 289 290 291 292 293 |
|
os_stackers()
Returns a list of stackers for the OS.
Returns:
Type | Description |
---|---|
list[AutomagicInterface]
|
List[V3AutomagicInterface]: A list of (volatility3) stackers. |
Source code in pydfirram/core/base.py
276 277 278 279 280 281 282 283 284 285 |
|
set_automagic()
setup the automagics
Source code in pydfirram/core/base.py
185 186 187 |
|
set_context()
setup the current context
Source code in pydfirram/core/base.py
179 180 181 182 183 |
|
Generic
Generic OS wrapper to be used with volatility3
This class 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.
It aims to be inherited by specific OS wrappers like Windows, Linux or MacOS.
Attributes:
Name | Type | Description |
---|---|---|
os |
OperatingSystem
|
The operating system. |
plugins |
List[PluginEntry]
|
The list of plugins. |
dump_file |
Path
|
The dump file path. |
context |
Context
|
The context. |
Source code in pydfirram/core/base.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 |
|
__getattr__(key, **kwargs)
Handle attribute access for commands.
This method is called when an attribute that matches a command name is accessed. It returns a lambda function that calls the __run_commands method with the corresponding key.
:param key: The attribute name (command name). :type key: str :param args: Positional arguments for the method call. :param kwargs: Keyword arguments for the method call. :return: A class of Renderer that is the result of a lambda function that executes the __run_commands method for the given key.
Source code in pydfirram/core/base.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
|
__init__(operating_system, dump_file)
Initializes a generic OS.
Automatically get all available Volatility3 plugins for the OS.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
operating_system |
OperatingSystem
|
The operating system. |
required |
dump_file |
Path
|
The dump file path. |
required |
Raises:
Type | Description |
---|---|
FileNotFoundError
|
If the dump file does not exist. |
Source code in pydfirram/core/base.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
|
get_all_plugins()
Get all available plugins for the specified OS.
Returns:
Type | Description |
---|---|
list[PluginEntry]
|
List[PluginEntry]: A list of plugins for the specified OS |
list[PluginEntry]
|
or all available plugins if the OS is not supported. |
Raises:
Type | Description |
---|---|
ValueError
|
If the plugin is not found. |
Source code in pydfirram/core/base.py
490 491 492 493 494 495 496 497 498 499 500 501 502 |
|
get_plugin(name)
Fetches a plugin by its name from the list of plugins.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The plugin name. |
required |
Returns:
Name | Type | Description |
---|---|---|
PluginEntry |
PluginEntry
|
The plugin entry. |
Raises:
Type | Description |
---|---|
ValueError
|
If the plugin is not found. |
Source code in pydfirram/core/base.py
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 |
|
run_plugin(plugin, **kwargs)
Run a volatility3 plugin with the given arguments.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
plugin |
PluginEntry
|
The plugin entry. |
required |
**kwargs |
Any
|
The keyword arguments. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
Any |
Any
|
The result of the plugin. |
Raises:
Type | Description |
---|---|
ValueError
|
If the context is not built. |
Source code in pydfirram/core/base.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 |
|
validate_dump_file(dump_file)
Validate dump file location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dump_file |
Path
|
The dump file path. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the file exists. |
Raises:
Type | Description |
---|---|
FileNotFoundError
|
If the file does not exist. |
Source code in pydfirram/core/base.py
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 |
|
OperatingSystem
Bases: Enum
Supported operating system.
Attributes:
Name | Type | Description |
---|---|---|
WINDOWS |
Windows OS. |
|
LINUX |
Linux OS. |
|
MACOS |
MacOS OS. |
Source code in pydfirram/core/base.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
to_list()
staticmethod
Returns a list of supported operating systems. Returns: List[str]: List of supported operating systems.
Source code in pydfirram/core/base.py
97 98 99 100 101 102 103 |
|
PluginEntry
dataclass
A plugin entry.
The interface allows to directly interact with the plugin from volatility3 functions.
Attributes:
Name | Type | Description |
---|---|---|
type |
PluginType
|
PluginType: The plugin type. |
name |
str
|
str: The plugin name. |
interface |
PluginInterface
|
PluginInterface: The (volatility3) plugin interface. |
Source code in pydfirram/core/base.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
__repr__()
Returns a string representation of the plugin entry.
Source code in pydfirram/core/base.py
136 137 138 |
|
PluginType
Bases: Enum
A volatiliry3 plugin type.
Attributes:
Name | Type | Description |
---|---|---|
GENERIC |
A generic plugin, can be used with any OS. |
|
SPECIFIC |
An OS-specific plugin. |
Source code in pydfirram/core/base.py
107 108 109 110 111 112 113 114 115 116 |
|