I would share my two new script by Dopam

Hello, about 8 months ago, I created two scripts—one that analyzes servers when launched in a game, and the other that allows you to block servers you want to block. I recently saw that Hudra managed to transcribe Dlakelan's script into Luci, although I don't use it because I prefer the one Elan made for me, and I debugged it with him in the past. If you're interested in my two scripts, feel free to let me know. I'm not very active on the forum anymore now that my connection works very well. Have a great evening, OpenWRT enthusiasts!



geofilter

my situation ideal found the best server with ping lower

# Surveillance du port 3074
echo "Surveillance du port UDP 3074 pour détecter le début d'une session de jeu..."
tcpdump -i $INTERFACE -nn 'udp port '$PORT -c 1 >/dev/null 2>&1

# Configuration initiale de nftables pour capturer les adresses IP
if nft list table inet dopam &>/dev/null; then
    nft delete table inet dopam
fi

# Création du script nftables
cat > "$DOPAMIT" <<-EOF
table inet dopam {
    set udp_meter4 {
        type ipv4_addr;
        flags timeout;
        timeout 5m;
        size 65535;
    }
    chain dopam {
        type filter hook forward priority 0; policy accept;
        udp dport $PORT counter add @udp_meter4 { ipv4_addr };
        udp sport $PORT counter add @udp_meter4 { ipv4_addr };
		ip protocol udp ip daddr $IPPS5
        ip protocol udp ip saddr $IPPS5
    }
}
EOF

nft -f "$DOPAMIT"

echo "Capture initiée sur nftables. Attente de $DURATION secondes pour collecter les données..."
sleep $DURATION

# Extraction des adresses IP capturées par nftables
nft list set inet dopam udp_meter4 > $IP_FILE

echo "Capture terminée. Début des tests de ping..."
> $PING_RESULTS

while IFS= read -r ip_address; do
    echo "Test de ping pour l'adresse $ip_address"
    # Exécuter le ping et extraire le temps moyen de réponse
    ping -c 4 $ip_address | tail -1 | awk '{print $4}' | cut -d '/' -f 2 >> $PING_RESULTS
done < "$CLEAN_IP_FILE"
while IFS= read -r ip_address; do
    echo "Test de ping pour l'adresse $ip_address"
    ping -c 4 $ip_address | tail -1 | awk '{print $4}' | cut -d '/' -f 2 >> $PING_RESULTS
done < "$IP_FILE"

# Trouver l'adresse IP avec le ping le plus bas
lowest_ping_ip=$(sort -n $PING_RESULTS | head -n 1)
echo "Adresse IP avec le ping le plus bas: $lowest_ping_ip"

# Ajouter des règles pour autoriser uniquement le trafic vers et depuis cette IP
nft add rule inet dopam forward ip saddr $IPPS5 ip daddr $lowest_ping_ip accept
nft add rule inet dopam forward ip daddr $lowest_ping_ip ip saddr $IPPS5 accept

Hello everyone, I successfully implemented the first script that allows blocking servers on Call of Duty and only using the ones we want, similar to a Netduma geofilter. However, the development process is not easy, and I see that no one seems to be interested. So, I'm going to take a break for a while since I'm going back to work this Monday.

1 Like

do you have setup instructions for this? I would be interested in trying it @anon78773196

Hello, it seems that few people are interested in this geofilter, and it's back-to-school season. I don't know how to explain it directly or how to pass on the instructions, as it requires placing 4-5 files in the router