Beispiel #1
0
def test_file(requests_mock):
    requests_mock.get(f'{SERVER_URL}/sample/{MOCK_FILE}', json=FILE_RESPONSE)

    client = Client(url=SERVER_URL, use_ssl=True, use_proxy=True)
    args = {
        'file': MOCK_FILE
    }
    _, outputs, _ = file_command(client, args)

    assert outputs == EXPECTED_FILE_RESULT
Beispiel #2
0
def test_domain(requests_mock):
    requests_mock.get(f'{SERVER_URL}/hostname/{MOCK_DOMAIN}', json=DOMAIN_RESPONSE)

    client = Client(url=SERVER_URL, use_ssl=True, use_proxy=True)
    args = {
        'domain': MOCK_DOMAIN
    }
    _, outputs, _ = domain_command(client, args)

    assert outputs == EXPECTED_DOMAIN_RESULT
Beispiel #3
0
def test_ip(requests_mock):
    requests_mock.get(f'{SERVER_URL}/ip/{MOCK_IP}', json=IP_RESPONSE)

    client = Client(url=SERVER_URL, use_ssl=True, use_proxy=True)
    args = {
        'ip': MOCK_IP
    }
    _, outputs, _ = ip_command(client, args)

    assert outputs == EXPECTED_IP_RESULT
Beispiel #4
0
def test_url(requests_mock):
    requests_mock.get(f'{SERVER_URL}/url/{MOCK_URL_SHA256}', json=URL_RESPONSE)

    client = Client(url=SERVER_URL, use_ssl=True, use_proxy=True)
    args = {
        'url': MOCK_URL
    }
    _, outputs, _ = url_command(client, args)

    assert outputs == EXPECTED_URL_RESULT
Beispiel #5
0
def test_file_command_missing_process_list_field_in_response(requests_mock):
    """
    Given:
        - File hash input to file command, that Maltiverse has no process list in response.

    When:
        - Running file command.

    Then:
        - Returns expected result and terminated without errors.
    """
    requests_mock.get(f'{SERVER_URL}/sample/{MOCK_FILE}',
                      json=FILE_RESPONSE_NO_PROCCESS_LIST)

    client = Client(url=SERVER_URL,
                    use_ssl=True,
                    use_proxy=True,
                    reliability='C - Fairly reliable')
    args = {'file': MOCK_FILE}
    _, outputs, _ = file_command(client, args)

    assert outputs == EXPECTED_FILE_RESULT_NO_PROCESS_LIST