安装方法见:/security/php-malware-finder/
软件安装在:/root/php-malware-finder/中,目录文件结构如下:
其中data目录就是存放规则的目录
root@LG:~/php-malware-finder# tree
.
├── CONTRIBUTING.md
├── Dockerfile
├── LICENSE
├── Makefile
├── README.md
├── data
│ ├── php.yar
│ ├── samples
│ │ ├── artificial
│ │ │ ├── bypasses.php
│ │ │ ├── dodgy.php
│ │ │ └── obfuscated.php
│ │ ├── classic
│ │ │ ├── ajaxshell.php
│ │ │ ├── angel.php
│ │ │ ├── b374k.php
│ │ │ ├── c100.php
│ │ │ ├── c99.php
│ │ │ ├── cyb3rsh3ll.php
│ │ │ ├── r57.php
│ │ │ ├── simattacker.php
│ │ │ └── sosyete.php
│ │ ├── cpanel.php
│ │ ├── freepbx.php
│ │ ├── obfuscators
│ │ │ ├── cipher_design.php
│ │ │ ├── online_php_obfuscator.php
│ │ │ └── phpencode.php
│ │ ├── real
│ │ │ ├── awvjtnz.php
│ │ │ ├── exceptions.php
│ │ │ ├── guidtz.php
│ │ │ ├── ice.php
│ │ │ ├── include.php
│ │ │ ├── nano.php
│ │ │ ├── ninja.php
│ │ │ ├── novahot.php
│ │ │ ├── srt.php
│ │ │ └── sucuri_2014_04.php
│ │ └── undetected
│ │ └── smart.php
│ ├── whitelist.yar
│ └── whitelists
│ ├── custom.yar
│ ├── drupal.yar
│ ├── magento1ce.yar
│ ├── magento2.yar
│ ├── phpmyadmin.yar
│ ├── prestashop.yar
│ ├── symfony.yar
│ └── wordpress.yar
├── go.mod
├── go.sum
├── main.go
├── php-malware-finder
├── tests.sh
└── utils
├── generate_whitelist.py
├── magento1_whitelist.sh
├── magento2_whitelist.sh
└── mass_whitelist.py
在此目录中执行以下命令:
1、更新规则
(目前无法更新规则,不需要执行下面命令)
cd /root/php-malware-finder/;
./php-malware-finder --update --rules-dir=./data;
2、扫描目录
基本扫描命令
1. 扫描单个目录(递归检测所有文件)
./php-malware-finder -v -r ./data /path/to/your/suspicious_dir
-v:显示详细匹配内容(推荐)-r ./rules:指定规则目录(必须)- 最后参数是目标目录路径
2. 扫描单个文件
./php-malware-finder -v -r ./data /path/to/file.php
3. 快速扫描(跳过大于2MB的文件)
./php-malware-finder --quick -r ./data /path/to/dir
🎯 高级用法
1. 只显示确认为恶意的文件(过滤误报)
./php-malware-finder -r ./data /path/to/dir | grep -B1 "Confidence: 10"
grep -B1会显示匹配行及其前一行(文件名)
2. 保存扫描结果到日志文件
./php-malware-finder -v -r ./data /path/to/dir > scan_report.txt 2>&1
3. 排除特定目录(如缓存目录)
./php-malware-finder -r ./data --exclude-dir=cache /path/to/dir
📊 结果解读
- 正常输出示例:bash[+] File: /target/path/shell.php Detected: PHP_Backdoor_eval_POST Match: eval($_POST[‘cmd’]); Confidence: 10/10 # 置信度越高威胁越大
- 无威胁输出:bash[-] Scanned 142 files, 0 detections.