This commit is contained in:
Your Name 2024-09-25 10:07:41 -06:00
parent 36ca950860
commit bec4acd12e

View File

@ -1,10 +1,15 @@
#!/bin/bash #!/bin/bash
POLICY='/opt/strfry-policies/strfry-policy.ts'
FIREWALL="/opt/firewall/firewall.sh" FIREWALL="/opt/firewall/firewall.sh"
ACCESS="/tmp/minute.log" ACCESS="/tmp/minute.log"
IP=($(grep $2 $ACCESS | grep "/block=" | cut -d '=' -f2 | cut -d ' ' -f1 | sed 's/"//')) IP=($(grep $2 $ACCESS | grep "/block=" | cut -d '=' -f2 | cut -d ' ' -f1 | sed 's/"//'))
for i in "${IP[@]}"; do for i in "${IP[@]}"; do
if [[ "$i" == *"npub"* ]]; then if [[ "$i" == *"npub"* ]]; then
bash /opt/strfry-policies/block.sh $i HEX=$(/opt/nak-v0.2.2-linux-amd64 decode $i | jq ".pubkey" | sed 's/"//i' | sed 's/"//i')
sed -i "29i '$HEX'," $POLICY
sed -i "s/\'\'//g" $POLICY
sed -i "s/'',//g" $POLICY
sed -i '/^$/d' $POLICY
else else
echo "No Npubs to block" echo "No Npubs to block"
fi fi