Bittorrent DHT research tools and libs
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

WTF is this?

This is my BitTorrent Distributed Hash Tables research project.

Where i can use it?

This tool has several main purposes:

  1. To be a custom Python BTDHT realization, which you can easily use in your application. You can play with DHT protocol, fuzz it, change DHT internal timing limits etc.
  2. Act as my Proof-Of-Concept of DHT amplification DDoS attack

Is BitTorrent protocol included?

No. This is just DHT.


Lookup for BitTorrent peers for 746385fe32b268d513d068f22c53c46d2eb34a5c hash in BitTorrent DHT:

import time
from btdht import DHT 

current_magnet = "746385fe32b268d513d068f22c53c46d2eb34a5c".decode("hex")

if __name__ == "__main__":

    # Start DHT Node on port 60000
    dht = DHT(host='', port=60000)
    # Boostrap it
    dht.bootstrap('', 6881)
    # Find me peers for that torrent hashes

    res = []  
    for count in xrange(5):
        print("DHT Nodes found: %d" % (dht.rt.count()))
        print("Bad DHT nodes found: %d" % (dht.rt.bad_count()))
        print("Total peers found: %d" % (
        # How many peers at this moment?
        peers =
        for peer in peers:
            print("Found peer: %s:%d" % (peer))
    print("Total peers found: %d" % (len(res)))