diff --git a/tavern/tomes/download/main.eldritch b/tavern/tomes/download/main.eldritch new file mode 100644 index 000000000..a53cd4582 --- /dev/null +++ b/tavern/tomes/download/main.eldritch @@ -0,0 +1,18 @@ +def download_file(remote_src, local_dst, insecure): + if file.is_dir(file.parent_dir(local_dst)): + if file.is_file(local_dst): + file.remove(local_dst) + http.download(remote_src, local_dst, insecure) + else: + eprint("Specified path has no parent directory") + +def main(): + insecure = cast_bool() + if insecure == -1: + return + + download_file( + input_params['url'], + input_params['dst'], + input_params['insecure'].lower() == "true" + ) diff --git a/tavern/tomes/download/metadata.yml b/tavern/tomes/download/metadata.yml new file mode 100644 index 000000000..25511cde5 --- /dev/null +++ b/tavern/tomes/download/metadata.yml @@ -0,0 +1,18 @@ +name: Download +description: Download a file +author: hulto +support_model: FIRST_PARTY +tactic: EXECUTION +paramdefs: +- name: url + type: string + label: Remote file's URL + placeholder: "https://example.com/executable_file" +- name: dst + type: string + label: Agent side file path (not directory) + placeholder: /tmp/my_file - C:\ProgramData\MyFile.txt +- name: insecure + type: bool + label: Should TLS certificates be ignored + placeholder: "False"