在 Linux 下,strings 本身不能直接杀毒或判定病毒,但它是一个非常有用的初步分析工具,用来从二进制文件中提取可读字符串,帮助你发现可疑线索。
下面按「思路 + 实战命令 + 判断要点」来说明。
/bin/sh, wget, curl)/etc/rc.local, cron)clamav、rkhunter 等专用工具strings suspicious_file
strings -n 6 suspicious_file
strings suspicious_file | grep -Ei "wget|curl|/bin/sh|/etc|base64|http"
如果你在 strings 输出中看到这些,要高度怀疑:
http://
https://
wget
curl
socket
connect
/bin/sh
/bin/bash
system(
execve
/etc/cron
crontab
rc.local
systemd
ssh authorized_keys
gdb
ptrace
anti-debug
vmware
file unknown_bin
strings -n 6 unknown_bin | grep -Ei "http|wget|/bin/sh|passwd"
for f in *; do
if file "$f" | grep -q ELF; then
echo "=== $f ==="
strings -n 6 "$f" | grep -Ei "wget|curl|/bin/sh"
fi
done
strings /var/log/syslog | grep -i "curl"
strings 只是第一步,建议组合使用:
# 查杀毒
clamscan -r /path
# 查 rootkit
rkhunter --check
# 查进程
ps aux | grep -i suspicious
strings 看“意图”,不是“结论”如果你愿意,可以把:
strings 的部分输出发给我,我可以帮你逐行分析是否像病毒。