diff --git a/artifacts/definitions/Server/Utils/CreateCollector.yaml b/artifacts/definitions/Server/Utils/CreateCollector.yaml index ee58a527279..8ba4060bb30 100644 --- a/artifacts/definitions/Server/Utils/CreateCollector.yaml +++ b/artifacts/definitions/Server/Utils/CreateCollector.yaml @@ -103,6 +103,11 @@ parameters: The filename to use. You can expand environment variables as well as the following %FQDN% and %TIMESTAMP%. + - name: opt_collector_filename + type: string + description: | + If used, this option overrides the default filename of the collector being built. + - name: opt_cpu_limit default: "0" type: int @@ -388,9 +393,8 @@ sources: LET Target <= tool_name[0].Type // This is what we will call it. - LET CollectorName <= format( - format='Collector_%v', - args=inventory_get(tool=Target).Definition.filename) + LET CollectorName <= opt_collector_filename || + format(format='Collector_%v', args=inventory_get(tool=Target).Definition.filename) LET CollectionArtifact <= SELECT Value FROM switch( a = { SELECT CommonCollections + StandardCollection AS Value diff --git a/bin/offline.go b/bin/offline.go index f398fe651ee..5a1fab0edfb 100644 --- a/bin/offline.go +++ b/bin/offline.go @@ -62,6 +62,9 @@ OptTempdir: OptLevel: 5 OptFilenameTemplate: "Collection-%FQDN%-%TIMESTAMP%" +# What to call the collection binary. If empty we use an autogenerated name. +OptCollectorTemplate: "" + # Can be jsonl or csv OptFormat: jsonl @@ -207,6 +210,7 @@ SELECT * FROM Artifact.Server.Utils.CreateCollector( opt_tempdir=Spec.OptTempdir, opt_level=Spec.OptLevel, opt_filename_template=Spec.OptFilenameTemplate, + opt_collector_filename=Spec.OptCollectorTemplate, opt_format=Spec.OptFormat, opt_output_directory=Spec.OptOutputDirectory, opt_cpu_limit=Spec.OptCpuLimit, diff --git a/docs/offline_collector/offline_collector.sh b/docs/offline_collector/offline_collector.sh index cc8c8fb7047..381f75850d1 100755 --- a/docs/offline_collector/offline_collector.sh +++ b/docs/offline_collector/offline_collector.sh @@ -61,6 +61,7 @@ SELECT * FROM Artifact.Server.Utils.CreateCollector( opt_tempdir=Spec.OptTempdir, opt_level=Spec.OptLevel, opt_filename_template=Spec.OptFilenameTemplate, + opt_collector_filename=Spec.OptCollectorTemplate, opt_format=Spec.OptFormat, opt_output_directory=Spec.OptOutputDirectory, opt_cpu_limit=Spec.OptCpuLimit, diff --git a/docs/offline_collector/sample.spec.yaml b/docs/offline_collector/sample.spec.yaml index 489c11c7471..b29f91da5cb 100644 --- a/docs/offline_collector/sample.spec.yaml +++ b/docs/offline_collector/sample.spec.yaml @@ -33,6 +33,7 @@ OptTempdir: # Compression level to use OptLevel: 5 OptFilenameTemplate: "Collection-%FQDN%-%TIMESTAMP%" +OptCollectorTemplate: "" # Can be jsonl or csv OptFormat: jsonl diff --git a/gui/velociraptor/src/components/flows/offline-collector.jsx b/gui/velociraptor/src/components/flows/offline-collector.jsx index 9c27967af45..abeb66cfd13 100644 --- a/gui/velociraptor/src/components/flows/offline-collector.jsx +++ b/gui/velociraptor/src/components/flows/offline-collector.jsx @@ -595,6 +595,21 @@ class OfflineCollectorParameters extends React.Component { /> +