denyhosts/denyhosts.sh
aixiao 9421d1f1eb 修改获取公网IP方法,优化配置打印
修改:     Makefile
	修改:     README.md
	修改:     conf.c
	修改:     conf.h
	修改:     denyhosts.sh
	修改:     libiptc.c
	修改:     libiptc.h
	修改:     rhost.c
	修改:     rhost.conf
	修改:     rhost.h
2022-10-08 14:28:05 +08:00

64 lines
1.3 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
#
# System authorization information.
# SSH prevents violent cracking
# Email: aixiao@aixiao.me
# Time: 20170909
#
source /etc/profile
function init() {
SEND_MAIL=1
PWD_PATH="/root";
TIME=`date +"%Y%m%d%H%M"`;
LOG_FILE="${PWD_PATH}/${TIME}.log";
EMAIL_ADDRESS="1605227279@qq.com";
IPTABLES=$(which iptables)
IPTABLES_SAVE=$(which iptables-save)
}
function run()
{
echo "Read-Only Memory,ROM:" &>> ${LOG_FILE}
df -am &>> ${LOG_FILE}
echo "random access memoryRAM:" &>> ${LOG_FILE}
free -hl &>> ${LOG_FILE}
echo "System process:" &>> ${LOG_FILE}
ps -auxwwf &>> ${LOG_FILE}
echo "Network Connections" &>> ${LOG_FILE}
netstat -tnulp &>> ${LOG_FILE}
echo "System SSH authorization information:" &>> ${LOG_FILE}
/root/denyhosts/rhost | awk '{a[$1]+=1;} END {for(i in a){print a[i]" "i;}}' &>> ${LOG_FILE}
$IPTABLES_SAVE > /root/ipv4tables
echo "" &>> ${LOG_FILE}
echo "Iptables filter table" &>> ${LOG_FILE}
$IPTABLES -L -n --line-numbers &>> ${LOG_FILE}
echo "" &>> ${LOG_FILE}
if test $SEND_MAIL = 1; then
mail -s "System Log" ${EMAIL_ADDRESS} < ${LOG_FILE}
rm ${LOG_FILE}
fi
sync
}
init;
run;
exit 0;
20190103
20190911
20191008
20210614
aixiao@aixiao.me