linux主机应急排查
Posted bingtang123
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux主机应急排查相关的知识,希望对你有一定的参考价值。
虚拟机测试如下
1.端口
sudo netstat -antlp|more
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-e501c15867f20a0b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
2.进程
ps aux | grep pid
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-4a587254c2a00884.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
3.查看内存和cpu
vmstat -a#查看内存和CPU使用情况
vmstat -s#查看内存和CPU使用详情
vmstat -d#查看读写IO情况
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-d42989592134e5aa.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
ps aux|head -1;ps aux|grep -v PID|sort -rn -k +3|head # 查看CPU使用前十名
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-f7c587082e579ab6.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
ps aux|head -1;ps aux|grep -v PID|sort -rn -k +4|head#查看内存使用前十名
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-36f734775ee93b89.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
4.进程关联账户信息
lsof
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-95de39f1d400c86d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
5.进程消耗
top #查看进程性能资源消耗
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-62bed3b4b368b137.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
6.定时任务
crontab -l 列出内容
crontab -r 删除所有的计划任务
crontab -e 使用编辑器编辑当前的crontab文件
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-119e7cc8c9a99da4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
7.日志
last#登录或重启日志
lastb#登录失败日志
lastlog #各个账户最后登录信息
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-735cf52f94515d55.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
who /var/log/wtmp #登录日志
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-cee89ae2d181dc14.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
8.账户
cat /etc/passwd 账户
awk -F: ‘$3==0 {print $1}‘ /etc/passwd 查看特权账户
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-5ca40ca3087161cc.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-b8bf09aef3c4ece0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
9.webshell检测
find /var/www/html/ -type f -name "*.jsp" | xargs grep "exec"
或者拷贝windows进行D盾检测
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-a87d604f138fb4fb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
10.后门检测 rkhunter
tar -zxvf rkhunter-1.4.6.tar.gz
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-07a66f52df757b36.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
cd rkhunter-1.4.6
./installer.sh --layout default --install
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-d75ce6eb344ff76f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
rkhunter -c
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-0119570427c3a963.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
以上是关于linux主机应急排查的主要内容,如果未能解决你的问题,请参考以下文章