This commit is contained in:
Your Name 2024-09-19 00:21:55 -06:00
parent 5b91a8cf38
commit 19c4e5e024
2 changed files with 10 additions and 4 deletions

View File

@ -1886,3 +1886,7 @@
172.183.154.242
13.79.231.196
202.112.238.240
95.108.213.78
173.252.87.113
13.250.32.78
199.45.154.157

View File

@ -498,13 +498,15 @@ watch() {
}
module-nostr(){
POLICY='/opt/strfry-policies/strfry-policy.ts'
DATE="$(date +%d/%b/%Y:%H:%M -d '1 min ago')"
IP=($(grep $DATE $NGINX_ACCESS | grep "/block=" | cut -d '=' -f2| cut -d ' ' -f1 | sed 's/"//'))
for i in "${IP[@]}"; do
CHECK=$(cat /opt/strfry-policies/strfry-policy.ts | grep $i)
if [ "$CHECK" = "" ]; then
echo "Blocking NPUB: $i"
bash /opt/strfry-policies/block.sh $i
if [[ "$i" == *"npub"* ]]; then
HEX=$(nak decode $i | jq ".pubkey" | sed 's/"//i' | sed 's/"//i')
echo "Adding $HEX to block list"
sed -i "29i '$HEX'," $POLICY
sed -i "s/\'\'//g" $POLICY
else
echo "No Npubs to block"
fi