CorralPeltzer / newTrackon

newTrackon, a public open BitTorrent trackers monitoring tool
https://newtrackon.com
MIT License
607 stars 58 forks source link

"Announce error: unknown option type" from Chihaya tracker #28

Closed HarryS closed 6 years ago

HarryS commented 6 years ago

Hi,

Noticed that two trackers running Chihaya v2 (udp://explodie.org:6969/announce and udp://ipv4.tracker.harry.lu:80/announce) get this response on https://newtrackon.com/raw:

Error while annoucing: b'u'

Here's the full error response:

Error while: b'\x00\x00\x00\x03\x00\x00\x00\x89unknown option type\x00'

It gets a connection_id properly, but then fails at udp_create_announce_request.

I don't think this is an issue with Chihaya, but rather that other tracker softwares aren't adhering as strictly to the BEPs as they do, because both of these trackers work perfectly fine in any normal BT client. Thanks!

mrd0ll4r commented 6 years ago

To chime in here: Someone from our IRC picked up on this and identified https://github.com/CorralPeltzer/newTrackon/blob/e80a6cf2cc588469d8d251b8e38914e2d73a2e32/scraper.py#L224 as the probable cause. The port is supposed to be a 16-bit unsigned integer, but from the looks of it, the packet is constructed using a 32-bit port.

Because chihaya handles BEP 41 we assume the bytes following the port are extensions, and try to identify the first option type. That doesn't work because that byte is probably 0x76, which is not a valid option type.

HarryS commented 6 years ago

Changed the fmt to !H, works good now. Also tested with this change against a few opentracker trackers and it still worked.

CorralPeltzer commented 6 years ago

Thanks a lot for the catch and the fix! The change is now live on the server.