diff --git a/modules/module-akkoma-accounts.sh b/modules/module-akkoma-accounts.sh new file mode 100644 index 0000000..711085c --- /dev/null +++ b/modules/module-akkoma-accounts.sh @@ -0,0 +1,17 @@ +#!/bin/bash +FIREWALL="/opt/firewall/firewall.sh" +ACCESS="/tmp/minute.log" +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 + bash $FIREWALLipBlockParser "$1" + bash $FIREWALL message "$ATTACK $1" + redis-cli SADD tmp_block $1 + echo "$ATTACK $1" + else + echo "$ATTACK Ignoring Duplicate IP: $1" + fi +fi diff --git a/modules/module-akkoma-instance.sh b/modules/module-akkoma-instance.sh new file mode 100644 index 0000000..3efad2c --- /dev/null +++ b/modules/module-akkoma-instance.sh @@ -0,0 +1,17 @@ +#!/bin/bash +FIREWALL="/opt/firewall/firewall.sh" +ACCESS="/tmp/minute.log" +ATTACK="module-akkoma-instance DDOS Attack " +SEARCH_SPAM=$(grep $2 $ACCESS | grep -E "api/v1/instance" | 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 + bash $FIREWALLipBlockParser "$1" + bash $FIREWALL message "$ATTACK $1" + redis-cli SADD tmp_block $1 + echo "$ATTACK $1" + else + echo "$ATTACK Ignoring Duplicate IP: $1" + fi +fi diff --git a/modules/module-akkoma-search.sh b/modules/module-akkoma-search.sh new file mode 100644 index 0000000..b8f6c47 --- /dev/null +++ b/modules/module-akkoma-search.sh @@ -0,0 +1,16 @@ +#!/bin/bash +FIREWALL="/opt/firewall/firewall.sh" +ACCESS="/tmp/minute.log" +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 10 ]]; then + echo "$IP $CHECK $COUNT" + if [ "$CHECK" = "" ]; then + bash $FIREWALLipBlockParser "$1" + bash $FIREWALL message "$ATTACK $1" + redis-cli SADD tmp_block $1 + else + echo "$ATTACK Ignoring Duplicate IP: $1" + fi +fi