kopia lustrzana https://github.com/J-Rios/TLG_JoinCaptchaBot
Makefile for usage & move scripts to 'tools' directory
rodzic
d40c967524
commit
09f33e6919
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
SHELL = /bin/bash
|
||||||
|
TOOLS="./tools"
|
||||||
|
|
||||||
|
.PHONY: help run kill status monitor errors
|
||||||
|
|
||||||
|
help:
|
||||||
|
@ echo ""
|
||||||
|
@ echo "Usage:"
|
||||||
|
@ echo " run: Launch the Bot"
|
||||||
|
@ echo " kill: Stop the Bot"
|
||||||
|
@ echo " status: Check if Bot is running"
|
||||||
|
@ echo " monitor: Check users captcha process"
|
||||||
|
@ echo " error: Check for errors in the Bot"
|
||||||
|
@ echo ""
|
||||||
|
|
||||||
|
run:
|
||||||
|
@ $(TOOLS)/run
|
||||||
|
|
||||||
|
kill:
|
||||||
|
@ $(TOOLS)/kill
|
||||||
|
|
||||||
|
status:
|
||||||
|
@ $(TOOLS)/status
|
||||||
|
|
||||||
|
monitor:
|
||||||
|
@ $(TOOLS)/monitor
|
||||||
|
|
||||||
|
errors:
|
||||||
|
@ $(TOOLS)/check_errors
|
|
@ -75,5 +75,5 @@ RUN chown -R "${BOT_USER}:${BOT_GROUP}" ${BOT_HOME_DIR} && \
|
||||||
|
|
||||||
# Set up to run as an unprivileged user
|
# Set up to run as an unprivileged user
|
||||||
USER ${BOT_USER}
|
USER ${BOT_USER}
|
||||||
WORKDIR ${APP_DIR}/src
|
WORKDIR ${APP_DIR}
|
||||||
CMD ["./entrypoint.sh"]
|
CMD ["./tools/entrypoint.sh"]
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
cat -n output.log | grep -e "Traceback" -A 15 -B 5
|
|
||||||
|
|
||||||
exit 0
|
|
|
@ -1,8 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Actual script directory path
|
|
||||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
|
||||||
|
|
||||||
tail -n1000 -f $DIR/output.log | grep -e "New join detected:" -e "Captcha not solved, kicking" -e "Captcha solved by"
|
|
||||||
|
|
||||||
exit 0
|
|
20
src/run
20
src/run
|
@ -1,20 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Actual script directory path
|
|
||||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
|
||||||
|
|
||||||
# Process ID
|
|
||||||
PID=`ps -aux | grep -e "[j]oin_captcha_bot.py" | awk 'FNR == 1 {print $2}'`
|
|
||||||
|
|
||||||
if [ ! -z "$PID" ]; then
|
|
||||||
echo "Already running."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -rf $DIR/data/captchas/*
|
|
||||||
nohup python3 -u $DIR/join_captcha_bot.py >> $DIR/output.log 2>&1 &
|
|
||||||
echo "Starting Script..."
|
|
||||||
sleep 1
|
|
||||||
$DIR/status
|
|
||||||
|
|
||||||
exit 0
|
|
|
@ -3,6 +3,7 @@
|
||||||
# Actual script directory path
|
# Actual script directory path
|
||||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
||||||
|
|
||||||
rm -f $DIR/data/captchas/*
|
# Check and shows errors
|
||||||
|
cat -n $DIR/../output.log | grep -e "Traceback" -A 15 -B 5
|
||||||
|
|
||||||
exec python3 -u $DIR/join_captcha_bot.py
|
exit 0
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Actual script directory path
|
||||||
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
||||||
|
|
||||||
|
# Clean old/previous residual captcha images
|
||||||
|
rm -f $DIR/../src/data/captchas/*
|
||||||
|
|
||||||
|
# Launch the Bot
|
||||||
|
exec python3 -u $DIR/../src/join_captcha_bot.py
|
|
@ -4,18 +4,22 @@
|
||||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
||||||
|
|
||||||
# Process ID
|
# Process ID
|
||||||
PID=`ps -aux | grep -e "[j]oin_captcha_bot.py" | awk 'FNR == 1 {print $2}'`
|
PID=$(ps -aux | grep -e "[j]oin_captcha_bot.py" | awk 'FNR == 1 {print $2}')
|
||||||
|
|
||||||
|
# Check if process is running
|
||||||
if [ -z "$PID" ]; then
|
if [ -z "$PID" ]; then
|
||||||
echo "Script is not running."
|
echo "Script is not running."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Kill the process
|
||||||
kill -9 $PID
|
kill -9 $PID
|
||||||
echo "Killing script, please wait..."
|
echo "Killing script, please wait..."
|
||||||
while $(kill -0 $PID 2>/dev/null); do
|
while $(kill -0 $PID 2>/dev/null); do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Show process status after kill
|
||||||
$DIR/status
|
$DIR/status
|
||||||
|
|
||||||
exit 0
|
exit 0
|
|
@ -4,18 +4,22 @@
|
||||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
||||||
|
|
||||||
# Process ID
|
# Process ID
|
||||||
PID=`ps -aux | grep -e "[j]oin_captcha_bot.py" | awk 'FNR == 1 {print $2}'`
|
PID=$(ps -aux | grep -e "[j]oin_captcha_bot.py" | awk 'FNR == 1 {print $2}')
|
||||||
|
|
||||||
|
# Check if process is running
|
||||||
if [ -z "$PID" ]; then
|
if [ -z "$PID" ]; then
|
||||||
echo "Script is not running."
|
echo "Script is not running."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Kill the process
|
||||||
echo "Killing script, please wait..."
|
echo "Killing script, please wait..."
|
||||||
kill $PID
|
kill $PID
|
||||||
while $(kill -0 $PID 2>/dev/null); do
|
while $(kill -0 $PID 2>/dev/null); do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Show process status after kill
|
||||||
$DIR/status
|
$DIR/status
|
||||||
|
|
||||||
exit 0
|
exit 0
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Actual script directory path
|
||||||
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
||||||
|
|
||||||
|
# Continuous check and show users joins and captcha process
|
||||||
|
tail -n1000 -f $DIR/../output.log | grep -e "New join detected:" -e "Captcha not solved, kicking" -e "Captcha solved by"
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Actual script directory path
|
||||||
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
||||||
|
|
||||||
|
# Process ID
|
||||||
|
PID=$(ps -aux | grep -e "[j]oin_captcha_bot.py" | awk 'FNR == 1 {print $2}')
|
||||||
|
|
||||||
|
# Check if process is running
|
||||||
|
if [ ! -z "$PID" ]; then
|
||||||
|
echo "Already running."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clean old/previous residual captcha images
|
||||||
|
rm -rf $DIR/../src/data/captchas/*
|
||||||
|
|
||||||
|
# Launch the Bot
|
||||||
|
echo "Starting Script..."
|
||||||
|
nohup python3 -u $DIR/../src/join_captcha_bot.py >> $DIR/../output.log 2>&1 &
|
||||||
|
sleep 1
|
||||||
|
$DIR/status
|
||||||
|
|
||||||
|
exit 0
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
PID=`ps -aux | grep -e "[j]oin_captcha_bot.py" | awk 'FNR == 1 {print $2}'`
|
# Check if process is running
|
||||||
|
PID=$(ps -aux | grep -e "[j]oin_captcha_bot.py" | awk 'FNR == 1 {print $2}')
|
||||||
if [ -z "$PID" ]; then
|
if [ -z "$PID" ]; then
|
||||||
echo "Not running."
|
echo "Not running."
|
||||||
else
|
else
|
|
@ -3,9 +3,11 @@
|
||||||
# Actual script directory path
|
# Actual script directory path
|
||||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
||||||
|
|
||||||
cd $DIR
|
# Go to language text files directory and remove them
|
||||||
rm -f $DIR/*.json
|
cd $DIR/../src/language
|
||||||
|
rm -f ./*.json
|
||||||
|
|
||||||
|
# Download latests language text files from Github
|
||||||
wget https://raw.githubusercontent.com/J-Rios/TLG_JoinCaptchaBot/master/src/language/ar.json
|
wget https://raw.githubusercontent.com/J-Rios/TLG_JoinCaptchaBot/master/src/language/ar.json
|
||||||
wget https://raw.githubusercontent.com/J-Rios/TLG_JoinCaptchaBot/master/src/language/be.json
|
wget https://raw.githubusercontent.com/J-Rios/TLG_JoinCaptchaBot/master/src/language/be.json
|
||||||
wget https://raw.githubusercontent.com/J-Rios/TLG_JoinCaptchaBot/master/src/language/ca.json
|
wget https://raw.githubusercontent.com/J-Rios/TLG_JoinCaptchaBot/master/src/language/ca.json
|
Ładowanie…
Reference in New Issue