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.3.tar.gz (618.5 kB view details)

Uploaded Source

Built Distributions

btdht-0.3.3-cp37-cp37m-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.7m Windows x86-64

btdht-0.3.3-cp37-cp37m-win32.whl (1.0 MB view details)

Uploaded CPython 3.7m Windows x86

btdht-0.3.3-cp37-cp37m-manylinux1_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m Windows x86

btdht-0.3.3-cp36-cp36m-manylinux1_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.6m

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

Uploaded CPython 3.5m Windows x86-64

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

Uploaded CPython 3.5m Windows x86

btdht-0.3.3-cp35-cp35m-manylinux1_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.5m

btdht-0.3.3-cp34-cp34m-manylinux1_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.4m

btdht-0.3.3-cp27-cp27mu-manylinux1_x86_64.whl (2.8 MB view details)

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7m Windows x86-64

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

Uploaded CPython 2.7m Windows x86

btdht-0.3.3-cp27-cp27m-manylinux1_x86_64.whl (2.8 MB view details)

Uploaded CPython 2.7m

File details

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

File metadata

  • Download URL: btdht-0.3.3.tar.gz
  • Upload date:
  • Size: 618.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.13

File hashes

Hashes for btdht-0.3.3.tar.gz
Algorithm Hash digest
SHA256 84ac598a13e1b732246c74724face46c05013da810b473d02cf539a4c70fd2a8
MD5 4dda0d09a9f537cb60e8cb328dcc7cd5
BLAKE2b-256 a9c796ef205f25ac29224f6a04a3d1236b42f835d7d872a674b39077649d83e0

See more details on using hashes here.

File details

Details for the file btdht-0.3.3-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: btdht-0.3.3-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.13

File hashes

Hashes for btdht-0.3.3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 c7e6095cf0c4c5662d207f3a672dff57255ffca0db5fcc2c83028a7a99f16147
MD5 95d448266ddcaa8d2d4707142d9ee250
BLAKE2b-256 f36e2f6e7dd94c38d1a46c3befcf6d412f63c8a69381011a018ac3dbf1d65791

See more details on using hashes here.

File details

Details for the file btdht-0.3.3-cp37-cp37m-win32.whl.

File metadata

  • Download URL: btdht-0.3.3-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.13

File hashes

Hashes for btdht-0.3.3-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 fda6d26e71eb832db7269ffbc14167abd25f869497f0d2056fddb888b81080f4
MD5 0973eac982ce1760f6e1d122f09d22b6
BLAKE2b-256 2e84b80ea35f1d9e219027e7754039f91508a0a49872ab937acebc2571467ca0

See more details on using hashes here.

File details

Details for the file btdht-0.3.3-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: btdht-0.3.3-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.13

File hashes

Hashes for btdht-0.3.3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8d4448347ba06e1a15cdda9438187973237ce587a33f6a1da32a0aeee7995142
MD5 55a930ef2136008420ae0554d91f296e
BLAKE2b-256 5cbe4a3d8e70f4e2bb0fe454c6f1c42e497fe8eb49483461623f7067bd05dc3c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: btdht-0.3.3-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.13

File hashes

Hashes for btdht-0.3.3-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 08276276a9daa4bfeca453cdce53157ca21da3ef67bb47822f9a5cb748f11557
MD5 88fb9249a6e5a8a37e96a0f647d8f898
BLAKE2b-256 b4bf960784d64e4894b63359b2ebc872bc12022f8b5bdba37055c3bf682f0858

See more details on using hashes here.

File details

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

File metadata

  • Download URL: btdht-0.3.3-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.13

File hashes

Hashes for btdht-0.3.3-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 8b40f02938136e74abdedab5a9c968c27e49da4e0b6ca4a132fcaf77c205d4f5
MD5 a932ffd6f4c4cf9e957f3253cf19e807
BLAKE2b-256 29e1da13e4c950e906a0dcb10f79d692e63bdd50b6508921fc770ec87a1d3f25

See more details on using hashes here.

File details

Details for the file btdht-0.3.3-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: btdht-0.3.3-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 3.4 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.13

File hashes

Hashes for btdht-0.3.3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 dc243a1b49c69ff9677fe67ff0dff8ae09fe9729b64dfcccda7c3fa2daed35fb
MD5 379832aecc050f42fe97662ae9e562fb
BLAKE2b-256 1f98f570292434e3d563e7194d23b6964705940add60c622e79495f27d0d4fb3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: btdht-0.3.3-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.13

File hashes

Hashes for btdht-0.3.3-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 7b243e0752d81dd07c9261a77405e62e246986a55a3d0b7be5a429ba5a4c61ca
MD5 87525d1a89c9d8a8075a01bcc40e3482
BLAKE2b-256 69a2aa09bfb43af5d89f307ecacfc8a2292433fa3a1094e9cf62a2e4d2c62ab7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: btdht-0.3.3-cp35-cp35m-win32.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.5m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.13

File hashes

Hashes for btdht-0.3.3-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 a4b8d800bd6ebe54161bb7702ec0ffdb077aad1440da842c74d5790735c0552b
MD5 21725f9d2754c40494700d3a39aa7bf8
BLAKE2b-256 15a4020d600b5d42a6fad0dca166194d0f7aa4bc07cd1799161bf4fd8b2bba77

See more details on using hashes here.

File details

Details for the file btdht-0.3.3-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: btdht-0.3.3-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.13

File hashes

Hashes for btdht-0.3.3-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 135bac88ca4a38a028860a6361ca447d426c370e0245cb64da5c9b8c517aba62
MD5 33f77ef8f422ff9cc7d8bf9490e6a037
BLAKE2b-256 80c437332a09b46db905004f9b97c04995cdbf4d9445851f03bb76d143d1505c

See more details on using hashes here.

File details

Details for the file btdht-0.3.3-cp34-cp34m-manylinux1_x86_64.whl.

File metadata

  • Download URL: btdht-0.3.3-cp34-cp34m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: CPython 3.4m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.13

File hashes

Hashes for btdht-0.3.3-cp34-cp34m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b2f3be281853273d8d90b42095c6f81e26e53d10745a9875f649a184dbcc3b08
MD5 d4c6fbd6a6bae1ece9fe6ce9ecdc2ecc
BLAKE2b-256 8298f752f523a207254d1d7a1790556679016f107e3d10c9b183706028e2ff89

See more details on using hashes here.

File details

Details for the file btdht-0.3.3-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

  • Download URL: btdht-0.3.3-cp27-cp27mu-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 2.7mu
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.13

File hashes

Hashes for btdht-0.3.3-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5b2d357550a07c0fe649ae463f6fd47d4bd41393832fa195e0ecab4f81bb8287
MD5 aa13d9c0114e1f865316e9fd1335c3c9
BLAKE2b-256 d2b16f1ec70b9ca78828e22ce5b10e6a8d0717c9bb5fe55c82160fb9a7cb9919

See more details on using hashes here.

File details

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

File metadata

  • Download URL: btdht-0.3.3-cp27-cp27m-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 2.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.13

File hashes

Hashes for btdht-0.3.3-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 7e60a2e1b1af1ebe296754cc46e833588a43540ae3c140daf5e3194cb27bb7b1
MD5 4a7be1942e88edfa98d300ad1251c7b3
BLAKE2b-256 c60d38d320f0573ef3fbf3773ee04f354a09aa1313950713a7f13f717070edf5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: btdht-0.3.3-cp27-cp27m-win32.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 2.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.13

File hashes

Hashes for btdht-0.3.3-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 1639e43761cab6c2a227aa17bede6700f6bcbaf181510db559c9afefe76c8f54
MD5 a950631c220491108026778383ff9e70
BLAKE2b-256 955241a267a3a9c494369a595850ea6a12d35898f2398659d4ef73cb14d89ac5

See more details on using hashes here.

File details

Details for the file btdht-0.3.3-cp27-cp27m-manylinux1_x86_64.whl.

File metadata

  • Download URL: btdht-0.3.3-cp27-cp27m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 2.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.13

File hashes

Hashes for btdht-0.3.3-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ec94e760e8311b8d0d5d064a163d8e3acecd6cb04f749a99e2a4e7fd858d0a60
MD5 06f1852c499602042668270806490308
BLAKE2b-256 f44603faa1f6eea8c3f780d638ec5cfd11d6e328a38f717470460175251cce2a

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