Splunk Phantom

How can I download arbitrary files from the Internet using Phantom?

Path Finder

I have written a custom code block that outputs URLs of files on the Internet that I'd like Phantom to download and use later in the playbook. Given one of these lists of URLs, how can I have Phantom download those files and place them into the vault to be referenced by a later block?

Labels (3)
Tags (1)
0 Karma
1 Solution

Splunk Employee
Splunk Employee

Alex,

It would be my recommendation that you use the HTTP app to pull the file (link text
However, you will need to get the source code to modify it to get it to handle data file saves to the vault.

Currently, there is no prebuilt way to do this. You could continue your process and use the requests library to pull the files and save them using the phantom.add_vault() API call. (This would not be the best practice (as an app would be) due to the processing and delays that it puts under the decide daemon.

View solution in original post

0 Karma

Splunk Employee
Splunk Employee

Alex,

It would be my recommendation that you use the HTTP app to pull the file (link text
However, you will need to get the source code to modify it to get it to handle data file saves to the vault.

Currently, there is no prebuilt way to do this. You could continue your process and use the requests library to pull the files and save them using the phantom.add_vault() API call. (This would not be the best practice (as an app would be) due to the processing and delays that it puts under the decide daemon.

View solution in original post

0 Karma

Splunk Employee
Splunk Employee

This is a beta "wget App for Phantom" which can perform this action. Ask about it in the phantom-community.slack.com workspace.

Path Finder

I got a copy off of slack and will let you know how it goes...thanks!

0 Karma

Path Finder

The app appears to fail when wgetting an Internet resource that doesn't have a file extension. So a URL that ends in .htm or .txt or .jpg works fine, but something like pastebin[.]com/raw/dStYKpUb (a chocolate chip cookie recipe) fails. Maybe it's treating the filename as a folder since it doesn't have an extension, but I'm still researching:

{"app_name":"wget","asset_name":"wget","param":{"context": {"guid": "XXX", "artifact_id": 0, "parent_action_run": []}, "target_url": "https://pastebin.com/raw/dStYKpUb"},"status":"failed","message":"handle_action exception occurred. Error string: '[Errno 2] No such file or directory: '/opt/phantom/vault/tmp/pastebin_12-10-2019_09-16-09.com/raw/dStYKpUb''"}]

0 Karma