SCPPullFiles

Take a list of devices and pull a specific file (given by path) from each using SCP.

python · Common Scripts

Details

IDSCPPullFiles
Languagepython
From Version5.0.0
Docker Imagedemisto/python3:3.12.13.10404775
TagsUtility

README

Pulls a specific file (given by path) from each using SCP from a list of devices.

Script Data


Name Description
Script Type python
Tags Utility

Dependencies


This script uses the following commands and scripts.

  • copy-from

Inputs


Argument Name Description
systems2files The JSON object mapping remote access instances to filepaths.

Outputs


There are no outputs for this script.

from SCPPullFiles import *


def test_scp_pull_files(mocker):
    with open("./test_data/json_file.json") as file:
        json_file = file.read()
        mocker.patch.object(demisto, "get", return_value=json_file)
        mocker.patch.object(demisto, "executeCommand", return_value=["copy-from response"])
        assert scp_pull_files({}) == ["copy-from response", "copy-from response"]


def test_scp_pull_files_error_in_file(mocker):
    with open("./test_data/not_dict_json_file.json") as file:
        txt_file = file.read()
        mocker.patch.object(demisto, "get", return_value=txt_file)
        assert scp_pull_files({}) == {
            "Type": 4,
            "ContentsFormat": "text",
            "Contents": "Wrong argument provided. Not a dict. Dump of args: {}",
        }