3

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

Stav Alfi
  • 13,139
  • 23
  • 99
  • 171

1 Answers1

5

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!

Encombe
  • 2,003
  • 1
  • 17
  • 26
  • Thanks so much! How can I read the binary data? which encoding is that? – Stav Alfi Mar 09 '18 at 08:08
  • I got different result then you got: `d8:completei2583e12:crypto_flags50: 10:incompletei118e8:intervali1800e5:peers300:¹æ}-ß[¹”}åÇI…?!áNƒo‹‹°?²MÈÕÄ6)0©ŒTõ ÿÔ\|vh®N]á_ˆa}Þ;%»mYÇ©NÁX;å¹Ù1Ì7ÙÅ =.À™ê[Æ^SÔgºÈÕ]‹–L]¦l=ªlâVe\ “KŠJ@·àÀƒ,4èîä`ŽAñV“R+ÈÕW{ ÈÕRÿ×Ð^ègñ="ÈÕ¬Ò®á.ö&íÈÕ`Yù“ÈÕQ"@x#''P”ÈÕQ«IàÂA·LKê`Sý~;È[<ÌÔ1Yæ¾0ÈÕ\ùòzb¤36Ù¼ZpFÈÕ—P]DÙ.ImÈÕ¹ÙÓ‘3ÿ\½_V¾ËÈ×B7ÎDê``Q>±áÀƒ,)IHBœÈÕ²,”ÿÛ›]¨PÛïe` Why? – Stav Alfi Mar 09 '18 at 08:10
  • 1
    The binary data is a string consisting of multiples of 6 bytes. First 4 bytes are the IP address and last 2 bytes are the port number. All in big endian notation. See the wiki or BEP23. The key: **crypto_flags** is sent by the tracker if a peer sent **supportcrypto=1** or **requirecrypto=1** in the *announce*.See: http://wiki.vuze.com/w/Message_Stream_Encryption – Encombe Mar 09 '18 at 12:30