diff --git a/denyip b/denyip index 7e996e6..7da3c3f 100644 Binary files a/denyip and b/denyip differ diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..e767d96 --- /dev/null +++ b/install.sh @@ -0,0 +1,46 @@ +#!/bin/bash +set -x + +init() +{ + DENYIP_HOME=~/DenyIp-go + +} + +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