py amsi
1.11
Py-Amsiは、Windows Antimalware Scan Interface(AMSI)APIを使用して、マルウェアの文字列またはファイルをスキャンするライブラリです。 AMSIは、システムにインストールされているウイルス対策をファイル/文字列の分析に依頼できるように、アプリケーションがアプリケーションを要求できるようにするWindowsに固有のインターフェイスです。 AMSIはWindowsのディフェンダーに縛られていません。アンチウイルスプロバイダーは、AMSIインターフェイスを実装して、アプリケーションから呼び出しを受信します。このライブラリは、APIを利用して、Pythonでウイルス対策スキャンを行います。 Windows AMSI APIの詳細については、こちらをご覧ください。
ピップ経由
pip install pyamsi
クローンリポジトリ
git clone https://github.com/Tomiwa-Ot/py-amsi.git
cd py-amsi/
python setup.py install from pyamsi import Amsi
# Scan a file
Amsi . scan_file ( file_path , debug = True ) # debug is optional and False by default
# Scan string
Amsi . scan_string ( string , string_name , debug = False ) # debug is optional and False by default
# Both functions return a dictionary of the format
# {
# 'Sample Size' : 68, // The string/file size in bytes
# 'Risk Level' : 0, // The risk level as suggested by the antivirus
# 'Message' : 'File is clean' // Response message
# }| リスクレベル | 意味 |
|---|---|
| 0 | AMSI_RESULT_CLEAN(ファイルはクリーンです) |
| 1 | AMSI_RESULT_NOT_DETECTED(脅威は検出されません) |
| 16384 | amsi_result_blocked_by_admin_start(脅威は管理者によってブロックされます) |
| 20479 | amsi_result_blocked_by_admin_end(脅威は管理者によってブロックされます) |
| 32768 | AMSI_RESULT_DETECTED(ファイルはマルウェアと見なされます) |
https://tomiwa-ot.github.io/py-amsi/index.html