Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 1 addition & 21 deletions acquire/acquire.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,20 +867,6 @@ def get_spec_additions(cls, target: Target, cli_args: argparse.Namespace) -> Ite
yield ("glob", f"{log_path}/ERRORLOG*")


@register_module("--iis")
class IIS(Module):
DESC = "IIS logs"

@classmethod
def get_spec_additions(cls, target: Target, cli_args: argparse.Namespace) -> Iterator[tuple]:
warnings.warn(
"--iis is deprecated in favor of --webserver-logs and will be removed in acquire 3.22",
DeprecationWarning,
stacklevel=2,
)
return Webserver.get_spec_additions(cls, target, cli_args)


@register_module("--webserver")
class Webserver(Module):
DESC = "Various webserver logs and configuration files"
Expand Down Expand Up @@ -2193,7 +2179,7 @@ class WindowsProfile:
QuarantinedFiles,
WindowsNotifications,
SSH,
IIS,
Webserver,
SharePoint,
TextEditor,
Docker,
Expand Down Expand Up @@ -2388,12 +2374,6 @@ def main() -> None:
log.info("Default Arguments: %s", " ".join(args.config.get("arguments")))
log.info("")

if any(arg in sys.argv for arg in ["--file", "--dir", "-f", "-d"]):
warnings.warn(
"--file and --dir are deprecated in favor of --path and will be removed in acquire 3.22",
DeprecationWarning,
stacklevel=2,
)
if "--proc-net" in sys.argv:
warnings.warn(
"--proc-net will be merged with --proc and will be removed in acquire 3.23",
Expand Down
20 changes: 3 additions & 17 deletions acquire/uploaders/plugin_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,30 +59,16 @@ def items(self) -> ItemsView[str, T]:
def get(self, name: str) -> T:
return self.plugins.get(name)

def _find_entrypoint_data(self, entry_point_name: str) -> list[metadata.EntryPoint]:
"""Searches through the entrypoints to find specific entry_point names.

Args:
entry_point_name: The name to search for.

Returns:
A list with entry_points associated with that name."""
try:
entrypoint_plugins = metadata.entry_points()[entry_point_name]
except KeyError:
entrypoint_plugins = []
return entrypoint_plugins

def load_entrypoint_plugins(self, name: str) -> None:
def load_entrypoint_plugins(self, group_name: str) -> None:
"""Loads all classes defined in the entrypoints that use the specified ``name``.

Loads the class loaded from the entrypoint with the form: ``<name>=<path>:<class>``
as <name> <loaded class>

Args:
name: The entrypoint to search for.
group_name: The entrypoint to search for.
"""
class_plugins = self._find_entrypoint_data(name)
class_plugins = metadata.entry_points(group=group_name)

for ep in class_plugins:
try:
Expand Down
5 changes: 0 additions & 5 deletions acquire/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,7 @@ def create_argument_parser(profiles: dict, volatile: dict, modules: dict) -> arg
parser.add_argument("-p", "--profile", choices=profiles.keys(), help="collection profile")
parser.add_argument("--volatile-profile", choices=volatile.keys(), help="volatile profile")

# Keep `--file` and `--dir` (-f, and -d) temporarily
parser.add_argument(
"-f",
"-d",
"--file",
"--dir",
"--path",
dest="path",
action="append",
Expand Down
7 changes: 3 additions & 4 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_registry_functionality_iterator() -> None:

def test_registry_entrypoint() -> None:
mocked_output = Mock()
with patch.object(PluginRegistry, "_find_entrypoint_data", return_value=[mocked_output]):
with patch(f"{PluginRegistry.__module__}.metadata.entry_points", return_value=[mocked_output]):
data = PluginRegistry("<undefined>")
assert data.get(mocked_output.name) == mocked_output.load.return_value

Expand All @@ -33,6 +33,5 @@ def test_registry_entrypoint_failed() -> None:
mocked_output.load.side_effect = [ModuleNotFoundError]
data = PluginRegistry("-")

with patch.object(PluginRegistry, "_find_entrypoint_data", return_value=[mocked_output]):
data.load_entrypoint_plugins("test")
assert len(data.items()) == 0
data.load_entrypoint_plugins("test")
assert len(data.items()) == 0
Loading