測試無代理程式惡意代碼掃描警示

除了由基於代理的 Defender for Endpoint 與 適用於雲端的 Defender 整合所提供的次世代反惡意軟體保護外,Defender for Servers Plan 2 也提供無代理惡意軟體掃描功能。

本文說明如何建立測試警示,以確保無代理惡意軟體掃描如預期般運作。

Prerequisites

  • Defender for Servers Plan 2 已開啟。
  • 此方案已啟用無代理程式掃描。

建立 Linux 測試檔案

請依照以下步驟在 Linux 虛擬機(VM)上建立測試檔案,並觸發無代理惡意軟體掃描警報。

  1. 在虛擬機上開啟終端機視窗。

  2. 執行以下腳本來建立並驗證包含防毒測試字串的測試檔案:

    # test string  
    TEST_STRING='$$89-barbados-dublin-damascus-notice-pulled-natural-31$$'  
    
    # File to be created  
    FILE_PATH="/tmp/virus_test_file.txt"  
    
    # Write the test string to the file  
    echo -n $TEST_STRING > $FILE_PATH  
    
    # Check if the file was created and contains the correct string  
    if [ -f "$FILE_PATH" ]; then  
        if grep -Fq "$TEST_STRING" "$FILE_PATH"; then  
            echo "Virus test file created and validated successfully."  
        else  
            echo "Virus test file does not contain the correct string."  
        fi  
    else  
        echo "Failed to create virus test file."  
    fi
    

警示MDC_Test_File malware was detected (Agentless)會在 24 小時內出現在 適用於雲端的 Defender 警示頁面及 Defender 全面偵測回應 入口網站。

這是 適用於雲端的 Defender for Linux 中出現的測試警示截圖。

建立一個帶有文字文件的 Windows 測試檔案

請依照以下步驟建立一個 Windows 文字檔,觸發無代理惡意軟體掃描的測試警示。

  1. 在虛擬機上建立一個文字檔。

  2. 把文字 $$89-barbados-dublin-damascus-notice-pulled-natural-31$$ 貼到文字檔裡。 確保文字檔中沒有多餘的空格或行數。

  3. 儲存檔案。

  4. 打開檔案驗證是否包含貼上的測試字串。

警示MDC_Test_File malware was detected (Agentless)會在 24 小時內出現在 適用於雲端的 Defender 警示頁面及 Defender 全面偵測回應 入口網站。

因建立的文字檔案而在適用於雲端的 Windows Defender 中顯示的測試警示螢幕擷取畫面。

用 PowerShell 建立 Windows 測試檔

請使用以下 PowerShell 步驟建立 Windows 測試檔案並產生惡意軟體掃描測試警示。

  1. 在你的虛擬機上開啟 PowerShell。

  2. 執行以下腳本。

# Virus test string
$TEST_STRING = '$$89-barbados-dublin-damascus-notice-pulled-natural-31$$'

# File to be created
$FILE_PATH = "C:\temp\virus_test_file.txt"

# Create "temp" directory if it does not exist
$DIR_PATH = "C:\temp"
if (!(Test-Path -Path $DIR_PATH)) {
   New-Item -ItemType Directory -Path $DIR_PATH
}

# Write the test string to the file without a trailing newline
[IO.File]::WriteAllText($FILE_PATH, $TEST_STRING)

# Check if the file was created and contains the correct string
if (Test-Path -Path $FILE_PATH) {
    $content = [IO.File]::ReadAllText($FILE_PATH)
    if ($content -eq $TEST_STRING) {
      Write-Host "Test file created and validated successfully."
    } else {
       Write-Host "Test file does not contain the correct string."
    }
} else {
    Write-Host "Failed to create test file."
}

警示MDC_Test_File malware was detected (Agentless)會在 24 小時內出現在 適用於雲端的 Defender 警示頁面及 Defender 全面偵測回應 入口網站。

這是因為 PowerShell 腳本而出現在 適用於雲端的 Defender for Windows 中測試警示的截圖。