Skip to content

Instantly share code, notes, and snippets.

@wen-long
Last active November 18, 2019 03:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wen-long/324459d17d72d2260003 to your computer and use it in GitHub Desktop.
Save wen-long/324459d17d72d2260003 to your computer and use it in GitHub Desktop.
QQWry.Dat is the ip database from http://www.cz88.net/ the website which offers the original code seems won't update any more and the download link refers to another obsolete website original script was from https://www.surfchen.org/nali but it was obsolete because the download link https://chenze.name/wenjian/QQWry.Dat offers an obsolete file a…
#!/bin/sh
qqwry_dat_url="http://update.cz88.net/soft/setup.zip";
qqwry_dat_local_path="/usr/local/share/QQWry.Dat"
curl=`which curl`
wget=`which wget`
workdir="/tmp/QQWry/"
zipname="QQWry.setup.zip"
ismodified=`curl -s -I --header "If-Modified-Since: \`date -R -u -r /usr/local/share/QQWry.Dat | sed 's/+0000/GMT/'\`" http://update.cz88.net/soft/setup.zip | grep "HTTP/1.1 304 Not Modified" | wc -l`
if [ $ismodified = 1 ] ; then echo "No update needed" && exit 0; fi
echo "Update needed"
if ! test -w $qqwry_dat_local_path
then
echo can not write to $qqwry_dat_local_path
exit 1
fi
mkdir $workdir
if test "x$curl" != "x" && test -x $curl
then
command="$curl -k --compressed $qqwry_dat_url -o ${workdir}${zipname}"
elif test "x$wget" != "x" && test -x $wget
then
command="$wget --no-check-certificate $qqwry_dat_url -O ${workdir}${zipname}"
else
echo Error: Please install curl or wget
exit 1
fi
echo Updating $qqwry_dat_local_path
$command
unzip -q -u ${workdir}${zipname} -d ${workdir}
innoextract -e ${workdir}setup.exe -d ${workdir}
cp ${workdir}app/qqwry.dat $qqwry_dat_local_path
#clean
rm -r ${workdir}
ls -alh "$qqwry_dat_local_path"
exit 1
@sangrealest
Copy link

awesome work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment