说明
- 安装依赖:
pip install yara-python - 确定需要扫描的 Web 服务器文档根目录(如
/var/www/html、/opt/lampp/htdocs)。 - 运行 Agent 扫描 Webshell:
- 香农熵分析标记熵值 > 5.5 的文件
- 模式匹配检测 eval()、base64_decode()、system()、passthru()、shell_exec()
- 文件修改时间分析发现近期变更的文件
- 扩展名过滤针对 .php、.jsp、.asp、.aspx、.cgi、.py 文件
python scripts/agent.py --webroot /var/www/html --output webshell_report.json
示例
高熵 PHP Webshell 检测
File: /var/www/html/uploads/img_thumb.php
Entropy: 6.12 (threshold: 5.5)
Patterns matched: eval(), base64_decode(), str_rot13()
Last modified: 2025-12-01 03:42:00 (outside business hours)
Verdict: SUSPICIOUS - likely obfuscated webshell