Is there an example for looking for multiple packages? #359
|
As asked by @kmf: Is there an example for listing all packages on a system? The resource is documented in https://mondoo.com/docs/mql/resources/core-pack/packages/ |
Answered by
chris-rock
Oct 21, 2022
Replies: 2 comments
|
Depending on what information you want to get you can query the system: returns the list of packages that include packages.where( name == /ssh/ || name == /zsh/ )specific data fields You can also filter the data fields: packages { name version }where filter + field selector You can combine both: packages.where( name == /ssh/ || name == /zsh/ ) { name version } |
0 replies
Answer selected by
atomic111
|
When you have different packages for different platforms you tend to have different queries: # deb based
packages.where( name == /apache2/ || name == /vim/ )
# rpm based
packages.where( name == /httpd/ || name == /vim/ )To query the right data you can either use if statements: if (asset.platform == "debain") {
packages.where( name == /apache2/ || name == /vim/ )
}
if (asset.platform == "rockylinux") {
packages.where( name == /httpd/ || name == /vim/ )
}or simply include the list of packages in the regex comparison packages.where( name == /apache2|http|vim/ ) |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Depending on what information you want to get you can query the system:
returns the list of packages that include
sshorzshspecific data fields
You can also filter the data fields:
where filter + field selector
You can combine both: