日志及定时任务
#检查登录日志grep "password" /var/log/secure* | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' |sort |uniq -c#查看所有用户crontabfor i in `cat /etc/passwd |awk -F':' '{print $1}'`;do crontab -l -u $i;done#登录失败的用户统计lastb root | awk '{print $3}' | sort | uniq -c | sort -nr| more
用户检查
awk -F":" '{if($3 == 0){print $1}}' /etc/passwdawk -F: '{if(length($2)==0) {print $1}}' /etc/passwd
文件检查
find / -uid 0 -perm 4000 -print
隐藏端口检查
yum install unhide -yunhideunhide-tcp
进程检查
netstat -ntlupps -ef | awk '{print $2}'| sort -n | uniq >1; ls /proc |sort -n|uniq >2;diff -y -W 40 1 2
后门检测工具
#1. rkhunteryum install -y rkhunterrkhunter -c#2. chkrootkityum -y install gcc gcc-c++ make cmake glibc-static glibc-utilswget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gztar zxvf chkrootkit.tar.gzmake sensechkrootkit -q
抓包获取异常连接
tcpdump -i em1 -nntcpdump -i em1 -nn '((tcp) and (port 22)) and (not dst net 10.0)'
参考