-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpython_regex_exploit.py
67 lines (58 loc) · 1.67 KB
/
python_regex_exploit.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
import re
good = """2009-12T12:34
2009
2009-05-19
2009-05-19
20090519
2009123
2009-05
2009-123
2009-222
2009-001
2009-W01-1
2009-W51-1
2009-W511
2009-W33
2009W511
2009-05-19
2009-05-19 00:00
2009-05-19 14
2009-05-19 14:31
2009-05-19 14:39:22
2009-05-19T14:39Z
2009-W21-2
2009-W21-2T01:22
2009-139
2009-05-19 14:39:22-06:00
2009-05-19 14:39:22+0600
2009-05-19 14:39:22-01
20090621T0545Z
2007-04-06T00:00
2007-04-05T24:00
2010-02-18T16:23:48.5
2010-02-18T16:23:48,444
2010-02-18T16:23:48,3-06:00
2010-02-18T16:23.4
2010-02-18T16:23,25
2010-02-18T16:23.33+0600
2010-02-18T16.23334444
2010-02-18T16,2283
2009-05-19 143922.500
2009-05-19 1439,55"""
reg = r"^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$"
h = "0123456789abcdef"
at = "qwertyuiopasdfghjkl;'[]{}:\"<>?,./!@#$%^&*()_+1234567890-= "
def start():
for g in good.splitlines():
for t in at:
for t2 in sum([[t], [t * i for i in range(13 + 1)]], []):
for i in range(len(g.strip()) + 1):
for i3 in [chr(i) for i in range(55296)]:
l = [i for i in g.strip()]
l.insert(i, t2 + i3)
# print(l)
if re.compile(reg).match("".join(l)):
if "\\x" in str(i3.encode())[2:-1] and str(i3.encode())[2:-1].__len__() < 12:
print(str(i3.encode())[2:-1])
print("".join(l))
start()