共用方式為


在 macOS 和 Linux 上執行用戶端分析器

適用於:

XMDEClientAnalyzer 可用來診斷適用於端點Microsoft Defender 健康情況,或執行 Linux 或 macOS 的上線裝置上的可靠性問題。

有兩種方式可以執行用戶端分析器工具:

  1. 使用二進位版本 (沒有 Python 相依性)
  2. 使用以 Python 為基礎的解決方案

執行用戶端分析器的二進位版本

  1. XMDE 用戶端分析器二進位 工具下載到您需要調查的 macOS 或 Linux 機器。
    如果您使用終端機,請輸入下列命令來下載工具:

    wget --quiet -O XMDEClientAnalyzerBinary.zip https://aka.ms/XMDEClientAnalyzerBinary
    
  2. 確認下載。

    注意事項

    從此鏈接下載的 'XMDEClientAnalyzerBinary.zip' 目前 SHA256 哈希為:'51EC534507729D3A5056D596644FE5768BF1CCED266C8AC514CFCF11A6F12B97'

    • Linux
    echo '51EC534507729D3A5056D596644FE5768BF1CCED266C8AC514CFCF11A6F12B97 XMDEClientAnalyzerBinary.zip' | sha256sum -c
    
    • macOS
    echo '51EC534507729D3A5056D596644FE5768BF1CCED266C8AC514CFCF11A6F12B97  XMDEClientAnalyzerBinary.zip' | shasum -a 256 -c
    
  3. 擷取電腦上 XMDEClientAnalyzerBinary.zip 的內容。

    如果您使用終端機,請輸入下列命令來擷取檔案:

    unzip -q XMDEClientAnalyzerBinary.zip -d XMDEClientAnalyzerBinary
    
  4. 輸入下列命令以變更工具的目錄:

    cd XMDEClientAnalyzerBinary
    
  5. 系統會產生三個新的 zip 檔案:

    • SupportToolLinuxBinary.zip :適用於所有 Linux 裝置
    • SupportToolMacOSBinary.zip :適用於 Mac 裝置
  6. 根據您需要調查的計算機,解壓縮上述 2 個 zip 檔案的其中一個。
    使用終端機時,請根據 OS 類型輸入下列其中一個命令來解壓縮檔案:

    • Linux

      unzip -q SupportToolLinuxBinary.zip
      
    • Mac

      unzip -q SupportToolMacOSBinary.zip
      
  7. root 身分 執行工具以產生診斷封裝:

    sudo ./MDESupportTool -d
    

執行以 Python 為基礎的用戶端分析器

注意事項

  • 分析器相依於幾個額外的 PIP 套件, (sh、distro、lxml、pandas) 在根目錄中時會安裝在操作系統中,以產生結果輸出。 如果未安裝,分析器會嘗試從 Python 套件的官方存放庫擷取它。

    警告

    執行 Python 型用戶端分析器需要安裝 PIP 套件,這可能會在您的環境中造成一些問題。 若要避免發生問題,建議您將套件安裝到使用者 PIP 環境中。

  • 此外,此工具目前需要安裝 Python 第 3 版或更新版本。

  • 如果您的裝置位於 Proxy 後方,則可以直接將 Proxy 伺服器當作環境變數傳遞至mde_support_tool.sh腳本。 例如:。 https_proxy=https://myproxy.contoso.com:8080 ./mde_support_tool.sh"

  1. XMDE 用戶端分析器 工具下載到您需要調查的 macOS 或 Linux 機器。

    如果您使用終端機,請執行下列命令來下載工具:

    wget --quiet -O XMDEClientAnalyzer.zip https://aka.ms/XMDEClientAnalyzer
    
  2. 確認下載

    • Linux
    echo '2B8EBB39857BA24E84E332366B42E041B46AB130F8C8FD4E6D68B195022FD61E XMDEClientAnalyzer.zip' | sha256sum -c
    
    • macOS
    echo '2B8EBB39857BA24E84E332366B42E041B46AB130F8C8FD4E6D68B195022FD61E  XMDEClientAnalyzer.zip' | shasum -a 256 -c
    
  3. 擷取電腦上 XMDEClientAnalyzer.zip 的內容。 如果您使用終端機,請使用下列命令來擷取檔案:

    unzip -q XMDEClientAnalyzer.zip -d XMDEClientAnalyzer
    
  4. 將目錄變更為擷取的位置。

    cd XMDEClientAnalyzer
    
  5. 授與工具可執行檔案權限:

    chmod a+x mde_support_tool.sh
    
  6. 以非根使用者身分執行,以安裝必要的相依性:

    ./mde_support_tool.sh
    
  7. 若要收集實際的診斷封裝併產生結果封存盤案,請以 root 身分再次執行:

    sudo ./mde_support_tool.sh -d
    

命令行選項

主要命令行

使用下列命令來取得機器診斷。

-h, --help            show this help message and exit
--output OUTPUT, -o OUTPUT
                      Output path to export report
--outdir OUTDIR       Directory where diagnostics file will be generated
--no-zip, -nz         If set a directory will be created instead of an archive file
--force, -f           Will overwrite if output directory exists
--diagnostic, -d      Collect extensive machine diagnostic information
--bypass-disclaimer   Do not display disclaimer banner
--interactive, -i     Interactive diagnostic
--delay DELAY, -dd DELAY
                      Set MDATP log level. If you use interactive or delay mode, the log level will set to debug automatically, and reset after 48h.
--mdatp-log {info,debug,verbose,error,trace,warning}
                      Set MDATP log level
--max-log-size MAX_LOG_SIZE
                      Maximum log file size in MB before rotating(Will restart mdatp)

使用範例: sudo ./MDESupportTool -d

注意:記錄層級自動重設功能僅適用於 2405 或較新的用戶端版本。

位置自變數

收集效能資訊

收集廣泛的機器效能追蹤,以分析可視需要重現的效能案例。

-h, --help            show this help message and exit
--frequency FREQUENCY
                      profile at this frequency
--length LENGTH       length of time to collect (in seconds)

使用範例: sudo ./MDESupportTool performance --frequency 2

僅針對macOS使用OS追蹤 ()

使用OS追蹤功能來記錄適用於端點的Defender效能追蹤。

注意事項

這項功能僅存在於 Python 解決方案中。

-h, --help       show this help message and exit
--length LENGTH  Length of time to record the trace (in seconds).
--mask MASK      Mask to select with event to trace. Defaults to all

第一次執行此命令時,它會安裝配置檔組態。

請遵循此命令來核准配置檔安裝: Apple 支援指南

使用範例 ./mde_support_tool.sh trace --length 5

排除模式

新增 audit-d 監視的排除專案。

注意事項

這項功能僅適用於Linux。

  -h, --help            show this help message and exit
  -e <executable>, --exe <executable>
                        exclude by executable name, i.e: bash
  -p <process id>, --pid <process id>
                        exclude by process id, i.e: 911
  -d <directory>, --dir <directory>
                        exclude by target path, i.e: /var/foo/bar
  -x <executable> <directory>, --exe_dir <executable> <directory>
                        exclude by executable path and target path, i.e: /bin/bash /var/foo/bar
  -q <q_size>, --queue <q_size>
                        set dispatcher q_depth size
  -r, --remove          remove exclusion file
  -s, --stat            get statistics about common executables
  -l, --list            list auditd rules
  -o, --override        Override the existing auditd exclusion rules file for mdatp
  -c <syscall number>, --syscall <syscall number>
                        exclude all process of the given syscall

使用範例: sudo ./MDESupportTool exclude -d /var/foo/bar

稽核速率限制器

可用來限制 auditD 外掛程式所報告事件數目的語法。 此選項會全域設定 AuditD 的速率限制,以造成所有稽核事件的下降。 啟用限制器時,稽核的事件數目限制為每秒 2500 個事件。在我們看到 AuditD 端的 CPU 使用率偏高時,可以使用此選項。

注意事項

這項功能僅適用於Linux。

-h, --help                                  show this help message and exit
-e <true/false>, --enable <true/false>      enable/disable the rate limit with default values

使用範例: sudo ./mde_support_tool.sh ratelimit -e true

注意事項

此功能應謹慎使用,以限制稽核子系統整體報告的事件數目。 這也可以減少其他訂閱者的事件數目。

AuditD 略過錯誤規則

這個選項可讓您在載入稽核規則檔案時略過新增的錯誤規則。 此選項可讓稽核的子系統繼續載入規則,即使有錯誤的規則也一致。 此選項摘要說明載入規則的結果。 在背景中,此選項會使用 -c 選項來執行 auditctl。

注意事項

此功能僅適用於Linux。

-h, --help                                  show this help message and exit
-e <true/false>, --enable <true/false>      enable/disable the option to skip the faulty rules. In case no argumanet is passed, the option will be true by default.

使用範例: sudo ./mde_support_tool.sh skipfaultyrules -e true

注意事項

這項功能將會略過錯誤的規則。 然後必須進一步識別並修正錯誤的規則。

macOS 和 Linux 上的結果套件內容

  • report.html

    描述:主要 HTML 輸出檔案,其中包含分析器腳本在計算機上執行時可產生的結果和指引。

  • mde_diagnostic.zip

    描述:在macOSLinux上執行 mdatp 診斷建立時所產生的相同診斷輸出。

  • mde.xml

    描述:執行 時所產生的 XML 輸出,並用來建置 html 報表檔案。

  • Processes_information.txt

    描述:包含在系統上執行Microsoft適用於端點的Defender相關程式的詳細數據。

  • Log.txt

    描述:包含數據收集期間在畫面上寫入的相同記錄訊息。

  • Health.txt

    描述:執行 mdatp health 命令時所顯示的相同基本健康情況輸出。

  • Events.xml

    描述:分析器在建置 HTML 報表時所使用的其他 XML 檔案。

  • Audited_info.txt

    描述: Linux OS 稽核服務和相關元件的詳細數據。

  • perf_benchmark.tar.gz

    描述:效能測試報告。 只有當您使用效能參數時,才會看到此狀況。

提示

想要深入了解? 在我們的技術社群中與Microsoft安全性社群互動:Microsoft適用於端點的Defender技術社群。