qBitTorrent ban xunlei

Xunlei never upload even one byte to BitTorrent public network. Let's fuck it.

This script allow you to ban other peers basing on its client name. And you can customize your own regex to ban more clients.

Just save this script on your machine, enable qBitTorrent WebUI, and run it with bash!

#!/bin/bash

# Configure your qBitTorrent API endpoint. 
#   Enable it in Tools->Web UI->Web User Interface. By default, it's 127.0.0.1:8080. 
#   Usually, you want to enable 'bypass authentication for clients on localhost'. If you still want to set a 
#     password, just add `-u username:password` option to the curl command. 
api_endpoint="http://127.0.0.1:8080/api/v2"
# You can customize the blacklist keywords. 
blacklists=(
    "Xunlei"
    "XL00"
    "^7\."
)

##############################################################

function curl_wrapped () {
    curl -s "[email protected]" || echo "Warning: CURL failed with $status. "
}

while true; do
    tasks=`curl_wrapped "$api_endpoint/sync/maindata?rid=0" | grep -oE '"[0-9a-f]{40}"' | tr -d '"' | sort | uniq`
    echo "$tasks" | while read -r line; do
        peers=`curl_wrapped "$api_endpoint/sync/torrentPeers?hash=$line&rid=0" | grep -o '"[^"]*":{"client":"[^"]*"'`
        echo "$peers" | while read -r peer; do
            ua=`echo "$peer" | sed 's/^.*"client":"//g' | sed 's/"$//g'`
            addr=`echo "$peer" | sed 's/":{"client.*$//g' | tr -d '"'`
            hit=0
            for pattern in "${blacklists[@]}"; do
                echo "$ua" | grep "$pattern" > /dev/null && hit=1
            done
            [[ $hit = 1 ]] && echo "[$(date)] Banning $addr because of his client '$ua'" || continue
            # Ban a peer
            curl_wrapped "$api_endpoint/transfer/banPeers?peers=$addr"
        done
    done

    sleep 5
done

You can easily catch so many fucking shitheads in 2 hours

Banning 1.207.115.34 because of his client '-XL0012-_̛_Ζ___'
Banning 110.52.194.182 because of his client '-XL0012-u0014_-_EۗD_'
Banning 171.113.2.6 because of his client '7.10.31.338'
Banning 110.52.194.182 because of his client '-XL0012-u0014_-_EۗD_'
Banning 171.113.2.6 because of his client 'Xunlei 0.1.0'
Banning 110.52.194.182 because of his client '-XL0012-u0014_-_EۗD_'
Banning 171.113.2.6 because of his client '7.10.31.338'
Banning 110.52.194.182 because of his client '-XL0012-u0014_-_EۗD_'
Banning 171.113.2.6 because of his client '7.10.31.338'
Banning 110.52.194.182 because of his client 'Xunlei 0.0.1.2'
Banning 171.113.2.6 because of his client '7.10.31.338'
Banning 110.52.194.182 because of his client '-XL0012-u0014_-_EۗD_'
Banning 171.113.2.6 because of his client '7.10.31.338'
Banning 110.52.194.182 because of his client '-XL0012-u0014_-_EۗD_'
Banning 171.113.2.6 because of his client 'Xunlei 0.1.0'
Banning 110.52.194.182 because of his client '-XL0012-u0014_-_EۗD_'
Banning 171.113.2.6 because of his client '7.10.31.338'
Banning 110.52.194.182 because of his client '-XL0012-u0014_-_EۗD_'
Banning 171.113.2.6 because of his client '7.10.31.338'
Banning 110.52.194.182 because of his client 'Xunlei 0.0.1.2'
Banning 171.113.2.6 because of his client '7.10.31.338'
Banning 110.52.194.182 because of his client '-XL0012-u0014_-_EۗD_'
Banning 171.113.2.6 because of his client '7.10.31.338'
Banning 110.52.194.182 because of his client '-XL0012-u0014_-_EۗD_'
Banning 171.113.2.6 because of his client '7.10.31.338'
Banning 110.52.194.182 because of his client '-XL0012-u0014_-_EۗD_'
Banning 171.113.2.6 because of his client '7.10.31.338'
Banning 110.52.194.182 because of his client 'Xunlei 0.0.1.2'
Banning 171.113.2.6 because of his client '7.10.31.338'
Banning 110.52.194.182 because of his client '-XL0012-u0014_-_EۗD_'
Banning 171.113.2.6 because of his client '7.10.31.338'

If you want to ban it temporarily instead of permanently, use curl_wrapped "$api_endpoint/app/setPreferences" --data "json={"banned_IPs":"$ipn"}"