1
|
# FTP - File Transfer Protocol - RFC 959
|
2
|
# Pattern attributes: great notsofast fast
|
3
|
# Protocol groups: document_retrieval ietf_internet_standard
|
4
|
# Wiki: http://protocolinfo.org/wiki/FTP
|
5
|
# Copyright (C) 2008 Matthew Strait, Ethan Sommer; See ../LICENSE
|
6
|
#
|
7
|
# Usually runs on port 21. Note that the data stream is on a dynamically
|
8
|
# assigned port, which means that you will need the FTP connection
|
9
|
# tracking module in your kernel to usefully match FTP data transfers.
|
10
|
#
|
11
|
# This pattern is well tested.
|
12
|
#
|
13
|
# Handles the first two things a server should say:
|
14
|
#
|
15
|
# First, the server says it's ready by sending "220". Most servers say
|
16
|
# something after 220, even though they don't have to, and it usually
|
17
|
# includes the string "ftp" (l7-filter is case insensitive). This
|
18
|
# includes proftpd, vsftpd, wuftpd, warftpd, pureftpd, Bulletproof FTP
|
19
|
# Server, and whatever ftp.microsoft.com uses. Almost all servers use only
|
20
|
# ASCII printable characters between the "220" and the "FTP", but non-English
|
21
|
# ones might use others.
|
22
|
#
|
23
|
# The next thing the server sends is a 331. All the above servers also
|
24
|
# send something including "password" after this code. By default, we
|
25
|
# do not match on this because it takes another packet and is more work
|
26
|
# for regexec.
|
27
|
|
28
|
ftp
|
29
|
# by default, we allow only ASCII
|
30
|
^220[\x09-\x0d -~]*ftp
|
31
|
|
32
|
# This covers UTF-8 as well
|
33
|
#^220[\x09-\x0d -~\x80-\xfd]*ftp
|
34
|
|
35
|
# This allows any characters and is about 4x faster than either of the above
|
36
|
# (which are about the same as each other)
|
37
|
#^220.*ftp
|
38
|
|
39
|
# This is much slower
|
40
|
#^220[\x09-\x0d -~]*ftp|331[\x09-\x0d -~]*password
|
41
|
|
42
|
# This pattern is more precise, but takes longer to match. (3 packets vs. 1)
|
43
|
#^220[\x09-\x0d -~]*\x0d\x0aUSER[\x09-\x0d -~]*\x0d\x0a331
|
44
|
|
45
|
# same as above, but slightly less precise and only takes 2 packets.
|
46
|
#^220[\x09-\x0d -~]*\x0d\x0aUSER[\x09-\x0d -~]*\x0d\x0a
|