mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-07 21:25:12 +02:00
ipp2p: bittorrent commands
After testing I decide to write my patch to bittorrent GET commands from xt_ipp2p.c because old procedure is useless for modified and/or private trackers. BTW: info_hash may be 3rd argument, passkey (private trackers) may be 1st argument (or not) etc. so we need to search.
This commit is contained in:

committed by
Jan Engelhardt

parent
2ef714cc93
commit
43864ac6f1
@@ -1,6 +1,7 @@
|
||||
|
||||
HEAD
|
||||
====
|
||||
- ipp2p: updated bittorent command recognition
|
||||
|
||||
|
||||
Xtables-addons 1.23 (February 24 2010)
|
||||
|
@@ -505,19 +505,18 @@ search_bittorrent(const unsigned char *payload, const unsigned int plen)
|
||||
if (payload[0] == 0x13)
|
||||
if (memcmp(payload + 1, "BitTorrent protocol", 19) == 0)
|
||||
return IPP2P_BIT * 100;
|
||||
|
||||
/*
|
||||
* get tracker commandos, all starts with GET /
|
||||
* then it can follow: scrape| announce
|
||||
* and then ?hash_info=
|
||||
* Any tracker command starts with GET / then *may be* some file on web server
|
||||
* (e.g. announce.php or dupa.pl or whatever.cgi or NOTHING for tracker on root dir)
|
||||
* but *must have* one (or more) of strings listed below (true for scrape and announce)
|
||||
*/
|
||||
if (memcmp(payload, "GET /", 5) == 0) {
|
||||
/* message scrape */
|
||||
if (memcmp(payload + 5, "scrape?info_hash=", 17) == 0)
|
||||
if (HX_memmem(payload, plen, "info_hash=", 9) != NULL)
|
||||
return IPP2P_BIT * 100 + 1;
|
||||
/* message announce */
|
||||
if (memcmp(payload + 5, "announce?info_hash=", 19) == 0)
|
||||
if (HX_memmem(payload, plen, "peer_id=", 8) != NULL)
|
||||
return IPP2P_BIT * 100 + 2;
|
||||
if (HX_memmem(payload, plen, "passkey=", 8) != NULL)
|
||||
return IPP2P_BIT * 100 + 4;
|
||||
}
|
||||
} else {
|
||||
/* bitcomet encryptes the first packet, so we have to detect another
|
||||
|
Reference in New Issue
Block a user