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

Create Generic.Remediation.UploadFile.Glob.yaml #574

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Generic.Remediation.UploadFile.Glob
description: |
This artefact lets you upload a file to the target system. If the target file exists, it will be overritten.
It uses glob to define the destination path. You can upload the file to multiple destinations at once.
author: Philipp Leu
type: CLIENT

parameters:
- name: TargetGlob
description: Destination Path, if the destination already exists, it will be overridden
- name: ReallyDoIt
description: When selected, it will really override the targets!
type: bool

tools:
- name: RemediationFile
url:

sources:
- query: |
LET targets = SELECT * FROM glob(globs=TargetGlob)
WHERE NOT IsDir
ORDER BY OSPath DESC

LET UploadedFile <= SELECT FullPath FROM Artifact.Generic.Utils.FetchBinary(ToolName="RemediationFile", IsExecutable=FALSE, TemporaryOnly=TRUE)

LET upload_targets = SELECT *, if(condition=ReallyDoIt, then=copy(filename=UploadedFile.FullPath[0], accessor="file", dest=OSPath), else=FALSE) AS Overwritten FROM targets

SELECT OSPath,Overwritten,Size,Mtime,Ctime,Btime
FROM upload_targets