2025-01-13 15:57:35 +08:00
|
|
|
#!/bin/bash
|
|
|
|
set -x
|
|
|
|
|
|
|
|
init()
|
|
|
|
{
|
2025-01-14 15:20:23 +08:00
|
|
|
DENYIP_HOME=~/DenyIP-go
|
2025-01-13 15:57:35 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
if ! test -d $DENYIP_HOME; then
|
|
|
|
mkdir -p $DENYIP_HOME
|
|
|
|
mkdir -p $DENYIP_HOME/ip2region
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! test -f ~/DenyIp/ip2region/ip2region.xdb; then
|
|
|
|
wget -O $DENYIP_HOME/ip2region/ip2region.xdb https://git.aixiao.me/aixiao/DenyIP-go/raw/branch/main/ip2region/ip2region.xdb
|
|
|
|
|
|
|
|
if test "$(md5sum $DENYIP_HOME/ip2region/ip2region.xdb | cut -d " " -f 1)" != "508c6b0257a02152b9d1b2b3792936e1"; then
|
|
|
|
echo "ip2region.xdb md5 check fail"
|
|
|
|
rm -rf $DENYIP_HOME
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "ip2region.xdb md5 check success"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! test -f ~/DenyIp/denyip; then
|
|
|
|
wget -O $DENYIP_HOME/denyip https://git.aixiao.me/aixiao/DenyIP-go/raw/branch/main/denyip
|
|
|
|
chmod +x $DENYIP_HOME/denyip
|
|
|
|
|
|
|
|
if test -n "$(file $DENYIP_HOME/denyip | grep ELF)"; then
|
|
|
|
echo "denyip install success"
|
|
|
|
else
|
|
|
|
echo "denyip install fail"
|
|
|
|
rm -rf $DENYIP_HOME
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
init
|
|
|
|
main $@
|
|
|
|
exit 0
|