From: Tomasz Tomkowiak <bloodman@gmail.com>
To: netfilter-devel@vger.kernel.org
Subject: xtables-addons: ipp2p: bittorrent commands patch
Date: Tue, 26 Jan 2010 06:16:04 +0100 [thread overview]
Message-ID: <1202414722.20100126061604@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1776 bytes --]
Hello guys,
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. teh new
works fine but maybe someone can rewrite it to better C
(yeah, im C/C++ n00b ;)
btw. info_hash may be 3rd argument, passkey (private trackers)
may be 1st argument (or not) etc. etc. so we need to search.
---
--- xtables-addons-1.22.old/extensions/xt_ipp2p.c 2010-01-22 20:14:37.000000000 +0100
+++ xtables-addons-1.22/extensions/xt_ipp2p.c 2010-01-26 06:05:47.000000000 +0100
@@ -505,19 +505,18 @@
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
+ * (eg. 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)
- return IPP2P_BIT * 100 + 1;
- /* message announce */
- if (memcmp(payload + 5, "announce?info_hash=", 19) == 0)
- return IPP2P_BIT * 100 + 2;
+ if(strstr(payload, "info_hash=") != NULL)
+ return IPP2P_BIT * 100 + 1;
+ if(strstr(payload, "peer_id=") != NULL)
+ return IPP2P_BIT * 100 + 2;
+ if(strstr(payload, "passkey=") != NULL)
+ return IPP2P_BIT * 100 + 4;
}
} else {
/* bitcomet encryptes the first packet, so we have to detect another
---
--
Tomasz 'BloodMan' Tomkowiak
[-- Attachment #2: xt_ipp2p.patch --]
[-- Type: application/octet-stream, Size: 1318 bytes --]
--- xtables-addons-1.22.old/extensions/xt_ipp2p.c 2010-01-22 20:14:37.000000000 +0100
+++ xtables-addons-1.22/extensions/xt_ipp2p.c 2010-01-26 06:05:47.000000000 +0100
@@ -505,19 +505,18 @@
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
+ * (eg. 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)
- return IPP2P_BIT * 100 + 1;
- /* message announce */
- if (memcmp(payload + 5, "announce?info_hash=", 19) == 0)
- return IPP2P_BIT * 100 + 2;
+ if(strstr(payload, "info_hash=") != NULL)
+ return IPP2P_BIT * 100 + 1;
+ if(strstr(payload, "peer_id=") != NULL)
+ return IPP2P_BIT * 100 + 2;
+ if(strstr(payload, "passkey=") != NULL)
+ return IPP2P_BIT * 100 + 4;
}
} else {
/* bitcomet encryptes the first packet, so we have to detect another
next reply other threads:[~2010-01-26 5:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-26 5:16 Tomasz Tomkowiak [this message]
[not found] ` <alpine.LSU.2.01.1002212207100.7948@obet.zrqbmnf.qr>
2010-02-23 23:40 ` xtables-addons: ipp2p: bittorrent commands patch Jan Engelhardt
2010-02-27 15:00 ` Jan Engelhardt
-- strict thread matches above, loose matches on Subject: below --
2010-02-01 4:39 bloodman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1202414722.20100126061604@gmail.com \
--to=bloodman@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).