BitTorrent Tracker Protocol examples

HTTP Tracker

HTTP protocol is used and a typical request contains

  • info_hash
    • 20 byte sha1 hash of the bencoded form of the info value from the metainfo file
  • key
  • peer_id
    • string of length 20 which this downloader uses as its id
  • port
  • downloaded
    • total amount downloaded so far
  • left
    • number of bytes this peer still has to download
  • uploaded
    • total amount uploaded so far
  • compact
  • event
    • optional key which maps to started, completed, or stopped

Examples:

GET /announce?peer_id=aaaaaaaaaaaaaaaaaaaa&
info_hash=aaaaaaaaaaaaaaaaaaaa&
port=6881&
left=0&
downloaded=100&
uploaded=0&
compact=1
GET /announce?info_hash=%fc~6%f2%d01d%8e%f3%cd%dd%a0%1f%f7%3a%9d%ffH%cd%e3&
peer_id=-UT3480-P%a6%93%02%b4%40%27%9b%60%e9A%ed&
port=20111&uploaded=0&
downloaded=0&
left=0&
corrupt=0&
key=10E0CE47&
event=started&
numwant=200&
compact=1&
no_peer_id=1&
ip=192.168.43.188

HTTP/1.1
Host: 192.168.189.128:9000
User-Agent: uTorrent/348(110208592)(42576)
Accept-Encoding: gzip
Connection: Close

Screen Shot 10-30-17 at 03.33 PM 001Screen Shot 10-30-17 at 03.33 PM

HTTP Tracker Responses

    • Tracker responses are bencoded dictionaries.
        • if a tracker response has a key failure reason that maps to a human readable string which explains why the query failed

       

    • the response contains two typical keys:
      • interval
          • number of seconds the downloader should wait between regular rerequests

         

      • peers. peers
        • a list of peers, each peer containing
            • peer id
            • ip
            • port

           

Examples:

HTTP/1.1 200 OK

d8:intervali1800e5:peersld2:ip13:192.168.189.14:porti20111eeee

Screen Shot 10-30-17 at 03.41 PM

UDP Tracker

URLs for this protocol use the form udp://tracker:port. This type of tracker was created to improve on the overhead caused by the HTTP protocol usage. The URLs can be obtained in the metadata file for the torrent.

Possible requests supported by a UDP Tracker:

  • 0: connect
  • 1: announce
  • 2: scrape
  • 3: error

Connect Request

Before announcing, the client must obtain a connection ID (to avoid IP spoofing problems).

  • Choose a (random) transaction ID, Fill the connect input structure, Send the packet.
  • connect input
    • Offset 00 | 64-bit integer | connection_id 0x41727101980
      Offset 08 | 32-bit integer | action 0 (connect)
      Offset 12 | 32-bit integer | transaction_id

ExampleScreen Shot 10-30-17 at 04.00 PM

Connect Response

  • connect response
    • Offset 00 | 32-bit integer | action 0 (connect)
      Offset 04 | 32-bit integer | transaction_id
      Offset 08 | 64-bit integer | connection_id (random)

Announce, scrape, error

These messages are similar to the connect message, using the same semantics as the HTTP Tracker requests.

References

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s