Merge branch 'main' of https://git.poster.place/verita84/firewall
This commit is contained in:
commit
cf462bf279
17
modules/module-akkoma-accounts.sh
Normal file
17
modules/module-akkoma-accounts.sh
Normal file
@ -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
|
17
modules/module-akkoma-instance.sh
Normal file
17
modules/module-akkoma-instance.sh
Normal file
@ -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
|
16
modules/module-akkoma-search.sh
Normal file
16
modules/module-akkoma-search.sh
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user