diff --git a/firewall.sh b/firewall.sh index 3d3be13..19e123c 100755 --- a/firewall.sh +++ b/firewall.sh @@ -313,15 +313,6 @@ watch() { IP=($(grep $DATE $ACCESS | grep -Fivf <(printf '%s\n' "${SAFE_TRAFFIC[@]}") | grep -Fivf <(printf '%s\n' "${CRAWLER_DB[@]}") | grep -Fivf <(printf '%s\n' "${SAVED_BOTS[@]}") | grep -vi $MY_IP | grep -vi '127.0.0.1' | cut -d ' ' -f1 | sort -u)) for i in "${IP[@]}"; do - bash $MODULES/module-akkoma-instance.sh "$i" "$DATE" - bash $MODULES/module-akkoma-timeline-public.sh "$i" "$DATE" - bash $MODULES/module-akkoma-timeline-home.sh "$i" "$DATE" - bash $MODULES/module-akkoma-accounts.sh "$i" "$DATE" - bash $MODULES/module-akkoma-search.sh "$i" "$DATE" - bash $MODULES/module-lightning.sh "$i" "$DATE" - bash $MODULES/module-php.sh "$i" "$DATE" - bash $MODULES/module-go.sh "$i" "$DATE" - bash $MODULES/module-get-spam.sh "$i" "$DATE" COUNT=$(grep $DATE $ACCESS | grep $i | grep -Fivf <(printf '%s\n' "${SAFE_TRAFFIC[@]}") | grep -Fivf <(printf '%s\n' "${SAVED_BOTS[@]}") | wc -l) CHECK=$(cat $NFT_CACHE | sort -u | grep $i) diff --git a/modules/module-akkoma-accounts.sh b/modules/module-akkoma-accounts.sh index 711085c..4f182c2 100644 --- a/modules/module-akkoma-accounts.sh +++ b/modules/module-akkoma-accounts.sh @@ -2,6 +2,7 @@ FIREWALL="/opt/firewall/firewall.sh" ACCESS="/tmp/minute.log" ATTACK="module-akkoma-accounts DDOS Attack " +echo $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 diff --git a/modules/module-akkoma-instance.sh b/modules/module-akkoma-instance.sh index 3efad2c..2e50c58 100644 --- a/modules/module-akkoma-instance.sh +++ b/modules/module-akkoma-instance.sh @@ -2,6 +2,7 @@ FIREWALL="/opt/firewall/firewall.sh" ACCESS="/tmp/minute.log" ATTACK="module-akkoma-instance DDOS Attack " +echo $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 diff --git a/modules/module-akkoma-search.sh b/modules/module-akkoma-search.sh index b8f6c47..36aa124 100644 --- a/modules/module-akkoma-search.sh +++ b/modules/module-akkoma-search.sh @@ -2,6 +2,7 @@ FIREWALL="/opt/firewall/firewall.sh" ACCESS="/tmp/minute.log" ATTACK="module-akkoma-search DDOS Attack " +echo $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 diff --git a/modules/module-akkoma-timeline-home.sh b/modules/module-akkoma-timeline-home.sh index 77bafeb..e4660cf 100644 --- a/modules/module-akkoma-timeline-home.sh +++ b/modules/module-akkoma-timeline-home.sh @@ -2,6 +2,7 @@ FIREWALL="/opt/firewall/firewall.sh" ACCESS="/tmp/minute.log" ATTACK="module-akkoma-timeline-home DDOS Attack " +echo $ATTACK SEARCH_SPAM=$(grep $2 $ACCESS | grep -E "timelines/home" | grep $1 | wc -l) CHECK=$(cat $NFT_CACHE | sort -u | grep $1) if [[ "$SEARCH_SPAM" -gt 30 ]]; then diff --git a/modules/module-akkoma-timeline-public.sh b/modules/module-akkoma-timeline-public.sh index 5040dcc..99fa026 100644 --- a/modules/module-akkoma-timeline-public.sh +++ b/modules/module-akkoma-timeline-public.sh @@ -2,6 +2,7 @@ FIREWALL="/opt/firewall/firewall.sh" ACCESS="/tmp/minute.log" ATTACK="module-akkoma-timeline-public DDOS Attack " +echo $ATTACK SEARCH_SPAM=$(grep $2 $ACCESS | grep "timelines/public" | grep $1 | wc -l) CHECK=$(cat $NFT_CACHE | sort -u | grep $1) if [[ "$SEARCH_SPAM" -gt 30 ]]; then diff --git a/modules/module-get-spam.sh b/modules/module-get-spam.sh index a92e7ad..3f60548 100644 --- a/modules/module-get-spam.sh +++ b/modules/module-get-spam.sh @@ -2,6 +2,7 @@ FIREWALL="/opt/firewall/firewall.sh" ACCESS="/tmp/minute.log" ATTACK="module-get-spam DDOS Attack " +echo $ATTACK GET_SPAM=$(grep $2 $ACCESS | grep -E "GET / HTTP" | wc -l) if [[ "$GET_SPAM" -gt 20 ]]; then bash $FIREWALL ipBlockParser "$1" diff --git a/modules/module-go.sh b/modules/module-go.sh index 7d743b9..69ba1e4 100644 --- a/modules/module-go.sh +++ b/modules/module-go.sh @@ -2,6 +2,7 @@ FIREWALL="/opt/firewall/firewall.sh" ACCESS="/tmp/minute.log" ATTACK="module-go DDOS Attack " +echo $ATTACK GO_SPAM=$(grep $2 $ACCESS | grep -E "Go-http-client" | wc -l) if [[ "$GO_SPAM" -gt 10 ]]; then bash $FIREWALL ipBlockParser "$1" diff --git a/modules/module-lightning.sh b/modules/module-lightning.sh index f7c6018..be4e863 100644 --- a/modules/module-lightning.sh +++ b/modules/module-lightning.sh @@ -2,6 +2,7 @@ FIREWALL="/opt/firewall/firewall.sh" ACCESS="/tmp/minute.log" ATTACK="module-lightning DDOS Attack " +echo $ATTACK LN_SPAM=$(grep $2 $ACCESS | grep "lnurlp/verita84" | wc -l) if [[ "$LN_SPAM" -gt 5 ]]; then bash $FIREWALLipBlockParser "$1" diff --git a/modules/module-nostr.sh b/modules/module-nostr.sh index dd498ac..d929030 100644 --- a/modules/module-nostr.sh +++ b/modules/module-nostr.sh @@ -1,9 +1,9 @@ #!/bin/bash FIREWALL="/opt/firewall/firewall.sh" ACCESS="/tmp/minute.log" -IP=($(grep $DATE $ACCESS | grep "/block=" | cut -d '=' -f2 | cut -d ' ' -f1 | sed 's/"//')) +echo "module-nostr" +IP=($(grep $2 $ACCESS | grep "/block=" | cut -d '=' -f2 | cut -d ' ' -f1 | sed 's/"//')) for i in "${IP[@]}"; do - echo $i if [[ "$i" == *"npub"* ]]; then bash /opt/strfry-policies/block.sh $i else diff --git a/modules/module-php.sh b/modules/module-php.sh index 3e6ee5d..004b6ec 100644 --- a/modules/module-php.sh +++ b/modules/module-php.sh @@ -2,6 +2,7 @@ FIREWALL="/opt/firewall/firewall.sh" ACCESS="/tmp/minute.log" ATTACK="module-php DDOS Attack " +echo $ATTACK PHP_SPAM=$(grep $2 $ACCESS | grep -E ".php|cgi-bin|wp-content|wp-admin|wp-includes" | wc -l) if [[ "$PHP_SPAM" -gt 10 ]]; then bash $FIREWALL ipBlockParser "$1"