This commit is contained in:
Your Name 2024-09-24 18:39:25 -06:00
parent b44892e20d
commit ce40e57ae7

View File

@ -110,7 +110,6 @@ wireguard-networking() {
} }
attacker-protection() { attacker-protection() {
module-unblock
watch watch
module-nostr module-nostr
bot-search bot-search
@ -317,9 +316,43 @@ module-go() {
fi fi
} }
module-akkoma-accounts() {
ATTACK="module-akkoma-accounts DDOS Attack "
SEARCH_SPAM=$(grep $2 $ACCESS | grep "api/v1/accounts" | grep $1 | wc -l)
CHECK=$(cat $NFT_CACHE | sort -u | grep $1)
if [[ "$SEARCH_SPAM" -gt 30 ]]; then
echo "$IP $CHECK $COUNT"
if [ "$CHECK" = "" ]; then
ipBlockParser "$1"
redis-cli SADD tmp_block $1
message "$ATTACK $1"
echo "$ATTACK $1"
else
echo "$ATTACK Ignoring Duplicate IP: $1"
fi
fi
}
module-akkoma-search() {
ATTACK="module-akkoma-search DDOS Attack "
SEARCH_SPAM=$(grep $2 $ACCESS | grep "api/v2/search" | grep $1 | wc -l)
CHECK=$(cat $NFT_CACHE | sort -u | grep $1)
if [[ "$SEARCH_SPAM" -gt 30 ]]; then
echo "$IP $CHECK $COUNT"
if [ "$CHECK" = "" ]; then
ipBlockParser "$1"
redis-cli SADD tmp_block $1
message "$ATTACK $1"
echo "$ATTACK $1"
else
echo "$ATTACK Ignoring Duplicate IP: $1"
fi
fi
}
module-akkoma() { module-akkoma() {
ATTACK="module-akkoma DDOS Attack " ATTACK="module-akkoma DDOS Attack "
SEARCH_SPAM=$(grep $2 $ACCESS | grep -E "api/v1/instance|api/v1/notifications|api/v1/accounts|api/v2/search|timelines/public|timelines/home|/api/v1/accounts" | grep $1 | wc -l) SEARCH_SPAM=$(grep $2 $ACCESS | grep -E "api/v1/instance|api/v1/notifications|timelines/public|timelines/home" | grep $1 | wc -l)
CHECK=$(cat $NFT_CACHE | sort -u | grep $1) CHECK=$(cat $NFT_CACHE | sort -u | grep $1)
if [[ "$SEARCH_SPAM" -gt 30 ]]; then if [[ "$SEARCH_SPAM" -gt 30 ]]; then
echo "$IP $CHECK $COUNT" echo "$IP $CHECK $COUNT"
@ -371,6 +404,8 @@ watch() {
for i in "${IP[@]}"; do for i in "${IP[@]}"; do
module-akkoma "$i" "$DATE" module-akkoma "$i" "$DATE"
module-akkoma-accounts "$i" "$DATE"
module-akkoma-search "$i" "$DATE"
module-lightning "$i" "$DATE" module-lightning "$i" "$DATE"
module-php "$i" "$DATE" module-php "$i" "$DATE"
module-go "$i" "$DATE" module-go "$i" "$DATE"
@ -410,14 +445,6 @@ message() {
echo "$1" | /root/go/bin/algia dm-post -u 33c74427f3b2b73d5e38f3e6c991c122a55d204072356f71da49a0e209fb6940 --stdin echo "$1" | /root/go/bin/algia dm-post -u 33c74427f3b2b73d5e38f3e6c991c122a55d204072356f71da49a0e209fb6940 --stdin
} }
module-unblock() {
IP=($(grep $DATE $ACCESS | grep "/unblock" | cut -d ' ' -f1 | cut -d ' ' -f1))
for i in "${IP[@]}"; do
echo "Unblocking $i"
ipDeleteParser $i
message "Unblock Requeust from DRC: $i"
done
}
module-nostr() { module-nostr() {
IP=($(grep $DATE $ACCESS | grep "/block=" | cut -d '=' -f2 | cut -d ' ' -f1 | sed 's/"//')) IP=($(grep $DATE $ACCESS | grep "/block=" | cut -d '=' -f2 | cut -d ' ' -f1 | sed 's/"//'))
for i in "${IP[@]}"; do for i in "${IP[@]}"; do