开发者

Bittorrent tracker reply for scrape when '00' in infohash

开发者 https://www.devze.com 2023-02-20 14:59 出处:网络
My Question regards the scrape http reply when the infohash contains a \'00\', scrape request with %00, so there would be a \'\\0\' in http reply.

My Question regards the scrape http reply when the infohash contains a '00', scrape request with %00, so there would be a '\0' in http reply. I found some torrents which have zero bytes in infohash and I wonder how the tracker should reply to scrape requests for that torrents. I mean would a '\0' normally work? I tested this torr开发者_开发百科ents with torrentspy and it always says:

"Torrent not found on Tracker; may be rotten"

I wrote a basic tracker to test that and verified that the complete scrape reply was written to socket but torrentspy still has the same output. When I have a look to that scrape reply in a webbrowser it ends at the '\0'

Is anyone able to bring light into the dark?


It's not entirely clear what your question is, but I'll try to fill some stuff in.

'\0' is no different than any other non-printable character. All non URL safe character always have to be escaped as %xx in the GET request to an HTTP tracker. Some trackers have bugs where they for instance assume that characters that don't need to be escaped are not escaped (i.e. they may store the escaped version of the info-hash as their internal representation). Some web servers may even assume that ` (single quote) always is escaped (allowing SQL injection attacks). All special characters must to be escaped, especially & and % (obviously).

The response is much simpler. Since the response from a tracker is bencoded, all info-hashes are sent in binary form. i.e. there's no encoding going on at all. When you decode it, you might want to hex encode the info-hash, since that's a more user friendly representation, and also the conventional way of printing them (on web-sites, magnet links, applications).

So, to your question. When you say "torrents which have zero bytes in infohash", I'm assuming you mean their info-hash has one more more bytes which is 0. This is perfectly normal and not uncommon. Would it normally work? Yes, you just need to make sure to escape it as %00, just like you would have to do with %01.

Your torrent is probably dead, i.e. the tracker stopped tracking it. That's what that error message means. It probably doesn't have anything to do with having a zero-byte in the info-hash.

0

精彩评论

暂无评论...
验证码 换一张
取 消