PDA

View Full Version : Deluge



anthony-joal
10.08.17, 19:00
Please before reading this thread, read Client file format (https://www.sb-innovation.de/f275/announce-parameters-url-headers-33455/).

Since BitTorrent clients are updated regularly, i'll post the default file template for Deluge. And will list any changes for a particular version against this default template.

Default template


{
"keyGenerator": {
"length": 8,
"type": "hash_no_leading_zero",
"refreshOn": "TORRENT_PERSISTENT",
"case": "upper"
},
"peerIdGenerator": {
"pattern": "xxxxxxxxxxxxx",
"refreshOn": "NEVER",
"shouldUrlEncode": false
},
"urlEncoder": {
"encodingExclusionPattern": "[A-Za-z0-9_~\(\)\!\.\*-]",
"encodedHexCase": "lower"
},
"query": "info_hash={infohash}&peer_id={peerid}&port={port}&uploaded={uploaded}&downloaded={downloaded}&left={left}&corrupt=0&key={key}&event={event}&numwant={numwant}&compact=1&no_peer_id=1&supportcrypto=1&redundant=0",
"numwant": 200,
"numwantOnStop": 0,
"requestHeaders": [
{ "name": "Host", "value": "xxxxx"},
{ "name": "User-Agent", "value": "xxxxxxxxxxxxxx" },
{ "name": "Accept-Encoding", "value": "gzip" },
{ "name": "Connection", "value": "close" }
]
}


1.3.15
peerIdGenerator.pattern: -DE13F0-[A-Za-z0-9_~\(\)\!\.\*-]{12}
requestHeaders.User-Agent: Deluge 1.3.15

anthony-joal
13.08.17, 16:07
Updated file format to a more readable one.

anon
18.06.19, 19:43
I installed Deluge 2.0.3 on Lubuntu 18.04 from the official repositories today (there is no Windows port yet, and I don't have the time to compile one), and its announces look like this.


GET /announce?info_hash=%84%b8%b8pm%7f%c5%bb%c1%93%f2%5 d%8b%24%19~%dce%a2%fd&peer_id=-DE203s-JVXJE2-zYA8M&port=54143&uploaded=0&downloaded=0&left=790626304&corrupt=0&key=EEB6FF6B&event=started&numwant=200&compact=1&no_peer_id=1&supportcrypto=1&redundant=0 HTTP/1.1
Host: torrent.ubuntu.com:6969
User-Agent: Deluge/2.0.3-2-201906121747-ubuntu18.04.1 libtorrent/1.1.5.0
Accept-Encoding: gzip
Connection: close

Note how when compared against the template in the first post, the peer_id prefix ends with "s" ("stable"?) instead of "0", and the User-Agent is expanded with additional version information. Can anyone confirm these changes on other distros, or perhaps an unofficial Windows port? This sort of thing makes it impossible to write client emulations that are safe for everyone.

anthony-joal
18.06.19, 21:27
I installed Deluge 2.0.3 on Lubuntu 18.04 from the official repositories today (there is no Windows port yet, and I don't have the time to compile one), and its announces look like this.


GET /announce?info_hash=%84%b8%b8pm%7f%c5%bb%c1%93%f2%5 d%8b%24%19~%dce%a2%fd&peer_id=-DE203s-JVXJE2-zYA8M&port=54143&uploaded=0&downloaded=0&left=790626304&corrupt=0&key=EEB6FF6B&event=started&numwant=200&compact=1&no_peer_id=1&supportcrypto=1&redundant=0 HTTP/1.1
Host: torrent.ubuntu.com:6969
User-Agent: Deluge/2.0.3-2-201906121747-ubuntu18.04.1 libtorrent/1.1.5.0
Accept-Encoding: gzip
Connection: close

Note how when compared against the template in the first post, the peer_id prefix ends with "s" ("stable"?) instead of "0", and the User-Agent is expanded with additional version information. Can anyone confirm these changes on other distros, or perhaps an unofficial Windows port? This sort of thing makes it impossible to write client emulations that are safe for everyone.

Indeed, the V2.x.x seems to introduce new patterns. The peer_id will probably be the same on every OS.

The user agent is a bit more tricky but it just need a new placeholder for {host}, shouldn't be that much work for developpers.

Also the libtorrent is going to be a fixed string on windows because it wil be a build dependency, for linux systems it "may" change but it's unlikely.

anon
18.06.19, 22:01
That's what I thought. I'll wait to check what things look like on the Windows port (when released), and then see what chances exist of accurately replicating the new behavior on RM+, mRatio and Bigly.

anon
30.09.19, 19:40
Well, since almost four months later there is still no official Windows package, today I have installed Deluge 2.0.3 by following this (https://dev.deluge-torrent.org/ticket/3201#comment:9) procedure, and observed a few details.

Firstly, as mentioned above, the peer_id prefix is -DE203s- instead of the -DE2030- that may be expected from previous patterns.

Secondly, the peer_id is different for each torrent and does not change when stopping and restarting, so the peerIdGenerator refreshOn value in the first post should now be TORRENT_PERSISTENT instead of NEVER. This change may come from libtorrent rather than the client itself; unfortunately it also results in behavior that cannot be replicated by the perfect spoof in BiglyBT Extreme Mod (but does not necessarily lead to detectability, depending on user action).

Thirdly, the User-Agent string does not include the compilation/commit date and OS name as it does on Lubuntu, only the Deluge and libtorrent version numbers. Two example announces from different torrents follow.


GET /announce?info_hash=9%0e%eco%ba%8c%c3s%b2%9bc%f1%f7 %bb%2c%88_%3f%df%d1&peer_id=-DE203s-_H1vn1s7lGXs&port=58568&uploaded=0&downloaded=0&left=1&corrupt=0&key=7D6A81E7&event=started&numwant=200&compact=1&no_peer_id=1&supportcrypto=1&redundant=0 HTTP/1.1
Host: 127.0.0.1
User-Agent: Deluge/2.0.3 libtorrent/1.1.13.0
Accept-Encoding: gzip
Connection: close

GET /announce?info_hash=%15%b5%8b%b3%b3%d1%b7%fcWni%f1x %e9%27c%e8%a5%f2%e0&peer_id=-DE203s-*KnGM*K_bgP_&port=58568&uploaded=0&downloaded=0&left=1&corrupt=0&key=3FAD9369&event=started&numwant=200&compact=1&no_peer_id=1&supportcrypto=1&redundant=0 HTTP/1.1
Host: 127.0.0.1
User-Agent: Deluge/2.0.3 libtorrent/1.1.13.0
Accept-Encoding: gzip
Connection: close

All tests were conducted using a "fake" tracker running on localhost that always returns a static failure reason. Also, Deluge occasionally made requests to the root of the tracker's server, but I didn't bother to find out why. Note how header order and the User-Agent and Accept-Encoding values differ from those in tracker announces.


GET / HTTP/1.1
Connection: close
User-Agent: Deluge/2.0.3 (https://deluge-torrent.org)
Accept-Encoding: gzip,x-gzip,deflate
Host: 127.0.0.1

anthony-joal
30.09.19, 23:00
Great job :)

I personnaly won't bother with root path http request as well, it does not sounds relevant and will most likely be fixed in future versions.
You savec me a lot of time investigating with wireshark :) Thanks for this !

anon
02.10.19, 13:31
You're welcome :happy: I'm thinking that the root request may be used to display a tracker favicon or log additional errors. Not something we need to replicate in either case.