-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.dsml
121 lines (108 loc) · 2.74 KB
/
test.dsml
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Hello, this is a comment.
##
#
start variables
shiva "Questionable"
jerry = "cool"
xkcd "@#%!@"
my_mutable_variable = "Change me"
my_logfile = "logfile.txt"
# Numbers now
x = 1
dx 5
blagga -14
favorite_protocol = "UDP"
start filters
of_filter("127.0.0.1", None, "53", None)
of_filter(None, "10.0.0.1", None, None)
start state initialState
# No arguments yet
define state initialState
matching
match_string("UDP", "dport", "53")
or match_string(favorite_protocol, "dport", dx)
or match_string("UDP", "sport", "12")
compare
5 < 6
"Hello" == "Hello"
do
set(favorite_protocol, "TCP")
set_to_field_value(my_mutable_variable, "UDP", "dport")
print(my_mutable_variable)
print(favorite_protocol)
print(blagga)
log("logfile.txt", blagga)
inc(blagga)
print(blagga)
dec(x)
print("Got one!")
print("Starting rules within initialState")
print_of_rules()
remove_of_rule(None, "10.0.0.1", None, None)
add_of_rule(None, None, "11122", None)
print_time()
log_time("logfile.txt")
goto
stateWithOnlyTimeout
matching
match_regex("UDP", "payload", "structure")
compare
-42 < 0
do
print(shiva)
set(shiva, "acceptable, yes?")
print(shiva)
goto
stateWithOnlyTimeout
define state stateWithOnlyTimeout
timeout
60
do
print("Current rules within stateWithOnlyTimeout:")
print_of_rules()
goto
stateWithTwoArguments "Hello, I am a carrot!" 42
define state lotsOfPrinting theAnswer
matching
match_string("UDP", "dport", "53")
or match_regex("UDP", "payload", ".*structure.*")
do
set_to_regex_match(my_mutable_variable, "UDP", "payload", ".*", 0)
print(my_mutable_variable)
print(blagga)
set(blagga, theAnswer)
print(blagga)
print(x)
dec(x)
dec(x)
print(x)
print_stacktrace()
log_stacktrace("logfile.txt")
print_packet()
log_packet(my_logfile)
goto
exit
define state stateWithTwoArguments arg1 arg2
timeout
10
do
print(arg1)
print(shiva)
goto
lotsOfPrinting arg2
define state stateWithOneArgument arg1
matching
match_atleast("IP", "len", 12)
match_atmost("IP", "len", 45)
and match_string("UDP", "dport", "53")
or match_string("UDP", "dport", arg1)
match_exactly("IP", "len", 33)
do
print("I am a print statement! GWAARRR!")
print_stacktrace()
goto
exit
timeout
120
goto
stateWithOnlyTimeout