Project

General

Profile

Download (2.18 KB) Statistics
| Branch: | Tag: | Revision:
1
# Gnutella - P2P filesharing
2
# Pattern attributes: good notsofast notsofast
3
# Protocol groups: p2p open_source
4
# Wiki: http://www.protocolinfo.org/wiki/Gnutella
5
# Copyright (C) 2008 Matthew Strait, Ethan Sommer; See ../LICENSE
6
#
7
# This should match both Gnutella and "Gnutella2" ("Mike's protocol")
8
# 
9
# Various clients use this protocol including Mactella, Shareaza,
10
# GTK-gnutella, Gnucleus, Gnotella, LimeWire, iMesh and BearShare.
11
# 
12
# This is tested with gtk-gnutella and Shareaza.
13

    
14
# http://www.gnutella2.com/tiki-index.php?page=UDP%20Transceiver
15
# http://rfc-gnutella.sf.net/
16
# http://www.gnutella2.com/tiki-index.php?page=Gnutella2%20Specification
17
# http://en.wikipedia.org/wiki/Shareaza
18

    
19
gnutella
20

    
21
# The first part matches UDP messages - All start with "GND", then have
22
# a flag byte which is either \x00, \x01 or \x02, then two sequence bytes
23
# that can be anything, then a fragment number, which must start at 1.
24
# The rest matches TCP first client message or first server message (in case 
25
# we can't see client messages).  Some parts of this are empirical rather than 
26
# document based.  Assumes version is between 0.0 and 2.9. (usually is
27
# 0.4 or 0.6).  I'm guessing at many of the user-agents.
28
# The last bit is emprical and probably only matches Limewire.
29
^(gnd[\x01\x02]?.?.?\x01|gnutella connect/[012]\.[0-9]\x0d\x0a|get /uri-res/n2r\?urn:sha1:|get /.*user-agent: (gtk-gnutella|bearshare|mactella|gnucleus|gnotella|limewire|imesh)|get /.*content-type: application/x-gnutella-packets|giv [0-9]*:[0-9a-f]*/|queue [0-9a-f]* [1-9][0-9]?[0-9]?\.[1-9][0-9]?[0-9]?\.[1-9][0-9]?[0-9]?\.[1-9][0-9]?[0-9]?:[1-9][0-9]?[0-9]?[0-9]?|gnutella.*content-type: application/x-gnutella|...................?lime)
30

    
31
# Needlessly precise, at the expense of time
32
#^(gnd[\x01\x02]?.?.?\x01|gnutella connect/[012]\.[0-9]\x0d\x0a|get /uri-res/n2r\?urn:sha1:|get /[\x09-\x0d -~]*user-agent: (gtk-gnutella|bearshare|mactella|gnucleus|gnotella|limewire|imesh)|get /[\x09-\x0d -~]*content-type: application/x-gnutella-packets|giv [0-9]*:[0-9a-f]*/|queue [0-9a-f]* [1-9][0-9]?[0-9]?\.[1-9][0-9]?[0-9]?\.[1-9][0-9]?[0-9]?\.[1-9][0-9]?[0-9]?:[1-9][0-9]?[0-9]?[0-9]?|gnutella[\x09-\x0d -~]*content-type: application/x-gnutella|..................lime)
33

    
34

    
(40-40/149)