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/ |
Beta Was this translation helpful? Give feedback.
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 } |
Beta Was this translation helpful? Give feedback.
-
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/ ) |
Beta Was this translation helpful? Give feedback.
Depending on what information you want to get you can query the system:
returns the list of packages that include
ssh
orzsh
specific data fields
You can also filter the data fields:
where filter + field selector
You can combine both: