Skip to content

Commit 2e72d7b

Browse files
authored
Merge pull request #1582 from Abyss-W4tcher/docstring_embeds_additional_description
Embed additional plugin description in docstring
2 parents 2ff6c00 + f64291f commit 2e72d7b

File tree

12 files changed

+31
-27
lines changed

12 files changed

+31
-27
lines changed

volatility3/cli/__init__.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,21 @@ def run(self):
363363
metavar="PLUGIN",
364364
)
365365
for plugin in sorted(plugin_list):
366+
# First line of a plugin docstring will be the short description for -h.
367+
# Text after the first two consecutive new lines will be
368+
# the additional description (argparse epilog).
369+
short_help = additional_help = None
370+
if plugin_list[plugin].__doc__ is not None:
371+
doc_split = plugin_list[plugin].__doc__.split("\n\n", 1)
372+
short_help = doc_split[0].strip()
373+
if len(doc_split) > 1:
374+
additional_help = doc_split[1].strip()
375+
366376
plugin_parser = subparser.add_parser(
367377
plugin,
368-
help=plugin_list[plugin].__doc__,
369-
description=plugin_list[plugin].__doc__,
370-
epilog=plugin_list[plugin].additional_description,
378+
help=short_help,
379+
description=short_help,
380+
epilog=additional_help,
371381
)
372382
self.populate_requirements_argparse(plugin_parser, plugin_list[plugin])
373383

volatility3/framework/interfaces/plugins.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ class PluginInterface(
112112
# Be careful with inheritance around this (We default to requiring a version which doesn't exist, so it must be set)
113113
_required_framework_version: Tuple[int, int, int] = (0, 0, 0)
114114
"""The _version variable is a quick way for plugins to define their current interface, it should follow SemVer rules"""
115-
additional_description: str = None
116-
"""Display additional description of the plugin after the description of the arguments. See: https://docs.python.org/3/library/argparse.html#epilog"""
117115

118116
def __init__(
119117
self,

volatility3/framework/plugins/configwriter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515

1616
class ConfigWriter(plugins.PluginInterface):
17-
"""Runs the automagics and both prints and outputs configuration in the
18-
output directory."""
17+
"""Runs the automagics and both prints and outputs configuration in the \
18+
output directory."""
1919

2020
_required_framework_version = (2, 0, 0)
2121

volatility3/framework/plugins/linux/modxview.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616

1717
class Modxview(interfaces.plugins.PluginInterface):
18-
"""Centralize lsmod, check_modules and hidden_modules results to efficiently
19-
spot modules presence and taints."""
18+
"""Centralize lsmod, check_modules and hidden_modules results to efficiently \
19+
spot modules presence and taints."""
2020

2121
_version = (1, 0, 0)
2222
_required_framework_version = (2, 17, 0)

volatility3/framework/plugins/linux/pstree.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010

1111
class PsTree(interfaces.plugins.PluginInterface):
12-
"""Plugin for listing processes in a tree based on their parent process
13-
ID."""
12+
"""Plugin for listing processes in a tree based on their parent process ID."""
1413

1514
_required_framework_version = (2, 13, 0)
1615
_version = (1, 1, 1)

volatility3/framework/plugins/mac/mount.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212

1313
class Mount(plugins.PluginInterface):
14-
"""A module containing a collection of plugins that produce data typically
15-
found in Mac's mount command"""
14+
"""A module containing a collection of plugins that produce data typically \
15+
found in Mac's mount command"""
1616

1717
_required_framework_version = (2, 0, 0)
1818

volatility3/framework/plugins/mac/pstree.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111

1212
class PsTree(plugins.PluginInterface):
13-
"""Plugin for listing processes in a tree based on their parent process
14-
ID."""
13+
"""Plugin for listing processes in a tree based on their parent process ID."""
1514

1615
_required_framework_version = (2, 0, 0)
1716

volatility3/framework/plugins/timeliner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def generate_timeline(
4141

4242

4343
class Timeliner(interfaces.plugins.PluginInterface):
44-
"""Runs all relevant plugins that provide time related information and
45-
orders the results by time."""
44+
"""Runs all relevant plugins that provide time related information and \
45+
orders the results by time."""
4646

4747
_required_framework_version = (2, 0, 0)
4848
_version = (1, 1, 0)

volatility3/framework/plugins/windows/pstree.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414

1515

1616
class PsTree(interfaces.plugins.PluginInterface):
17-
"""Plugin for listing processes in a tree based on their parent process
18-
ID."""
17+
"""Plugin for listing processes in a tree based on their parent process ID."""
1918

2019
_required_framework_version = (2, 0, 0)
2120

volatility3/framework/plugins/windows/psxview.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121

2222

2323
class PsXView(plugins.PluginInterface):
24-
"""Lists all processes found via four of the methods described in \"The Art of Memory Forensics,\" which may help
25-
identify processes that are trying to hide themselves. I recommend using -r pretty if you are looking at this
26-
plugin's output in a terminal."""
24+
"""Lists all processes found via four of the methods described in \"The Art of Memory Forensics\" which may help \
25+
identify processes that are trying to hide themselves.
26+
27+
We recommend using -r pretty if you are looking at this plugin's output in a terminal."""
2728

2829
# I've omitted the desktop thread scanning method because Volatility3 doesn't appear to have the functionality
2930
# which the original plugin used to do it.

0 commit comments

Comments
 (0)