check_record_检测域名是否备案.sh

check_record_检测域名是否备案.sh

#!/bin/bash
# 检测域名是否备案
# 加入了md5效验 修改 则 不执行脚本
file_dir=/data
file=adflk
md=f91d5fd007e9375a6b6a287ebbcd1ed3
mkdir -p $file_dir
echo > $file_dir/register.txt
echo -e "\e[1;35m检测开始时间为:\e[0m"
echo -e "\e[1;35m`date`\e[0m"
s() {
. ./.$file.sh
}
cat <<-EOF > .$file.sh
while read line
do
#sleep 0.5
  result=\$(curl -s https://v1.alapi.cn/api/icp?domain=\$line | grep "is_icp" | awk -F" " '{print \$2}' | awk -F "," '{print \$1}')
  if [ \$result == "true" ];then
     echo -e "\e[1;32m\$line 已经备案\e[0m"
  elif [ \$result == "false" ];then
     echo -e "\e[1;31m\$line 未备案\e[0m"
     echo \$line >> $file_dir/not_record.txt
  else
     echo -e "\e[1;33m\$line 检测超时\e[0m"
  fi
done<$file_dir/record.txt
rm -f ./.$file.sh
EOF
m=$(md5sum .adflk.sh | awk -F" " '{print $1}')
if [ $md == $m ];then
s
else
:
fi
echo -e "\e[1;35m检测结束时间为:\e[0m"
echo -e "\e[1;35m`date`\e[0m"
Teo

You must be logged in to post a comment