Skip to main content

efficent full implementation of the bittorent mainline dht

Project description

github_version pypi_version licence doc

The aim of btdht is to provide a powerful implementation of the Bittorrent mainline DHT easily extended to build application over the DHT. The author currently uses it to crawl the dht and has been able to retrieve more than 200.000 torrents files a day.

The implementation is fully compliant with the BEP5 and the kademlia paper [1] (with a predominance of the BEP5 over the paper) For example, this implementation uses a bucket-based approach for the routing table.

Dependencies

Build dependencies

  • A C compiler

  • cython

  • python header files

Installation

The recommended installation mode is to use a virtualenv.

To Install btdht using the last published release, run:

$ pip install btdht

Alternatively if you want to use the version of the git repository, you can clone it:

$ git clone https://github.com/nitmir/btdht
$ cd btdht
$ pip install -r requirements-dev.txt

Then, run make install to compile the sources and create a python package and install it with pip.

For installing or building on linux and unix systems, you will need a C compiler and the python headers (installing the packages build-essential and python-dev should be enough on debian like systems, you’ll probably gonna need make, gcc, python2-devel and redhat-rpm-config on centos like systems).

On windows systems, we provide pre-builded releases for python 2.7 and 3.5 so just running pip install btdht should be fine. If you want to build from the sources of the repository or, for another python version, you will also need a C compiler.

Usage examples

Search for the peers announcing the torrent 0403fb4728bd788fbcb67e87d6feb241ef38c75a (Ubuntu 16.10 Desktop (64-bit))

>>> import btdht
>>> import binascii
>>> dht = btdht.DHT()
>>> dht.start()  # now wait at least 15s for the dht to boostrap
init socket for 4c323257aa6c4c5c6ccae118db93ccce5bb05d92
Bootstraping
>>> dht.get_peers(binascii.a2b_hex("0403fb4728bd788fbcb67e87d6feb241ef38c75a"))
[
    ('81.171.107.75', 17744),
    ('94.242.250.86', 3813),
    ('88.175.164.228', 32428),
    ('82.224.107.213', 61667),
    ('85.56.118.178', 6881),
    ('78.196.28.4', 38379),
    ('82.251.140.70', 32529),
    ('78.198.108.3', 10088),
    ('78.235.153.136', 10619),
    ('88.189.113.32', 33192),
    ('81.57.9.183', 5514),
    ('82.251.17.155', 14721),
    ('88.168.207.178', 31466),
    ('82.238.89.236', 32970),
    ('78.226.209.88', 2881),
    ('5.164.219.48', 6881),
    ('78.225.252.39', 31002)
]

Subsequent calls to get_peers may return more peers.

You may also inherit btdht.DHT_BASE and overload some of the on_`msg`_(query|response) functions. See the doc for a full overview of the btdht API.

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

btdht-0.3.2.tar.gz (606.1 kB view details)

Uploaded Source

Built Distributions

btdht-0.3.2-cp36-cp36m-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.6m Windows x86-64

btdht-0.3.2-cp36-cp36m-win32.whl (1.0 MB view details)

Uploaded CPython 3.6m Windows x86

btdht-0.3.2-cp35-cp35m-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.5m Windows x86-64

btdht-0.3.2-cp35-cp35m-win32.whl (1.0 MB view details)

Uploaded CPython 3.5m Windows x86

btdht-0.3.2-cp27-cp27m-win_amd64.whl (1.1 MB view details)

Uploaded CPython 2.7m Windows x86-64

btdht-0.3.2-cp27-cp27m-win32.whl (1.0 MB view details)

Uploaded CPython 2.7m Windows x86

File details

Details for the file btdht-0.3.2.tar.gz.

File metadata

  • Download URL: btdht-0.3.2.tar.gz
  • Upload date:
  • Size: 606.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for btdht-0.3.2.tar.gz
Algorithm Hash digest
SHA256 f134f0dc1a135fcf36abc4889d9343190526a8e02145323df368b1dd9f3882cb
MD5 7cd97f173db84e4f57dae6f82d87df31
BLAKE2b-256 ff744449f3e7589cab22649ddecc75667b6053d92049a063fd4f9afa8380f889

See more details on using hashes here.

File details

Details for the file btdht-0.3.2-cp36-cp36m-win_amd64.whl.

File metadata

File hashes

Hashes for btdht-0.3.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 01926d42f4218e5290ae0d45dd343235985da888c0fb23f174c858689a2c8caa
MD5 e9763980881bbc42d2b9c55c0e23e46e
BLAKE2b-256 0cf79067f1cad4151dfc1d1ef65a37a486efa5d78f0180a5c9e7a6b341324b63

See more details on using hashes here.

File details

Details for the file btdht-0.3.2-cp36-cp36m-win32.whl.

File metadata

File hashes

Hashes for btdht-0.3.2-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 55efceaed699914a736d61a60b4f95131bbff3cfb1b04ee62e4df6168905e85f
MD5 0a00e11e33dc105b1163d4588920fe8c
BLAKE2b-256 00eaf9747e1a453de24f202b55a441706c5848ca61e83bf0a6be6c6d3baffff9

See more details on using hashes here.

File details

Details for the file btdht-0.3.2-cp35-cp35m-win_amd64.whl.

File metadata

File hashes

Hashes for btdht-0.3.2-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 3964ab2a27294ab613fc6ea6d932bc230b99c1908be00a63ba565cbe9cb6ccdf
MD5 36ce425f6082301656e0d8e634fee65d
BLAKE2b-256 b8cd403f9791d03877e7ead706b8d1651c61fddc13f7f5a16f445a364f82fa27

See more details on using hashes here.

File details

Details for the file btdht-0.3.2-cp35-cp35m-win32.whl.

File metadata

File hashes

Hashes for btdht-0.3.2-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 cfdb578677b1d8d55a15953623a305116e2474b0ebb5a94f2d22acab6201f989
MD5 c7a5ea4005eb33187e4023b68f55a5a5
BLAKE2b-256 c3f82dcb6537b0b2e874dfaff4f995f54f5538fb96e170aff89da9772819c5ec

See more details on using hashes here.

File details

Details for the file btdht-0.3.2-cp27-cp27m-win_amd64.whl.

File metadata

File hashes

Hashes for btdht-0.3.2-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 479a754c2bdfaa904555bf93fa49ef182476d17ddfb2aa2743e57de12caa17aa
MD5 91340ba4a0cd95113475af91f24a0387
BLAKE2b-256 c426b2a7d8ca79d055d8f415767828af0bd25dd2a2ff8683c43b8695fef998db

See more details on using hashes here.

File details

Details for the file btdht-0.3.2-cp27-cp27m-win32.whl.

File metadata

File hashes

Hashes for btdht-0.3.2-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 7aa7d1391ab30bae8428dfaf360c2500d038b57c34f6bebbbf87c1e1a29e9079
MD5 4e11944f2313bf04e725a85f30d3eea2
BLAKE2b-256 efb17acc9d66225c74dfb22abace921b6f266daf790f4667e43e91990ee48226

See more details on using hashes here.

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