应急响应。
应急响应:
windows 入侵检测
检查可疑账号
打开 cmd 窗口,输入 lusrmgr.msc 命令,查看是否有新增/可疑的账号

w 查看系统信息,想知道某一时刻用户的行为
uptime 查看登陆多久、多少用户,负载状态
历史命令
基本使用:
1、root 用户的历史命令
histroy
2、打开 /home 各帐号目录下的 .bash_history,查看普通帐号执行的历史命令。
为历史的命令增加登录的 IP 地址、执行命令时间等信息:
1)保存1万条命令
sed -i 's/^HISTSIZE=1000/HISTSIZE=10000/g' /etc/profile
2)在/etc/profile的文件尾部添加如下行数配置信息:
######jiagu history xianshi#########
USER_IP=`who -u am i 2>/dev/null | awk '{print $NF}' | sed -e 's/[()]//g'`
if [ "$USER_IP" = "" ]
then
USER_IP=`hostname`
fi
export HISTTIMEFORMAT="%F %T $USER_IP `whoami` "
shopt -s histappend
export PROMPT_COMMAND="history -a"
######### jiagu history xianshi ##########
3)source /etc/profile 让配置生效
生成效果: 1 2018-07-10 19:45:39 192.168.204.1 root source /etc/profile
3、历史操作命令的清除:history -c
但此命令并不会清除保存在文件中的记录,因此需要手动删除 .bash_profile 文件中的记录。
入侵排查:
进入用户目录下,导出历史命令。
cat .bash_history >> history.txt
检查异常端口
使用 netstat 网络连接命令,分析可疑端口、IP、PID
netstat -antlp | more
查看下 pid 所对应的进程文件路径,
运行 ls -l /proc/$PID/exe 或 file /proc/$PID/exe($PID 为对应的 pid 号)
检查开机启动项
系统运行级别示意图:
入侵排查:
启动项文件:
more /etc/rc.local
/etc/rc.d/rc[0~6].d
ls -l /etc/rc.d/rc3.d/
suid提权
find 1.txt -exec whoami \;
封ip
cat deny_ssh.sh
IP=$(awk '/Failed password/ {IP[$(NF-3)]++} END { for (k in IP) { if (IP[k]>=4) print k }}' /var/log/auth.log)
for i in $IP
dotmpIP=(`iptables -L -n | tr -s " " | awk '/^DROP/ && /22$/ {print $4}'`)echo ${tmpIP[@]} | grep -qw $iif [ $? -ne 0 ]theniptables -I INPUT -p tcp --dport 22 -s $i -j DROP fi
done