Skip to content

Commit

Permalink
Merge pull request #253 from mnrkbys/rpm-dpkg-search-filename
Browse files Browse the repository at this point in the history
Updated to collect dpkg.log and verify installed files. Also, search for package name that contains installed files.
  • Loading branch information
tclahr authored Dec 3, 2024
2 parents 71c2e10 + db5200f commit fc4593a
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

### Artifacts

- live_response/packages/dpkg.yaml: Updated to verify all packages to compare information about the installed files in the package with information about the files taken from the package metadata stored in the dpkg database [linux] ([mnrkbys](https://github.com/mnrkbys)).
- live_response/packages/package_owns_file.yaml: Added collection of which installed package owns a specific file or command. Note that this artifact is resource-intensive and time-consuming to execute, so it is disabled by default in all profiles [linux] ([mnrkbys](https://github.com/mnrkbys)).
- live_response/system/getcap.yaml: Added functionality to collect the list of files with associated process capabilities [linux] ([mnrkbys](https://github.com/mnrkbys)).

### New Artifacts Properties
Expand Down
9 changes: 7 additions & 2 deletions artifacts/files/packages/dpkg.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
version: 1.0
version: 1.1
artifacts:
-
description: Collect dpkg packages status file.
supported_os: [linux]
collector: file
path: /var/lib/dpkg/status
ignore_date_range: true

-
description: Collect dpkg packages log file.
supported_os: [linux]
collector: file
path: /var/log/dpkg.log
ignore_date_range: true
8 changes: 7 additions & 1 deletion artifacts/live_response/packages/dpkg.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 2.0
version: 2.1
condition: command_exists "dpkg"
output_directory: /live_response/packages
artifacts:
Expand All @@ -8,3 +8,9 @@ artifacts:
collector: command
command: dpkg -l
output_file: dpkg_-l.txt
-
description: Verify all packages to compare information about the installed files in the package with information about the files taken from the package metadata stored in the dpkg database.
supported_os: [linux]
collector: command
command: dpkg -V
output_file: dpkg_-V.txt
97 changes: 97 additions & 0 deletions artifacts/live_response/packages/package_owns_file.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
version: 1.0
condition: command_exists "dpkg" || command_exists "pacman" || command_exists "rpm"
output_directory: /live_response/packages
artifacts:
-
description: List filenames under /bin/.
supported_os: [linux]
collector: find
path: /bin/*
file_type: [f, l]
output_directory: /%temp_directory%/live_response/packages
output_file: binary_files.txt
-
description: List filenames under /sbin/.
supported_os: [linux]
collector: find
path: /sbin/*
file_type: [f, l]
output_directory: /%temp_directory%/live_response/packages
output_file: binary_files.txt
-
description: List filenames under /usr/bin/.
supported_os: [linux]
collector: find
path: /usr/bin/*
file_type: [f, l]
output_directory: /%temp_directory%/live_response/packages
output_file: binary_files.txt
-
description: List filenames under /usr/sbin/.
supported_os: [linux]
collector: find
path: /usr/sbin/*
file_type: [f, l]
output_directory: /%temp_directory%/live_response/packages
output_file: binary_files.txt
-
description: List filenames under /usr/local/bin/.
supported_os: [linux]
collector: find
path: /usr/local/bin/*
file_type: [f, l]
output_directory: /%temp_directory%/live_response/packages
output_file: binary_files.txt
-
description: List filenames under /usr/local/sbin/.
supported_os: [linux]
collector: find
path: /usr/local/sbin/*
file_type: [f, l]
output_directory: /%temp_directory%/live_response/packages
output_file: binary_files.txt
-
description: List filenames under /opt/bin/.
supported_os: [linux]
collector: find
path: /opt/bin/*
file_type: [f, l]
output_directory: /%temp_directory%/live_response/packages
output_file: binary_files.txt
-
description: List filenames under /opt/sbin/.
supported_os: [linux]
collector: find
path: /opt/sbin/*
file_type: [f, l]
output_directory: /%temp_directory%/live_response/packages
output_file: binary_files.txt
-
description: Determine which installed package owns a specific file or command.
supported_os: [linux]
collector: command
condition: command_exists "dpkg"
foreach: sort -u /%temp_directory%/live_response/packages/binary_files.txt
command: dpkg -S "%line%"
output_directory: /live_response/packages
output_file: dpkg_-S.txt
redirect_stderr_to_stdout: true
-
description: Determine which installed package owns a specific file or command.
supported_os: [linux]
collector: command
condition: command_exists "pacman"
foreach: sort -u /%temp_directory%/live_response/packages/binary_files.txt
command: pacman -Q -o "%line%"
output_directory: /live_response/packages
output_file: pacman_-Q_-o.txt
redirect_stderr_to_stdout: true
-
description: Determine which installed package owns a specific file or command.
supported_os: [linux]
collector: command
condition: command_exists "rpm"
foreach: sort -u /%temp_directory%/live_response/packages/binary_files.txt
command: rpm -q -f "%line%" | sed -e "s|$|: %line%|"
output_directory: /live_response/packages
output_file: rpm_-q_-f.txt
1 change: 0 additions & 1 deletion artifacts/live_response/packages/rpm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ artifacts:
collector: command
command: rpm -V -a
output_file: rpm_-V_-a.txt

1 change: 1 addition & 0 deletions profiles/full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ artifacts:
- live_response/system/*
- live_response/hardware/*
- live_response/packages/*
- !live_response/packages/package_owns_file.yaml
- live_response/storage/*
- live_response/containers/*
- live_response/vms/*
Expand Down
1 change: 1 addition & 0 deletions profiles/ir_triage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ artifacts:
- live_response/system/*
- live_response/hardware/*
- live_response/packages/*
- !live_response/packages/package_owns_file.yaml
- live_response/storage/*
- live_response/containers/*
- live_response/vms/*
Expand Down

0 comments on commit fc4593a

Please sign in to comment.