コード例 #1
0
def test_command_test_module(mocker, requests_mock):
    mock_demisto(mocker, None, 'test-module')
    test_route = 'api/v2/enterpriseapi/statuscheck'
    requests_mock.get(MOCK_URL + test_route, text=MOCK_TEST_MODULE_RESPONSE)
    main()
    results = demisto.results.call_args[0]
    assert results[0] == 'ok'
コード例 #2
0
def test_command_accessdata_read_casefile(mocker, requests_mock):
    mock_demisto(mocker, MOCK_READ_CASEFILE_ARGS, 'accessdata-read-casefile')
    read_casefile_route = 'api/v2/enterpriseapi/core/readfilecontents'
    requests_mock.post(MOCK_URL + read_casefile_route, text=MOCK_READ_CASEFILE_RESPONSE)
    main()
    results = demisto.results.call_args[0]
    entry_context = results[0]['EntryContext']['Accessdata.File.Contents']
    assert entry_context == MOCK_READ_CASEFILE_RESPONSE
コード例 #3
0
def test_command_accessdata_legacyagent_get_memorydump(mocker, requests_mock):
    mock_demisto(mocker, MOCK_ADD_JOB_ARGS, 'accessdata-legacyagent-get-memorydump')
    add_job_route = 'api/v2/enterpriseapi/agent/' + str(MOCK_ADD_JOB_ARGS['caseid']) + '/memoryacquistion'
    requests_mock.post(MOCK_URL + add_job_route, text="333")
    main()
    results = demisto.results.call_args[0]
    entry_context = results[0]['EntryContext']['Accessdata.Job(val.CaseJobID == obj.CaseJobID)']

    assert results[0]['HumanReadable'] == 'JobID: 333'
    assert entry_context['CaseID'] == MOCK_GET_STATUS_ARGS["caseID"]
    assert entry_context['ID'] == 333
    assert entry_context['CaseJobID'] == str(MOCK_GET_STATUS_ARGS["caseID"]) + "_333"
    assert entry_context['Type'] == 'LegacyMemoryDump'
    assert entry_context['State'] == 'Unknown'
コード例 #4
0
def test_command_accessdata_jobstatus_scan(mocker, requests_mock):
    mock_demisto(mocker, MOCK_GET_STATUS_ARGS, 'accessdata-jobstatus-scan')
    status_route = 'api/v2/enterpriseapi/core/' + str(MOCK_GET_STATUS_ARGS["caseID"]) + \
        '/getjobstatus/' + str(MOCK_GET_STATUS_ARGS["jobID"])
    requests_mock.get(MOCK_URL + status_route, json=MOCK_GET_JOBSTATUS_MEMORYDUMP_RESPONSE)
    main()
    results = demisto.results.call_args[0]
    entry_context = results[0]['EntryContext']['Accessdata.Job(val.CaseJobID == obj.CaseJobID)']

    assert results[0]['HumanReadable'] == 'Current job state: Success'
    assert entry_context['CaseID'] == str(MOCK_GET_STATUS_ARGS["caseID"])
    assert entry_context['ID'] == str(MOCK_GET_STATUS_ARGS["jobID"])
    assert entry_context['CaseJobID'] == str(MOCK_GET_STATUS_ARGS["caseID"]) + "_" + str(MOCK_GET_STATUS_ARGS["jobID"])
    assert entry_context['State'] == 'Success'
コード例 #5
0
def test_command_accessdata_get_jobstatus_processlist(mocker, requests_mock):
    mock_demisto(mocker, MOCK_GET_STATUS_ARGS, 'accessdata-get-jobstatus-processlist')
    status_route = 'api/v2/enterpriseapi/core/' + str(MOCK_GET_STATUS_ARGS["caseID"]) + \
        '/getjobstatus/' + str(MOCK_GET_STATUS_ARGS["jobID"])
    requests_mock.get(MOCK_URL + status_route, json=MOCK_GET_JOBSTATUS_PROCESSLIST_RESPONSE)
    main()
    results = demisto.results.call_args[0]
    entry_context = results[0]['EntryContext']['Accessdata.Job(val.CaseJobID == obj.CaseJobID)']
    assert entry_context['CaseID'] == MOCK_GET_STATUS_ARGS["caseID"]
    assert entry_context['ID'] == MOCK_GET_STATUS_ARGS["jobID"]
    assert entry_context['CaseJobID'] == str(MOCK_GET_STATUS_ARGS["caseID"]) + "_" + str(MOCK_GET_STATUS_ARGS["jobID"])
    assert entry_context['State'] == 'Success'
    assert entry_context['Result'] == '\\\\' + MOCK_BASE_URL + '\\D$\\Program Files\\AccessData\\' + \
        'QuinC\\app\\demo\\Demo Case\\c00a2abf-1076-412b-8dea-67305fb8015f\\Jobs\\job_967\\' + \
        'eb849680-2e81-4416-b1b5-5047fd1bc4b1\\1\\snapshot.xml'
コード例 #6
0
def test_command_accessdata_get_jobstatus_memorydump(mocker, requests_mock):
    mock_demisto(mocker, MOCK_GET_STATUS_ARGS, 'accessdata-get-jobstatus-memorydump')
    status_route = 'api/v2/enterpriseapi/core/' + str(MOCK_GET_STATUS_ARGS["caseID"]) + \
        '/getjobstatus/' + str(MOCK_GET_STATUS_ARGS["jobID"])
    requests_mock.get(MOCK_URL + status_route, json=MOCK_GET_JOBSTATUS_MEMORYDUMP_RESPONSE)
    main()
    results = demisto.results.call_args[0]
    entry_context = results[0]['EntryContext']['Accessdata.Job(val.CaseJobID == obj.CaseJobID)']

    assert entry_context['CaseID'] == MOCK_GET_STATUS_ARGS["caseID"]
    assert entry_context['ID'] == MOCK_GET_STATUS_ARGS["jobID"]
    assert entry_context['CaseJobID'] == str(MOCK_GET_STATUS_ARGS["caseID"]) + "_" + str(MOCK_GET_STATUS_ARGS["jobID"])
    assert entry_context['State'] == 'Success'
    assert entry_context['Result'] == '\\\\' + MOCK_BASE_URL + '\\data\\SiteServer\\storage\\' + \
        '8ffafb2e-d077-4165-9aa7-f00cda29cce2\\1\\memdump.mem'