2006-07-16 19:39:23 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (c) 2005 Transmission authors and contributors
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2007-07-12 17:51:45 +00:00
|
|
|
#include <ctype.h> /* isprint */
|
2007-07-29 18:31:25 +00:00
|
|
|
#include <stdio.h>
|
2007-07-29 18:11:21 +00:00
|
|
|
#include <string.h>
|
2007-07-18 17:25:42 +00:00
|
|
|
|
2006-07-16 19:39:23 +00:00
|
|
|
#include "transmission.h"
|
2007-07-18 17:25:42 +00:00
|
|
|
#include "trcompat.h"
|
2006-07-16 19:39:23 +00:00
|
|
|
|
2006-12-11 01:23:09 +00:00
|
|
|
static int charToInt( char character );
|
|
|
|
|
2006-12-11 01:25:28 +00:00
|
|
|
static int charToInt( char character )
|
2006-12-11 01:23:09 +00:00
|
|
|
{
|
2006-12-16 02:39:12 +00:00
|
|
|
int value;
|
2006-12-11 01:23:09 +00:00
|
|
|
if( character >= 'A' && character <= 'Z' )
|
2006-12-16 02:39:12 +00:00
|
|
|
value = 10 + character - 'A';
|
2007-07-18 00:59:08 +00:00
|
|
|
else if( character >= 'a' && character <= 'z')
|
|
|
|
value = 36 + character - 'a';
|
2006-12-16 02:39:12 +00:00
|
|
|
else
|
|
|
|
value = character - '0';
|
2006-12-11 01:23:09 +00:00
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
2007-09-20 16:32:01 +00:00
|
|
|
char * tr_clientForId( const uint8_t * id )
|
2006-07-16 19:39:23 +00:00
|
|
|
{
|
|
|
|
char * ret = NULL;
|
2006-12-19 03:22:46 +00:00
|
|
|
|
2007-01-02 03:46:47 +00:00
|
|
|
/* Azureus-style */
|
2006-07-16 19:39:23 +00:00
|
|
|
if( id[0] == '-' && id[7] == '-' )
|
|
|
|
{
|
|
|
|
if( !memcmp( &id[1], "TR", 2 ) )
|
|
|
|
{
|
2007-05-09 03:05:38 +00:00
|
|
|
/* support old-style Transmission id without maintenance number */
|
|
|
|
if ( !memcmp( &id[3], "00", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "Transmission 0.%d",
|
|
|
|
charToInt( id[5] ) * 10 + charToInt( id[6] ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-07-16 21:57:22 +00:00
|
|
|
asprintf( &ret, "Transmission %d.%c%c%s",
|
|
|
|
charToInt( id[3] ), id[4], id[5],
|
2007-08-01 02:38:31 +00:00
|
|
|
id[6] == 'Z' ? "+" : "" );
|
2007-05-09 03:05:38 +00:00
|
|
|
}
|
2006-07-16 19:39:23 +00:00
|
|
|
}
|
|
|
|
else if( !memcmp( &id[1], "AZ", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "Azureus %c.%c.%c.%c",
|
|
|
|
id[3], id[4], id[5], id[6] );
|
|
|
|
}
|
2006-12-23 20:27:24 +00:00
|
|
|
else if( !memcmp( &id[1], "UT", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "\xc2\xb5Torrent %c.%d", id[3],
|
|
|
|
charToInt( id[4] ) * 10 + charToInt( id[5] ) );
|
|
|
|
}
|
2006-07-16 19:39:23 +00:00
|
|
|
else if( !memcmp( &id[1], "BC", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "BitComet %d.%c%c",
|
2006-12-11 01:23:09 +00:00
|
|
|
charToInt( id[3] ) * 10 + charToInt( id[4] ),
|
2006-07-16 19:39:23 +00:00
|
|
|
id[5], id[6] );
|
|
|
|
}
|
2007-01-31 02:08:32 +00:00
|
|
|
else if( !memcmp( &id[1], "SZ", 2 ) || !memcmp( &id[1], "S~", 2 ) )
|
2006-07-16 19:39:23 +00:00
|
|
|
{
|
|
|
|
asprintf( &ret, "Shareaza %c.%c.%c.%c",
|
|
|
|
id[3], id[4], id[5], id[6] );
|
|
|
|
}
|
2006-08-14 22:33:41 +00:00
|
|
|
else if( !memcmp( &id[1], "BOW", 3 ) )
|
|
|
|
{
|
2007-04-19 06:22:37 +00:00
|
|
|
if( !memcmp( &id[4], "A0C", 3 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "Bits on Wheels 1.0.6" );
|
|
|
|
}
|
|
|
|
else if( !memcmp( &id[4], "A0B", 3 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "Bits on Wheels 1.0.5" );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
asprintf( &ret, "Bits on Wheels (%c%c%c)",
|
|
|
|
id[4], id[5], id[6] );
|
|
|
|
}
|
2006-08-13 21:38:19 +00:00
|
|
|
}
|
2006-09-07 21:42:41 +00:00
|
|
|
else if( !memcmp( &id[1], "BR", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "BitRocket %c.%c (%d)",
|
2006-12-11 01:23:09 +00:00
|
|
|
id[3], id[4], charToInt( id[5] ) * 10 + charToInt( id[6] ) );
|
2006-09-07 21:42:41 +00:00
|
|
|
}
|
2006-12-23 20:27:24 +00:00
|
|
|
else if( !memcmp( &id[1], "XX", 2 ) )
|
|
|
|
{
|
2007-08-10 18:06:52 +00:00
|
|
|
asprintf( &ret, "Xtorrent %c.%c (%d)",
|
|
|
|
id[3], id[4], charToInt( id[5] ) * 10 + charToInt( id[6] ) );
|
2006-12-23 20:27:24 +00:00
|
|
|
}
|
2007-02-16 02:56:19 +00:00
|
|
|
else if( !memcmp( &id[1], "TS", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "TorrentStorm %c.%c.%c.%c",
|
|
|
|
id[3], id[4], id[5], id[6] );
|
|
|
|
}
|
2006-09-22 10:05:51 +00:00
|
|
|
else if( !memcmp( &id[1], "KT", 2 ) )
|
|
|
|
{
|
2007-03-16 14:28:57 +00:00
|
|
|
if( id[5] == 'R' )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "KTorrent %c.%c RC %c",
|
|
|
|
id[3], id[4], id[6] );
|
|
|
|
}
|
|
|
|
else if( id[5] == 'D' )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "KTorrent %c.%c Dev",
|
|
|
|
id[3], id[4] );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
asprintf( &ret, "KTorrent %c.%c.%c",
|
|
|
|
id[3], id[4], id[5] );
|
|
|
|
}
|
2006-09-22 10:05:51 +00:00
|
|
|
}
|
|
|
|
else if( !memcmp( &id[1], "lt", 2 ) )
|
|
|
|
{
|
2006-12-11 01:23:09 +00:00
|
|
|
asprintf( &ret, "libTorrent %d.%d.%d.%d",
|
|
|
|
charToInt( id[3] ), charToInt( id[4] ),
|
|
|
|
charToInt( id[5] ), charToInt( id[6] ) );
|
2006-09-22 10:05:51 +00:00
|
|
|
}
|
2006-12-19 15:23:48 +00:00
|
|
|
else if( !memcmp( &id[1], "LT", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "libtorrent %d.%d.%d.%d",
|
|
|
|
charToInt( id[3] ), charToInt( id[4] ),
|
|
|
|
charToInt( id[5] ), charToInt( id[6] ) );
|
|
|
|
}
|
2007-04-01 01:24:36 +00:00
|
|
|
else if( !memcmp( &id[1], "TT", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "TuoTu %c.%c.%c",
|
|
|
|
id[3], id[4], id[5] );
|
|
|
|
}
|
|
|
|
else if( !memcmp( &id[1], "ES", 2 ) )
|
2006-11-19 21:33:49 +00:00
|
|
|
{
|
|
|
|
asprintf( &ret, "Electric Sheep %c.%c.%c",
|
|
|
|
id[3], id[4], id[5] );
|
|
|
|
}
|
2006-12-17 21:15:33 +00:00
|
|
|
else if( !memcmp( &id[1], "CD", 2 ) )
|
|
|
|
{
|
2007-03-31 00:14:32 +00:00
|
|
|
asprintf( &ret, "Enhanced CTorrent %d.%d",
|
2006-12-17 21:15:33 +00:00
|
|
|
charToInt( id[3] ) * 10 + charToInt( id[4] ),
|
|
|
|
charToInt( id[5] ) * 10 + charToInt( id[6] ) );
|
2007-03-31 00:14:32 +00:00
|
|
|
}
|
|
|
|
else if( !memcmp( &id[1], "CT", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "CTorrent %c.%c.%d",
|
|
|
|
id[3], id[4],
|
|
|
|
charToInt( id[5] ) * 10 + charToInt( id[6] ) );
|
2006-12-17 21:15:33 +00:00
|
|
|
}
|
2006-12-22 16:20:33 +00:00
|
|
|
else if( !memcmp( &id[1], "LP", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "Lphant %d.%c%c",
|
|
|
|
charToInt( id[3] ) * 10 + charToInt( id[4] ),
|
|
|
|
id[5], id[6] );
|
|
|
|
}
|
2007-01-16 15:49:13 +00:00
|
|
|
else if( !memcmp( &id[1], "AX", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "BitPump %d.%c%c",
|
|
|
|
charToInt( id[3] ) * 10 + charToInt( id[4] ),
|
|
|
|
id[5], id[6] );
|
|
|
|
}
|
2007-01-31 02:08:32 +00:00
|
|
|
else if( !memcmp( &id[1], "DE", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "Deluge %d.%d.%d",
|
|
|
|
charToInt( id[3] ), charToInt( id[4] ),
|
|
|
|
charToInt( id[5] ) );
|
|
|
|
}
|
2007-01-31 02:11:18 +00:00
|
|
|
else if( !memcmp( &id[1], "AG", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "Ares Galaxy %d.%d.%d",
|
|
|
|
charToInt( id[3] ), charToInt( id[4] ),
|
|
|
|
charToInt( id[5] ) );
|
|
|
|
}
|
2006-12-23 20:34:45 +00:00
|
|
|
else if( !memcmp( &id[1], "AR", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "Arctic Torrent" );
|
|
|
|
}
|
2007-03-14 02:08:40 +00:00
|
|
|
else if( !memcmp( &id[1], "BG", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "BTG %c.%c.%c.%c",
|
|
|
|
id[3], id[4], id[5], id[6] );
|
2007-04-03 13:30:19 +00:00
|
|
|
}
|
|
|
|
else if( !memcmp( &id[1], "BB", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "BitBuddy %c.%c%c%c",
|
|
|
|
id[3], id[4], id[5], id[6] );
|
2007-03-14 02:08:40 +00:00
|
|
|
}
|
2007-04-05 22:07:44 +00:00
|
|
|
else if( !memcmp( &id[1], "qB", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "qBittorrent %d.%d.%d",
|
|
|
|
charToInt( id[3] ), charToInt( id[4] ),
|
|
|
|
charToInt( id[5] ) );
|
|
|
|
}
|
2007-04-30 01:29:00 +00:00
|
|
|
else if( !memcmp( &id[1], "BF", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "Bitflu (%d/%d/%02d)",
|
|
|
|
charToInt( id[6] ),
|
|
|
|
charToInt( id[4] ) * 10 + charToInt( id[5] ),
|
|
|
|
charToInt( id[3] ) );
|
|
|
|
}
|
|
|
|
else if( !memcmp( &id[1], "FT", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "FoxTorrent (%c%c%c%c)",
|
|
|
|
id[3], id[4], id[5], id[6] );
|
|
|
|
}
|
2007-07-16 05:53:10 +00:00
|
|
|
else if( !memcmp( &id[1], "GR", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "GetRight (%c.%c.%c.%c)",
|
|
|
|
id[3], id[4], id[5], id[6] );
|
|
|
|
}
|
2007-08-03 11:01:33 +00:00
|
|
|
else if( !memcmp( &id[1], "PD", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "Pando %c.%c.%c.%c",
|
|
|
|
id[3], id[4], id[5], id[6] );
|
|
|
|
}
|
2006-12-19 03:22:46 +00:00
|
|
|
|
|
|
|
if( ret )
|
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
2006-07-16 19:39:23 +00:00
|
|
|
}
|
2006-12-19 03:22:46 +00:00
|
|
|
|
2006-12-19 16:30:34 +00:00
|
|
|
/* Tornado-style */
|
2007-02-14 16:21:59 +00:00
|
|
|
if( !memcmp( &id[4], "----", 4 ) || !memcmp( &id[4], "--0", 3 ) )
|
2006-07-16 19:39:23 +00:00
|
|
|
{
|
|
|
|
if( id[0] == 'T' )
|
|
|
|
{
|
2006-12-11 01:23:09 +00:00
|
|
|
asprintf( &ret, "BitTornado %d.%d.%d", charToInt( id[1] ),
|
2006-12-15 17:37:16 +00:00
|
|
|
charToInt( id[2] ), charToInt( id[3] ) );
|
2006-07-16 19:39:23 +00:00
|
|
|
}
|
|
|
|
else if( id[0] == 'A' )
|
|
|
|
{
|
2006-12-15 17:37:16 +00:00
|
|
|
asprintf( &ret, "ABC %d.%d.%d", charToInt( id[1] ),
|
|
|
|
charToInt( id[2] ), charToInt( id[3] ) );
|
2006-07-16 19:39:23 +00:00
|
|
|
}
|
2007-02-14 16:21:59 +00:00
|
|
|
else if( id[0] == 'R' )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "Tribler %c.%c", id[1], id[2] );
|
|
|
|
}
|
2007-02-14 16:30:11 +00:00
|
|
|
else if( id[0] == 'S' )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "Shad0w's Client %d.%d.%d", charToInt( id[1] ),
|
|
|
|
charToInt( id[2] ), charToInt( id[3] ) );
|
|
|
|
}
|
2006-12-19 03:22:46 +00:00
|
|
|
|
|
|
|
if( ret )
|
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
2006-07-16 19:39:23 +00:00
|
|
|
}
|
2006-12-19 16:30:34 +00:00
|
|
|
|
|
|
|
/* Different formatting per client */
|
2006-12-19 03:22:46 +00:00
|
|
|
if( id[0] == 'M' && id[2] == '-' && id[7] == '-' )
|
2006-07-16 19:39:23 +00:00
|
|
|
{
|
2006-12-15 06:16:20 +00:00
|
|
|
if( id[4] == '-' && id[6] == '-' )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "BitTorrent %c.%c.%c", id[1], id[3], id[5] );
|
|
|
|
}
|
|
|
|
else if( id[5] == '-' )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "BitTorrent %c.%c%c.%c", id[1], id[3], id[4], id[6] );
|
|
|
|
}
|
2006-12-19 03:22:46 +00:00
|
|
|
|
|
|
|
if( ret )
|
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
2006-08-16 01:52:20 +00:00
|
|
|
}
|
2006-12-19 03:22:46 +00:00
|
|
|
if( id[0] == 'Q' && id[2] == '-' && id[7] == '-' )
|
2006-12-16 02:27:02 +00:00
|
|
|
{
|
|
|
|
if( id[4] == '-' && id[6] == '-' )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "Queen Bee %c.%c.%c", id[1], id[3], id[5] );
|
|
|
|
}
|
|
|
|
else if( id[5] == '-' )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "Queen Bee %c.%c%c.%c", id[1], id[3], id[4], id[6] );
|
|
|
|
}
|
2006-12-19 03:22:46 +00:00
|
|
|
|
|
|
|
if( ret )
|
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
2006-12-16 02:27:02 +00:00
|
|
|
}
|
2006-12-19 03:22:46 +00:00
|
|
|
|
|
|
|
/* All versions of each client are formatted the same */
|
|
|
|
if( !memcmp( id, "exbc", 4 ) )
|
2006-07-16 19:39:23 +00:00
|
|
|
{
|
2006-12-15 05:39:06 +00:00
|
|
|
asprintf( &ret, "%s %d.%02d",
|
|
|
|
!memcmp( &id[6], "LORD", 4 ) ? "BitLord" : "BitComet",
|
|
|
|
id[4], id[5] );
|
2006-07-16 19:39:23 +00:00
|
|
|
}
|
2006-09-12 01:38:57 +00:00
|
|
|
else if( !memcmp( id, "OP", 2 ) )
|
|
|
|
{
|
2006-09-12 01:41:17 +00:00
|
|
|
asprintf( &ret, "Opera (%c%c%c%c)", id[2], id[3], id[4], id[5] );
|
2006-09-12 01:38:57 +00:00
|
|
|
}
|
2006-09-22 10:05:51 +00:00
|
|
|
else if( !memcmp( id, "-ML", 3 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "MLDonkey %c%c%c%c%c",
|
|
|
|
id[3], id[4], id[5], id[6], id[7] );
|
|
|
|
}
|
2007-01-08 04:41:18 +00:00
|
|
|
else if( !memcmp( id, "AZ", 2 ) && !memcmp( &id[6], "BT", 2 ) )
|
|
|
|
{
|
2007-01-08 15:18:05 +00:00
|
|
|
asprintf( &ret, "BitTyrant %c.%c.%c.%c",
|
2007-01-08 04:41:18 +00:00
|
|
|
id[2], id[3], id[4], id[5] );
|
|
|
|
}
|
2006-12-20 17:26:32 +00:00
|
|
|
else if( !memcmp( id, "-FG", 3 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "FlashGet %d.%c%c",
|
|
|
|
charToInt( id[3] ) * 10 + charToInt( id[4] ),
|
|
|
|
id[5], id[6] );
|
|
|
|
}
|
2007-08-06 21:34:38 +00:00
|
|
|
else if( !memcmp( id, "DNA", 3 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "BitTorrent DNA %d.%d.%d", charToInt( id[3] ) * 10 + charToInt( id[4] ),
|
|
|
|
charToInt( id[5] ) * 10 + charToInt( id[6] ), charToInt( id[7] ) * 10 + charToInt( id[8] ) );
|
|
|
|
}
|
2006-12-22 23:34:35 +00:00
|
|
|
else if( !memcmp( id, "Plus", 4 ) )
|
|
|
|
{
|
2006-12-22 23:35:23 +00:00
|
|
|
asprintf( &ret, "Plus! v2 %c.%c%c", id[4], id[5], id[6] );
|
2006-12-22 23:34:35 +00:00
|
|
|
}
|
2006-12-15 05:39:06 +00:00
|
|
|
else if( !memcmp( id, "XBT", 3 ) )
|
|
|
|
{
|
2006-12-15 06:16:20 +00:00
|
|
|
asprintf( &ret, "XBT Client %c%c%c%s", id[3], id[4], id[5],
|
2007-05-09 02:55:10 +00:00
|
|
|
id[6] == 'd' ? " (debug)" : "" );
|
2006-12-15 05:39:06 +00:00
|
|
|
}
|
2006-12-29 02:09:16 +00:00
|
|
|
else if( !memcmp( id, "Mbrst", 5 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "burst! %c.%c.%c", id[5], id[7], id[9] );
|
|
|
|
}
|
2007-01-02 03:33:55 +00:00
|
|
|
else if( !memcmp( id, "btpd", 4 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "BT Protocol Daemon %c%c%c", id[5], id[6], id[7] );
|
|
|
|
}
|
2007-05-09 02:55:10 +00:00
|
|
|
else if( id[0] == 'Q' && !memcmp( &id[4], "--", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "BTQueue %d.%d.%d", charToInt( id[1] ),
|
|
|
|
charToInt( id[2] ), charToInt( id[3] ) );
|
|
|
|
}
|
2007-05-21 15:25:28 +00:00
|
|
|
else if( !memcmp( id, "BLZ", 3 ) )
|
2007-05-21 15:02:11 +00:00
|
|
|
{
|
2007-05-21 15:25:28 +00:00
|
|
|
asprintf( &ret, "Blizzard Downloader %d.%d", id[3] + 1, id[4] );
|
2007-05-21 15:02:11 +00:00
|
|
|
}
|
2006-12-17 22:11:02 +00:00
|
|
|
else if( !memcmp( id, "LIME", 4 ) )
|
|
|
|
{
|
2007-01-02 14:01:05 +00:00
|
|
|
asprintf( &ret, "Limewire" );
|
2006-12-17 22:11:02 +00:00
|
|
|
}
|
2006-12-19 02:57:36 +00:00
|
|
|
else if( !memcmp( id, "-G3", 3 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "G3 Torrent" );
|
|
|
|
}
|
2006-12-19 16:30:34 +00:00
|
|
|
else if( !memcmp( id, "10-------", 9 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "JVtorrent" );
|
|
|
|
}
|
2006-12-30 18:00:45 +00:00
|
|
|
else if( !memcmp( id, "346-", 4 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "TorrentTopia" );
|
|
|
|
}
|
2007-01-01 20:03:52 +00:00
|
|
|
else if( !memcmp( id, "eX", 2 ) )
|
|
|
|
{
|
|
|
|
asprintf( &ret, "eXeem" );
|
|
|
|
}
|
2007-07-15 05:02:30 +00:00
|
|
|
else if( '\0' == id[0] && 'B' == id[2] && 'S' == id[3] )
|
|
|
|
{
|
2007-07-15 05:13:35 +00:00
|
|
|
asprintf( &ret, "BitSpirit v%u", ( 0 == id[1] ? 1 : id[1] ) );
|
2007-07-15 05:02:30 +00:00
|
|
|
}
|
2006-07-16 19:39:23 +00:00
|
|
|
|
2006-12-19 03:22:46 +00:00
|
|
|
/* No match */
|
2006-07-16 19:39:23 +00:00
|
|
|
if( !ret )
|
|
|
|
{
|
2007-04-03 18:22:58 +00:00
|
|
|
if( isprint( id[0] ) && isprint( id[1] ) && isprint( id[2] ) &&
|
|
|
|
isprint( id[3] ) && isprint( id[4] ) && isprint( id[5] ) &&
|
|
|
|
isprint( id[6] ) && isprint( id[7] ) )
|
2006-08-14 22:59:30 +00:00
|
|
|
{
|
2006-08-14 22:27:34 +00:00
|
|
|
asprintf( &ret, "unknown client (%c%c%c%c%c%c%c%c)",
|
2006-07-16 19:39:23 +00:00
|
|
|
id[0], id[1], id[2], id[3], id[4], id[5], id[6], id[7] );
|
2006-08-14 22:59:30 +00:00
|
|
|
}
|
2006-08-14 22:27:34 +00:00
|
|
|
else
|
2006-08-14 22:59:30 +00:00
|
|
|
{
|
2007-04-06 01:52:16 +00:00
|
|
|
asprintf( &ret, "unknown client (0x%02x%02x%02x%02x%02x%02x%02x%02x)",
|
2007-04-03 18:22:58 +00:00
|
|
|
id[0], id[1], id[2], id[3], id[4], id[5], id[6], id[7] );
|
2006-08-14 22:59:30 +00:00
|
|
|
}
|
2006-07-16 19:39:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|