Commit cf9f32e3 authored by 's avatar
Browse files

Added sigs to gnutella and torrent trackers


git-svn-id: file:///home/svn/mapi/trunk@538 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 32ede150
......@@ -53,12 +53,13 @@ struct list{
};
#define HASHTABLESIZE 1024
#define GNUTELLA_STRING_NO 4
char *gnutella_strings[3]={"GET /uri-res/N2R?urn:sha1:","GNUTELLA CONNECT/","GNUTELLA/"};//,"GET /get/"};
char *gnutella_strings[GNUTELLA_STRING_NO]={"GET /uri-res/N2R?urn:sha1:","GNUTELLA CONNECT/","GNUTELLA/", "Server: LimeWire/"};//,"GET /get/"};
struct mapid_gnutella {
int *shift[3];
int *skip[3];
int *shift[GNUTELLA_STRING_NO];
int *skip[GNUTELLA_STRING_NO];
struct list **gnulist;
};
......@@ -76,7 +77,7 @@ static int gnutella_init(mapidflib_function_instance_t *instance, MAPI_UNUSED in
((struct mapid_gnutella*)instance->internal_data)->gnulist[i]->head = NULL;
((struct mapid_gnutella*)instance->internal_data)->gnulist[i]->tail = NULL;
}
for(i=0;i<3;i++) {
for(i=0;i<GNUTELLA_STRING_NO;i++) {
((struct mapid_gnutella*)instance->internal_data)->shift[i] = make_shift(gnutella_strings[i],strlen(gnutella_strings[i]));
((struct mapid_gnutella*)instance->internal_data)->skip[i] = make_skip(gnutella_strings[i], strlen(gnutella_strings[i]));
}
......@@ -88,7 +89,7 @@ int isGnutella(mapidflib_function_instance_t *instance, unsigned char *pkt, unsi
{
int i=0;
for(i=0;i<3;i++) {
for(i=0;i<GNUTELLA_STRING_NO;i++) {
if(len < strlen(gnutella_strings[i]))
continue;
......
......@@ -57,16 +57,16 @@ struct list{
#define TOR_STRINGS_NO 14
char *torrent_strings[TOR_STRINGS_NO]={"BitTorrent protocol","GET /scrape?info_hash=","GET /announce?info_hash=", "d1:rd2:id20:", "d1:ad2:id20:", "BT_PIECE"
, "BT_REQUEST", "BT_CHOKE", "BT_UNCHOKE", "BT_HAVE", "BT_UNINTERESTED", "BT_INTERESTER", "BT_BITFIELD", "BT_CANCEL"};
,"BT_REQUEST", "BT_CHOKE", "BT_UNCHOKE", "BT_HAVE", "BT_UNINTERESTED", "BT_INTERESTER", "BT_BITFIELD", "BT_CANCEL"};
int torrent_lens[TOR_STRINGS_NO]={20, 100, 100, 20, 20, 50, 50, 50, 50, 50, 50, 50, 50 , 50};
int isTorrent(mapidflib_function_instance_t *, unsigned char *, unsigned int );
struct mapid_torrent {
int *shift[5];
int *skip[5];
unsigned int search_len[5];
int *shift[TOR_STRINGS_NO];
int *skip[TOR_STRINGS_NO];
unsigned int search_len[TOR_STRINGS_NO];
struct list **torlist;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment