
Escanea cadenas o archivos en busca de malware utilizando la Interfaz de Escaneo Antimalware de Windows
py-amsi es una biblioteca que escanea cadenas o archivos en busca de malware utilizando la API de la Interfaz de Escaneo Antimalware de Windows (AMSI). AMSI es una interfaz nativa de Windows que permite a las aplicaciones solicitar al antivirus instalado en el sistema que analice un archivo/cadena. AMSI no está vinculado a Windows Defender. Los proveedores de antivirus implementan la interfaz AMSI para recibir llamadas de las aplicaciones. Esta biblioteca aprovecha la API para realizar escaneos antivirus en Python. Lea más sobre la API de Windows AMSI aquí.
Mediante pip
pip install pyamsi
Clonar repositorio
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
# }
| Nivel de Riesgo | Significado |
|---|---|
| 0 | AMSI_RESULT_CLEAN (El archivo está limpio) |
| 1 | AMSI_RESULT_NOT_DETECTED (No se detectó amenaza) |
| 16384 | AMSI_RESULT_BLOCKED_BY_ADMIN_START (Amenaza bloqueada por el administrador) |
| 20479 | AMSI_RESULT_BLOCKED_BY_ADMIN_END (Amenaza bloqueada por el administrador) |
| 32768 | AMSI_RESULT_DETECTED (El archivo se considera malware) |