Ejemplo n.º 1
0
def test_assertion_types_and_extension(tmpdir):
    """
    Given:
    - both types and extensions arguments

    When:
    - Running script

    Then:
    - Validate AssertionError is raises as you shouldn't supply them both.
    """
    with raises(AssertionError):
        upload_files('', tmpdir, types='1,2,3', extensions='1,2,3')
Ejemplo n.º 2
0
def test_decryption_rsa(tmpdir):
    """
    Given:
    - A PCAP file with ssl encryption
    - A Key file for the pcap

    When:
    - Running PcapFileExtractor with TLS protected file and key

    Then:
    - Validate results output that the files are exported and returned to CortexSOAR
    """
    file_path = './TestData/rsa.cap'
    key_path = './TestData/rsa.key'
    results = upload_files(file_path, tmpdir, rsa_path=key_path)
    assert 5 == len(results.outputs)
Ejemplo n.º 3
0
def test_decryption_wpa_pwd(tmpdir):
    """
    Given:
    - A PCAP file protected with WPA-PWD
    - A password to the file

    When:
    - Running PcapFileExtractor with WPA-PWD protected file

    Then:
    - Validate results output that the files are exported and returned to CortexSOAR
    """
    file_path = './TestData/wpa-Induction.pcap'
    password = '******'
    results = upload_files(file_path, tmpdir, wpa_pwd=password)
    assert 5 == len(results.outputs)
Ejemplo n.º 4
0
def test_extract_files(tmpdir):
    """
    Given
    - Valid Pcap File.
    When
    - Extracting the file from the pcap.
    Then
    - ensure file is being extracted correctly.
    - ensure outputs are correct.
    """

    file_path = './TestData/tftp_rrq.pcap'
    results = upload_files(file_path, tmpdir)
    assert 'Pcap Extracted Files' in results.readable_output
    assert OUTPUTS == results.outputs
    assert os.path.isfile(os.path.join(tmpdir, 'rfc1350.txt'))