Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Enemy Territory: Key Generator
#!/bin/bash
thisscript=$(readlink -f $0);
mygoto=`dirname $thisscript`;
myhome=$HOME;
FLOOR=99999;
export TZ="GMT";
number=0;
while [ "$number" -le $FLOOR ]; do
a=`expr $RANDOM % 999`;
b=`expr $RANDOM % 999`;
number=${a}${b};
done;
STIME=`sudo -i sntp pool.ntp.org | awk 'NR == 2 { print $1, $2 }'`;
echo "Synchronized time is ...";
echo "$STIME";
echo "Generating key...";
sleep 3;
TIMESTMP=`date --date="$STIME" +%s`;
DAY=`date -u --date="$STIME" +%F`;
NULL=`date --date="$DAY" +%s`;
echo "$TIMESTMP";
if [ "$TIMESTMP" != "$NULL" ]; then
etkey=000000100299${TIMESTMP}${number};
if [ -n $myhome/.etwolf/etmain ]; then
mkdir -p $myhome/.etwolf/etmain;
fi
echo "Setting ETKey to ...";
echo "$etkey";
echo $etkey > $myhome/.etwolf/etmain/etkey;
fi;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.