Skip to content

Instantly share code, notes, and snippets.

@kon3ko
Last active January 8, 2020 19:26
Show Gist options
  • Save kon3ko/51f39031258bd8b07c7284f6bb892f8e to your computer and use it in GitHub Desktop.
Save kon3ko/51f39031258bd8b07c7284f6bb892f8e to your computer and use it in GitHub Desktop.
Stay login website discuz for online point
#!/bin/bash
################ INSTALL ################
# - mark the file as executable "$chmod +x /path/this-script.sh"
# - add cron job "$(crontab -l 2>/dev/null; echo "* * * * * sh /path/this-script.sh >/dev/null 2>&1") | crontab -"
################ ###### ################
#setting
website='https://xxxxx.xxx/forums'
username='xxxxx'
#cookie auth and saltkey after login
cookie_pre_name='XXXX_XXXX'
auth='XXXXX'
salt='XXXXX'
response=$(curl "${website}/home.php?mod=spacecp&ac=privacy" \
-H 'Connection: keep-alive' \
-H 'Cache-Control: max-age=0' \
-H 'Upgrade-Insecure-Requests: 1' \
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36' \
-H 'Sec-Fetch-User: ?1' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'Sec-Fetch-Mode: navigate' \
-H "Referer: ${website}/home.php" \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Accept-Language: en-US,en;q=0.9,th-TH;q=0.8,th;q=0.7' \
-H "Cookie: ${cookie_pre_name}_saltkey=${salt}; ${cookie_pre_name}_auth=${auth}" \
--compressed \
-sS)
printf "User ${username} from ${website} is "
if [[ ${response} == *"${username}"* ]]; then
GREEN='\033[0;32m'
printf "${GREEN}Stay online.\n"
else
RED='\033[0;31m'
printf "${RED}Offline!\n"
fi
printf '\033[0m'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment