Skip to main content

Checking & banning BitTorrent leech peers via Web API, remove ads, working forμTorrent.

Project description

Ban-Peers (English/中文)

release status code size

Ban-Peers wrote in Python, it is checking & banning BitTorrent leech peers via Web API, remove ads, working for μTorrent. The main banned are XunLei, Baidu, QQDownload, Offline download servers, other infamous leech clients, and BT players, fake clients, who reported fake progress, the fact in serious leech.

Execute checking per 10 seconds, the banned time can be specified by the start-up parameters, default is 12 hours. In some cases, temporary banned for 1 hour if the torrent is seeding. Also can temporary banned peers which refused upload 10 minutes in downloading torrents if AVAILABILITY greater than 10. At the same time, this script will not broke the existing IP ranges (non-single IP) in ipfilter, they will be stored as-is.

A gift to the users of μTorrent 3 classic desktop free version, it wrote in Chinese, you can read via a translator. e.g. translate.google.com

Resist leech strongly, this is our own rights. If you feels Ban-Peers a good work, please recommend it to your friends, Thanks.

Notices

  • Does not work in old versions of μTorrent which did not provided API getpeers.
  • Please use this script in local network, μTorrent Web API does not support HTTPS connections, it is not safe.
  • I took preventive measures, if you stiil found a normal peer has been banned, please tell us via issues board.

Installation

Install from version package format monthly downloads

pip3 install ban-peers

Or download and Install from source code, this will install as egg archive

python setup.py install

Or download and package into .pyz (Zip App), support three arguments of zipapp module (output/python/compress)

python setup.py bdist_pyz -compress

python setup.py bdist_pyz -compress -output ban_peers -python python38

Compatibility

  • Python >= 3.7
  • Zip safe
  • Support call with python -m
  • Support I18N,welcome helps localization

Usage

First, Web UI must be enabled in μTorrent settings; then running Ban-Peers for specified ipfilter.dat file.

Setting file ipfilter.dat, it is generally located in the path corresponding to the following cases.

Mac:
        ~/Library/Application Support/uTorrent
        or
        /Applications/uTorrent.app/Contents/MacOS
Unix utserver:
        use utserver argument "-settingspath" to specify settings folder path.
Win XP:
        C:\Documents and Settings\<username>\Application Data\uTorrent
Win 7 & above:
        C:\Users\<username>\AppData\Roaming\uTorrent
Portable mode:
        μTorrent installation folder path. To enable this mode, first put file
        settings.dat into it.
PortableApps:
        <PortableApps folder>\App\uTorrent
Android:
        I don't know any informations about it, welcome to help add those informations,
        even Android is unavailable.
Network File:
        run μTorrent at other machine, setup the settings folder as a network file path.
        e.g.
        NFS       mount –t nfs 192.168.1.20:/var/lib/utserver /mnt/utserver
                  /mnt/utserver
        SMB/CIFS  //machine1/share/uTorrent
$ ban_peers -h
Welcome using Ban-Peers 0.9.1

Usage: ban_peers [-H IP|DOMAIN] [-p PORT] [-a USERNAME:PASSWORD] [-e HOURS]
                 [-t MINUTES] [-f FORMAT] [-C] [-X] [-P] [-L] [-N] [-R] [-U]
                 [-A] [-O] [-h] [-v]
                 [IPFILTER-PATH]

Checking & banning BitTorrent leech peers via Web API, remove ads, working for
uTorrent.

Positional Arguments:
    IPFILTER-PATH   Path of ipfilter dir/file, wait input if empty. IMPORTANT
                    NOTICE: must be the uTorrent settings path!

Optional Arguments:
    -H IP|DOMAIN, --host IP|DOMAIN
                    WebUI host, default 127.0.0.1
    -p PORT, --port PORT
                    WebUI port, default 8080
    -a USERNAME:PASSWORD, --authorization USERNAME:PASSWORD
                    WebUI authorization, wait input if required
    -e HOURS, --expire HOURS
                    Ban expire time for peers, default 12 HOURS
    -t MINUTES, --time-allowed-refuse MINUTES
                    How much time to keep connecting before temporary banned
                    refused upload peers, at least 5 MINUTES, default 10
                    MINUTES
    -f FORMAT, --log-header FORMAT
                    Format of log header, see time.strftime, default %H:%M:%S
    -C, --resolve-country
                    Set uTorrent to resolved peer's country code at start-up
    -X, --no-xunlei-reprieve
                    Banned XunLei directly, no more checking
    -P, --no-fake-progress-check
                    Don't checking fake progress
    -L, --no-serious-leech-check
                    Don't checking serious leech, except anonymous peers
    -N, --no-refused-upload-check
                    Don't checking refused upload, this checking is useful to
                    connect potential active peers
    -R, --private-check
                    Enable checking for private torrents
    -U, --log-unknown
                    Logging unknown clients
    -A, --remove-ads
                    Remove ads via set Advanced Settings, only working for
                    localhost, and to fail in older uTorrent
    -O, --no-close-pairing
                    Don't turn off Web Pairing setting after remove ads
    -h, --help      Show this help message and exit
    -v, --version   Show version and exit
$ ban_peers -p 12345 -a username:password /var/lib/utserver
Welcome using Ban-Peers 0.9.1
19:44:33 Set uTorrent setting 'webui.allow_pairing' to True
19:44:35 Set uTorrent setting 'gui.show_plus_upsell_nodes' to False  **_Remove upsell tip in the sidebar_**
19:44:35 Set uTorrent setting 'webui.allow_pairing' to False  **_disallow pairing_**
19:44:35 Set uTorrent setting 'bt.use_rangeblock' to False  **_Won't restore after quit_**
19:44:35 Set uTorrent setting 'ipfilter.enable' to True
19:44:35 uTorrent auto-banning script start running
Choose your operation: (Q)uit, (S)top, (R)estart, (P)ause/Proceed

or

$ ban-peers
Welcome using Ban-Peers 0.9.1
Please input uTorrent settings folder path or ipfilter file path:
/var/lib/utserver
Please input WebUI username: username
Please input WebUI password: password  **_No cover_**
19:44:33 Set uTorrent setting 'webui.allow_pairing' to True
19:44:35 Set uTorrent setting 'gui.show_plus_upsell_nodes' to False  **_Remove upsell tip in the sidebar_**
19:44:35 Set uTorrent setting 'webui.allow_pairing' to False  **_disallow pairing_**
19:44:35 Set uTorrent setting 'bt.use_rangeblock' to False  **_Won't restore after quit_**
19:44:35 Set uTorrent setting 'ipfilter.enable' to True
19:44:35 uTorrent auto-banning script start running
Choose your operation: (Q)uit, (S)top, (R)estart, (P)ause/Proceed
  • Quit: exit the script.
  • Stop: stop checking if run script via import as package, or same as Quit.
  • Restart: reload ipfilter.dat, it is useful when manually modify ipfilter.dat.
  • Pause: pause checking, it is useful when manually modify ipfilter.dat.
  • Proceed: just proceed checking.

Got troubles/ideas

Visit the issues board and post them, maybe someone can help you.

What μTorrent settings should have been modified

  • Global

    bt.use_rangeblock, using this tool, build-in range block (by hash error) should be disabled.
    False when start-up

    ipfilter.enable, enable/flush ipfilter.
    True when start-up, adding banned

    webui.allow_pairing, modify more settings have to got pairing, μTorrent will show a pop-up of pairing request, please confirm carefully.
    True before modify ads settings
    False after modify ads settings, can also use parameters -O or --no-close-pairing to do not disable it

    gui.show_plus_upsell_nodes, μTorrent sidebar upgrade tips will be reset at start-up.
    True when start-up, μTorrent re-started

    peer.resolve_country, resolve_peerips, resolve country code of peer IPs.
    True when start-up,need to use parameters -C or --resolve-country, not every time

    Other ads settings, modify some settings have to got pairing.
    For specific values see the part of ANTI_ADS_SETTINGS in source code, when start-up, modify all settings at once after got pairing, need to use parameters -A or --remove-ads, not every time

  • Torrent

    ulrate, for older/weaker Torrents (in terms of E.T.A, less than 10 GiB/day), limit its upload rate helps complete download, and increase read cache hits in passing.
    1048576 download size less than 1 GiB, limit to 1 MiB/s
    524288 download size less than 10 GiB, limit to 512 KiB/s

Related projects

Thanks

c0re100
ShenHongFei
isimonov
SchizoDuckie

License

Ban-Peers is released under the license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Ban-Peers-0.9.1.tar.gz (46.1 kB view hashes)

Uploaded Source

Built Distribution

Ban_Peers-0.9.1-py3-none-any.whl (37.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page