
Scansiona stringhe o file alla ricerca di malware utilizzando l'interfaccia Windows Antimalware Scan Interface
py-amsi è una libreria che analizza stringhe o file alla ricerca di malware utilizzando l'API Windows Antimalware Scan Interface (AMSI). AMSI è un'interfaccia nativa di Windows che consente alle applicazioni di chiedere all'antivirus installato sul sistema di analizzare un file/stringa. AMSI non è legato a Windows Defender. I fornitori di antivirus implementano l'interfaccia AMSI per ricevere chiamate dalle applicazioni. Questa libreria sfrutta l'API per eseguire scansioni antivirus in Python. Leggi di più sull'API Windows AMSI qui.
Tramite pip
pip install pyamsi
Clona il repository
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
# }
| Livello di Rischio | Significato |
|---|---|
| 0 | AMSI_RESULT_CLEAN (File pulito) |
| 1 | AMSI_RESULT_NOT_DETECTED (Nessuna minaccia rilevata) |
| 16384 | AMSI_RESULT_BLOCKED_BY_ADMIN_START (Minaccia bloccata dall'amministratore) |
| 20479 | AMSI_RESULT_BLOCKED_BY_ADMIN_END (Minaccia bloccata dall'amministratore) |
| 32768 | AMSI_RESULT_DETECTED (File considerato malware) |