#!/bin/bash POLICY='/opt/strfry-policies/strfry-policy.ts' FIREWALL="/opt/firewall/firewall.sh" IP=($(grep $2 $3 | grep "/block=" | cut -d '=' -f2 | cut -d ' ' -f1 | sed 's/"//')) for i in "${IP[@]}"; do if [[ "$i" == *"npub"* ]]; then 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 echo "No Npubs to block" fi done