SetRDPOverallScore

Sets the overall score for the strings similarity scoring for the text extracted from the RDP cache image.

python · RDPCacheHunting

Details

IDSetRDPOverallScore
Languagepython
From Version6.9.0
Docker Imagedemisto/python3:3.12.13.10116658
Tagsdynamic-section

README

Sets the overall score for the strings similarity scoring for the text extracted from the RDP cache image.

Script Data


Name Description
Script Type python3
Tags dynamic-section
Cortex XSOAR Version 6.9.0

Inputs


There are no inputs for this script.

Outputs


Path Description Type
RDPOverallScore The overall score of matches found in the extracted strings by StringSifter and StringSimilarity analysis. This is a value of 1 to 100 which is a precent of malicious strings found. Unknown
import demistomock as demisto
from SetRDPOverallScore import main


def test_happy_path_score_zero(mocker):
    """
    Given:
        - OverallScore zero
    When:
        - Calling the main function
    Then:
        - Ensure that the expected HTML is returned
    """
    mocker.patch.object(demisto, "results", return_value={"OverallScore": "0"})
    expected_html = (
        "<div style='color:#1DB846;font-size:38px;padding: 60px; text-align:center;padding-left: 70px'>0/100<br>"
        "No suspicious strings found</div>"
    )
    main()
    result = demisto.results.call_args[0][0]["Contents"]

    assert result == expected_html


def test_happy_path_score_50(mocker):
    """
    Given:
        - OverallScore 50
    When:
        - Calling the main function
    Then:
        - Ensure that the expected HTML is returned as expected
    """
    mocker.patch.object(demisto, "results")
    mocker.patch.object(demisto, "context", return_value={"OverallScore": "50"})
    expected_html = "<div style='color:#EF9700;font-size:48px;padding: 60px; text-align:center;padding-left: 70px'>50/100</div>"
    main()
    result = demisto.results.call_args[0][0]

    assert result["Contents"] == expected_html


def test_happy_path_score_90(mocker):
    """
    Given:
        - OverallScore 50
    When:
        - Calling the main function
    Then:
        - Ensure that the expected HTML is returned
    """
    mocker.patch.object(demisto, "results")
    mocker.patch.object(demisto, "context", return_value={"OverallScore": "90"})
    expected_html = "<div style='color:#b81d1d;font-size:48px;padding: 60px; text-align:center;padding-left: 70px'>90/100</div>"
    main()
    result = demisto.results.call_args[0][0]

    assert result["Contents"] == expected_html


def test_happy_path_score_100(mocker):
    """
    Given:
        - OverallScore 100
    When:
        - Calling the main function
    Then:
        - Ensure that the expected HTML is returned
    """
    mocker.patch.object(demisto, "results")
    mocker.patch.object(demisto, "context", return_value={"OverallScore": "100"})
    expected_html = "<div style='color:#b81d1d;font-size:48px;padding: 60px; text-align:center;padding-left: 70px'>100/100</div>"
    main()
    result = demisto.results.call_args[0][0]

    assert result["Contents"] == expected_html