本文共 3137 字,大约阅读时间需要 10 分钟。
cat /etc/passwd
(1)找到命令文件的路径(whereis和which)
whereis netstatwhich netstat
which netstat/bin/netstatwhereis netstatnetstat: /bin/netstat /usr/share/man/man8/netstat.8.gz
(2)观察命令的属性,主要看修改时间和大小(stat和ll)
stat /bin/netstatll -h /bin/ps -rwxr-xr-x. 1 root root 81K Nov 15 2012 /bin/ps
如果发现命令异常,可能被篡改,可以上传到微步鉴别一下。为了排除干扰,建议从其他正常系统中拷贝命令集使用。
stat 可以查看文件的访问、修改、改变时间
对文件使用more\less\cat命令后文件的访问时间分别变化为最后一次访问的时间,而文件的修改时间和改变时间并没有发生变化。stat /bin/netstatFile: `/bin/netstat'Size: 123360 (Byte) Blocks: 248 IO Block: 4096 regular fileDevice: fc01h/64513d Inode: 5219 Links: 1Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)Access: 2018-05-07 17:00:50.927556605 +0800Modify: 2012-05-10 16:17:33.000000000 +0800Change: 2015-11-17 18:47:03.594999914 +0800
观察文件大小,如果特别大即有可能异常
观察列出的第三行最后改动时间,如果为事发时间附近即有可能异常(1)显示文件attrtest隐藏属性
lsattr attrtest
(2)给文件attrtest添加或者删除i属性
chattr +i attrtestchattr -i attrtest
ls -l ~/.bash_history
在你执行了上述的命令后你将看到类似以下的正常输出:
-rw—— 1 jd jd 13829 Oct 10 17:06 /home/jd/.bash_history
如果你看到以下的输出:
lrwxrwxrwx 1 jd jd 9 Oct 10 19:40 /home/jd/.bash_history -> /dev/null
表明这个 .bash_history 文件已经被重定向到/dev/null.这是一个致命的信息。
如何清空历史记录history?
linux 清空history以及记录原理
1、当前session执行的命令,放置缓存中,执行exit时,把缓存信息写入~/.bash_history2、当session直接被kill时,缓存中的历史命令不会写入~/.bash_history3、正确清空当前用户的history的方法~/.bash_history
history -c #清空当前缓存中的命令exit #关闭shell连接,可以避免写入~/.bash_history#执行exit,会把该命令记录到~/.bash_history文件去"
env
cat /etc/motd 切数据,勒索的多用
(1)lastlast | grep rebootlast | grep shutdown(2)messages log在/var/log/messages日志中查询reboot (系统重启) 或者halt(系统关机)grep reboot /var/log/messagesgrep halt /var/log/messages
(1)根据TTY提出可疑用户:pkill -kill -t tty1
kill -9 31685
(3)修改用户密码 修改user1的密码passwd user1修改当前用户的密码passwd
删除文件夹:
rm -rf /var/log/httpd/access将会删除/var/log/httpd/access目录以及其下所有文件、文件夹
删除文件:
rm -f /var/log/httpd/access.log将会强制删除/var/log/httpd/access.log这个文件
iptables相关使用说明
(1)保存iptables配置service iptables save
(2)关闭、开启、重启防火墙 /etc/init.d/iptables stop/etc/init.d/iptables start/etc/init.d/iptables restart/etc/init.d/iptables status
service iptables startservice iptables stopservice iptables restartservice iptables status
(3)凡是对iptables做完修改都应该保存设置并重启
(4)查看Iptables转发规则:cat /etc/sysconfig/iptables或者service iptables status
iptables -L列出规则iptables -L -n -v" "Iptables规则:只允许192.168段的IP访问iptables -A INPUT -p tcp --dport 54321 -j DROPiptables -A INPUT -p tcp -s 192.168.0.0/16 --dport 54321 -j ACCEPT 或iptables -I INPUT -p tcp --dport 11211 -j DROPiptables -I INPUT -s 192.168.0.0/16 -p tcp --dport 11211 -j ACCEPTservice iptables saveservice iptables restart
Iptables删除规则iptables -D INPUT -p tcp --dport 11211 -j DROP
重启网卡 "启动、关闭、重启网卡eth0ifconfig eth0 upifconfig eth0 downifconfig eth0 down && ifconfig eth0 upifdown eth0 ifup eth0
启动、关闭、重启所有网卡service network restartservice network startservice network stopsystemctl restart network
一些情况下service命令会收给root使用,而普通用户在特定情况下仍可以使用ifconfig。
转载于:https://blog.51cto.com/winhe/2114799