用shell对指定站点进行简单的实时入侵预警
source link: http://www.10tiao.com/html/665/201807/2650448460/3.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
#!/bin/bash
# author by klion
# 2017.12.25
# Real-time monitoring of Web Directory script
web_dir="/usr/local/nginx/html/bwapp/bWAPP/"
oldnum=`wc -l web_history_db.log | awk -F " " '{print $1}'`
newnum=`find $web_dir -type f | wc -l`
md5num=`md5sum -c web_history_db.log | grep -i FAILED | wc -l`
# 先对指定的站点目录创建指纹库
[ ! -f web_history_db.log ] && {
find $web_dir -type f | xargs md5sum > ./web_history_db.log
}
# 和新文件对比指纹,如果发现不对,就马上发信通知,并带上被改动的文件路径一起
[ $md5num -ne 0 ] && {
md5sum -c web_history_db.log | grep -i "FAILED" | awk -F ":" '{print $1}' > web_mod_`date +%Y-%m-%d-%H-%M-%S`.web.log
log_file=`ls -l *.web.log | head -n 1 | awk -F " " '{print $9}'`
mail -s "Your website may be hacked, Please check it as soon as possible" [email protected] < $log_file;sleep 5
rm -fr $log_file
}
# 对比文件个数,发现不对,同样是立马发信,因为有可能要同时监控很多个站点目录,所以就顺便把具体的站点路径也带上了
[ $oldnum -ne $newnum ] && {
echo "website directory is $web_dir" | mail -s "web directory have new file created " [email protected] ;sleep 5
}
后话:
小脚本实现的功能非常简单,只要所指定的站点目录下有任何的文件属性变化,包括,新文件或目录的增删改查以及对现有文件的篡改,就会自动向管理员发信报警,此处只是为了快速实现效果,所以就直接用shell搞了,实际要想用,也可自行用python写的更完善一些 ^_^
文章出处:klion's blog
原文链接:https://klionsec.github.io/2017/12/25/modify-hacked/
你可能喜欢
Recommend
-
12
利用Weblogic进行入侵的一些总结 DC3 ·
-
38
作者:Matthijs Hollemans, 原文链接 ,原文日期:2018/03/28 译者: 阳仔 ;校对:
-
30
Flink 1.9.0及更高版本支持Python,也就是PyFlink。 在最新版本的Flink 1.10中,PyFlink支持Python用户定义的函数,使您能够在Table A...
-
5
苹果AirTag首次被破解 可进行任何入侵操作! 2021年05月10日14:01 新浪科技 我有话说(7人参与) 收藏本文 ...
-
5
跟谁学 | PM实时协作,项目管理从未如此简单2019/2/26#客户案例从古至今,拜师学艺就是一件人生大事。有人是为学习一门谋生的本领,有人是为学习一项特长技艺,所谓“一日为师,终身为父”,可见拜师学艺是...
-
4
V2EX › Linux debian 系统下,有没有简单的办法检测指定网卡配置是 dhcp/static/manual? skinny
-
4
实时监测、提前预警......疫情防控管理平台上线发挥大作用华数导语:上虞疫情防控管理平台是华数集团下属中广(绍兴上虞)公司...
-
0
想要站点文章被百度收录,最快的方法就是主动推送文章链接到 百度站长平台 。 目前 百度站长平台 提供了5种提交链接的方式:
-
1
对Github指定类目的内容进行监控和推送 - 春告鳥 - 博客园 很久之前看到HACK学习呀有一个Github 安全搬运工的系列文章,个...
-
1
简单的股票行情展示演示(一) - 实时标的数据
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK