Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Acquire MSSQL error logs #210

Merged
merged 3 commits into from
Jan 21, 2025
Merged
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
31 changes: 31 additions & 0 deletions acquire/acquire.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,35 @@
return spec


@register_module("--mssql")
class MSSQL(Module):
Miauwkeru marked this conversation as resolved.
Show resolved Hide resolved
DESC = "MSSQL error logs"

SPEC = [("glob", "/var/opt/mssql/log/errorlog*")]

@classmethod
def get_spec_additions(cls, target: Target, cli_args: argparse.Namespace) -> Iterator[tuple[str, str]]:
log_paths = set()

Check warning on line 781 in acquire/acquire.py

View check run for this annotation

Codecov / codecov/patch

acquire/acquire.py#L781

Added line #L781 was not covered by tests

if not target.has_function("registry"):
return

Check warning on line 784 in acquire/acquire.py

View check run for this annotation

Codecov / codecov/patch

acquire/acquire.py#L783-L784

Added lines #L783 - L784 were not covered by tests

for reg_key in target.registry.glob_ext("HKLM\\SOFTWARE\\Microsoft\\Microsoft SQL Server\\*"):
try:
log_paths.add(reg_key.value("ErrorDumpDir").value)
except Exception:
pass

Check warning on line 790 in acquire/acquire.py

View check run for this annotation

Codecov / codecov/patch

acquire/acquire.py#L786-L790

Added lines #L786 - L790 were not covered by tests

try:
subkey = reg_key.subkey("CPE")
log_paths.add(subkey.value("ErrorDumpDir").value)
except Exception:
pass

Check warning on line 796 in acquire/acquire.py

View check run for this annotation

Codecov / codecov/patch

acquire/acquire.py#L792-L796

Added lines #L792 - L796 were not covered by tests

for log_path in log_paths:
yield ("glob", f"{log_path}/ERRORLOG*")

Check warning on line 799 in acquire/acquire.py

View check run for this annotation

Codecov / codecov/patch

acquire/acquire.py#L798-L799

Added lines #L798 - L799 were not covered by tests


@register_module("--iis")
class IIS(Module):
DESC = "IIS logs"
Expand Down Expand Up @@ -1984,6 +2013,7 @@
IIS,
TextEditor,
Docker,
MSSQL,
]


Expand All @@ -2001,6 +2031,7 @@
Docker,
History,
WebHosting,
MSSQL,
]


Expand Down
Loading