| Home | Trees | Indices | Help |
|
|---|
|
|
1 # This program is free software: you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation, either version 3 of the License, or
4 # (at your option) any later version.
5 #
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
10 #
11 # You should have received a copy of the GNU General Public License
12 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13
14 import re
15
16 matches = (
17 ('-AZ(?P<version>\d+)-+.+$' , "Azureus" ),
18 ('M(?P<version>\d-\d-\d)--.+$' , "BitTorrent" ),
19 ('T(?P<version>\d+)-+.+$' , "BitTornado" ),
20 ('-TS(?P<version>\d+)-+.+$' , "TorrentStorm" ),
21 ('S(?P<version>\d+[\dAB])-+.+$' , "Shadow's" ),
22 ('A(?P<version>\d+)-+.+$' , "ABC" ),
23 ('-G3.+$' , "G3Torrent" ),
24 ('exbc.+$' , "BitComet" ),
25 ('-LT(?P<version>\d+)-+.+$' , "libtorrent" ),
26 ('Mbrst(?P<version>\d-\d-\d).+$', "burst!" ),
27 ('-BB(?P<version>\d+)-+.+$' , "BitBuddy" ),
28 ('-CT(?P<version>\d+)-+.+$' , "CTorrent" ),
29 ('-MT(?P<version>\d+)-+.+$' , "MoonlightTorrent" ),
30 ('-BX(?P<version>\d+)-+.+$' , "BitTorrent X" ),
31 ('-TN(?P<version>\d+)-+.+$' , "TorrentDotNET" ),
32 ('-SS(?P<version>\d+)-+.+$' , "SwarmScope" ),
33 ('-XT(?P<version>\d+)-+.+$' , "XanTorrent" ),
34 ('U(?P<version>\d+)-+.+$' , "UPnP NAT Bit Torrent"),
35 )
36
37 matches = [(re.compile(pattern, re.DOTALL), name) for pattern, name in matches]
38
40 client = 'unknown'
41 version = ''
42 for pat, name in matches:
43 m = pat.match(peerid)
44 if m:
45 client = name
46 d = m.groupdict()
47 if d.has_key('version'):
48 version = d['version']
49 version = version.replace('-','.')
50 if version.find('.') == -1:
51 version = '.'.join(version)
52 break
53 return client, version
54
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Mon Feb 8 16:23:25 2010 | http://epydoc.sourceforge.net |