This commit is contained in:
Your Name 2024-09-25 19:23:57 -06:00
parent b83aaba533
commit 8f18502062
7 changed files with 20 additions and 13 deletions

View File

@ -3,9 +3,10 @@ FIREWALL="/opt/firewall/firewall.sh"
NFT_CACHE='/tmp/nft.cache'
ACCESS="/tmp/minute.log"
ATTACK="module-akkoma-accounts"
SEARCH_SPAM=$(grep $2 $ACCESS | grep "api/v1/accounts" | grep $1 | wc -l)
COUNT_SPAM=$(grep $2 $ACCESS | grep "api/v1/accounts" | grep $1 | wc -l)
SEARCH_SPAM=$(($COUNT_SPAM))
CHECK=$(cat $NFT_CACHE | sort -u | grep $1)
if [[ "$SEARCH_SPAM" -gt 100 ]]; then
if [[ $SEARCH_SPAM -gt 100 ]]; then
echo "$IP $CHECK $COUNT"
if [ "$CHECK" = "" ]; then
bash $FIREWALL ipBlockParser "$1"

View File

@ -3,9 +3,10 @@ FIREWALL="/opt/firewall/firewall.sh"
NFT_CACHE='/tmp/nft.cache'
ACCESS="/tmp/minute.log"
ATTACK="module-akkoma-instance"
SEARCH_SPAM=$(grep $2 $ACCESS | grep -E "api/v1/instance" | grep $1 | wc -l)
COUNT_SPAM=$(grep $2 $ACCESS | grep -E "api/v1/instance" | grep $1 | wc -l)
SEARCH_SPAM=$(($COUNT_SPAM))
CHECK=$(cat $NFT_CACHE | sort -u | grep $1)
if [[ "$SEARCH_SPAM" -gt 30 ]]; then
if [[ $SEARCH_SPAM -gt 30 ]]; then
echo "$IP $CHECK $COUNT"
if [ "$CHECK" = "" ]; then
bash $FIREWALL ipBlockParser "$1"

View File

@ -3,9 +3,10 @@ FIREWALL="/opt/firewall/firewall.sh"
NFT_CACHE='/tmp/nft.cache'
ACCESS="/tmp/minute.log"
ATTACK="module-akkoma-search"
SEARCH_SPAM=$(grep $2 $ACCESS | grep "api/v2/search" | grep $1 | wc -l)
COUNT_SPAM=$(grep $2 $ACCESS | grep "api/v2/search" | grep $1 | wc -l)
SEARCH_SPAM=$(($COUNT_SPAM))
CHECK=$(cat $NFT_CACHE | sort -u | grep $1)
if [[ "$SEARCH_SPAM" -gt 10 ]]; then
if [[ $SEARCH_SPAM -gt 10 ]]; then
echo "$IP $CHECK $COUNT"
if [ "$CHECK" = "" ]; then
bash $FIREWALL ipBlockParser "$1"

View File

@ -3,9 +3,10 @@ FIREWALL="/opt/firewall/firewall.sh"
NFT_CACHE='/tmp/nft.cache'
ACCESS="/tmp/minute.log"
ATTACK="module-akkoma-timeline-home"
SEARCH_SPAM=$(grep $2 $ACCESS | grep -E "timelines/home" | grep $1 | wc -l)
COUNT_SPAM=$(grep $2 $ACCESS | grep -E "timelines/home" | grep $1 | wc -l)
SEARCH_SPAM=$(($COUNT_SPAM))
CHECK=$(cat $NFT_CACHE | sort -u | grep $1)
if [[ "$SEARCH_SPAM" -gt 30 ]]; then
if [[ $SEARCH_SPAM -gt 30 ]]; then
echo "$IP $CHECK $COUNT"
if [ "$CHECK" = "" ]; then
bash $FIREWALL ipBlockParser "$1"

View File

@ -3,7 +3,8 @@ FIREWALL="/opt/firewall/firewall.sh"
NFT_CACHE='/tmp/nft.cache'
ACCESS="/tmp/minute.log"
ATTACK="module-akkoma-timeline-public"
SEARCH_SPAM=$(grep $2 $ACCESS | grep "timelines/public" | grep $1 | wc -l)
COUNT_SPAM=$(grep $2 $ACCESS | grep "timelines/public" | grep $1 | wc -l)
SEARCH_SPAM=$(($COUNT_SPAM))
CHECK=$(cat $NFT_CACHE | sort -u | grep $1)
if [[ "$SEARCH_SPAM" -gt 30 ]]; then
echo "$IP $CHECK $COUNT"

View File

@ -2,8 +2,9 @@
FIREWALL="/opt/firewall/firewall.sh"
ACCESS="/tmp/minute.log"
ATTACK="module-get-spam"
GET_SPAM=$(grep $2 $ACCESS | grep -E "GET / HTTP" | wc -l)
if [[ "$GET_SPAM" -gt 20 ]]; then
COUNT_SPAM=$(grep $2 $ACCESS | grep -E "GET / HTTP" | wc -l)
SEARCH_SPAM=$(($COUNT_SPAM))
if [[ $SEARCH_SPAM -gt 20 ]]; then
bash $FIREWALL ipBlockParser "$1"
bash $FIREWALL message "$ATTACK-$1"
redis-cli SADD tmp_block $1

View File

@ -2,8 +2,9 @@
FIREWALL="/opt/firewall/firewall.sh"
ACCESS="/tmp/minute.log"
ATTACK="module-go"
GO_SPAM=$(grep $2 $ACCESS | grep "Go-http-client" | grep $1 | wc -l)
if [[ "$GO_SPAM" -gt 10 ]]; then
COUNT_SPAM=$(grep $2 $ACCESS | grep "Go-http-client" | grep $1 | wc -l)
SEARCH_SPAM=$(($COUNT_SPAM))
if [[ $SEARCH_SPAM -gt 10 ]]; then
bash $FIREWALL ipBlockParser "$1"
bash $FIREWALL message "$ATTACK-$1"
redis-cli SADD tmp_block $1