Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending Bittorrent HTTP request to Ubuntu tracker

I downloaded the torrent file of ubuntu 17.10 from here: https://www.ubuntu.com/download/alternative-downloads

Here is what inside:

TorrentInfo{Created By: null
Main tracker: http://torrent.ubuntu.com:6969/announce
Comment: Ubuntu CD releases.ubuntu.com
Info_hash: f07e0b0584745b7bcb35e98097488d34e68623d0
Name: ubuntu-17.10.1-desktop-amd64.iso
Piece Length: 524288
Pieces: 2866
Total Size: 1502576640
Is Single File Torrent: true
File List: 
Tracker List: 
http://torrent.ubuntu.com:6969/announce
http://ipv6.torrent.ubuntu.com:6969/announce

What I have tried:

I sent: (Only torrent info-hash)

http://torrent.ubuntu.com:6969/announce?info_hash=%f0%7e%0b%05%84%74%5b%7b%cb%35%e9%80%97%48%8d%34%e6%86%23%d0

and received:

you sent me garbage - id not of length 20

I sent: (torrent info-hash and my peer-id)

http://torrent.ubuntu.com:6969/announce?info_hash=%f0%7e%0b%05%84%74%5b%7b%cb%35%e9%80%97%48%8d%34%e6%86%23%d0&peer_id=%2D%41%5A%35%37%35%30%2D%54%70%6B%58%74%74%5A%4C%66%70%53%48

and received:

you sent me garbage - invalid literal for long() with base 10: ''


What am I missing? The spec doesn't specify any example.

Spec:

https://wiki.theory.org/index.php/BitTorrentSpecification#Tracker_HTTP.2FHTTPS_Protocol

like image 536
Stav Alfi Avatar asked Sep 08 '25 10:09

Stav Alfi


1 Answers

The announce misses the obligatory keys port, uploaded, downloaded and left.
These keys plus info_hash and peer_id, MUST be in every announce.

Further, while the event key isn't obligatory in every announce,
the first announce to the tracker MUST include 'event=started'.

Trying:

http://torrent.ubuntu.com:6969/announce?info_hash=%f0%7e%0b%05%84%74%5b%7b%cb%35%e9%80%97%48%8d%34%e6%86%23%d0&peer_id=%2D%41%5A%35%37%35%30%2D%54%70%6B%58%74%74%5A%4C%66%70%53%48&port=6881&uploaded=0&downloaded=0&left=1502576640&event=started

and the tracker responses with:

your client is outdated, please upgrade

oh well, more to fix...

From my answer here: Why does tracker server NOT understand my request? (Bittorrent protocol)

It is because the request string don't have compact=1 in it.
Most tracker require that nowadays. The legacy way is too ineffective.

So, adding compact=1 to the announce:

http://torrent.ubuntu.com:6969/announce?info_hash=%f0%7e%0b%05%84%74%5b%7b%cb%35%e9%80%97%48%8d%34%e6%86%23%d0&peer_id=%2D%41%5A%35%37%35%30%2D%54%70%6B%58%74%74%5A%4C%66%70%53%48&port=6881&uploaded=0&downloaded=0&left=1502576640&event=started&compact=1

and the tracker responses with:

d8:completei2134e10:incompletei100e8:intervali1800e5:peers300:[ binary data ... ]e

Success!

like image 165
Encombe Avatar answered Sep 11 '25 20:09

Encombe