-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.py
254 lines (245 loc) · 6.42 KB
/
constants.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
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
import operator
# Sample packet to instrument mappings suitable for a home network
sampleMaps = {}
# Protocol only
sampleMaps["protocol"] = {
"arp": ["tinkle bell", 60, 80],
"dns": ["bird tweet", 60, 50],
"icmp": ["open hi-hat", 60, 30],
"icmpv6": ["hi wood block", 60, 30],
"igmp": ["vibraphone", 60, 50],
"mdns": ["open triangle", 60, 50],
"smb": ["steel drums", 60, 50],
"ssdp": ["acoustic bass", 60, 50],
"tls": ["ocarina", 60, 10],
}
# IP address mapping, based on source/dest in RFC1918 space
sampleMaps["ip"] = {
"ip.src == 10.0.0.0/8": ["tubular bells", 60, 50],
"ip.src == 172.16.0.0/12": ["tubular bells", 60, 50],
"ip.src == 192.168.0.0/16": ["tubular bells", 60, 50],
"ip.dst == 10.0.0.0/8": ["electric bass (finger)", 60, 50],
"ip.dst == 172.16.0.0/12": ["electric bass (finger)", 60, 50],
"ip.dst == 192.168.0.0/16": ["electric bass (finger)", 60, 50],
"ipv6.src == fe80::/10": ["voice oohs", 48, 60],
"ipv6.dst == fe80::/10": ["voice oohs", 48, 60],
}
# TCP conversations
sampleMaps["tcp"] = {
"tcp.flags.syn == 1": ["telephone ring", 60, 50],
"tcp.flags.fin == 1": ["taiko drum", 48, 40],
"tcp.flags.reset == 1": ["crash cymbal 1", 60, 50],
"tcp.analysis.duplicate_ack == 1": ["tubular bells", 72, 40],
"tcp.analysis.lost_segment == 1": ["tubular bells", 72, 40],
"tcp.analysis.out_of_order == 1": ["tubular bells", 72, 40],
"tcp.analysis.retransmission == 1": ["tubular bells", 72, 40],
"tcp.analysis.spurious_retransmission == 1": ["tubular bells", 72, 40],
}
# testing code
sampleMaps["test"] = {
"ip.src == 10.0.0.0/8": ["flute", 60, 80],
"ip.dst == 10.0.0.0/8": ["xylophone", 60, 80],
"ipv6.src == fe80::/10": ["harmonica", 90, 80],
"ipv6.dst == fe80::/10": ["harmonica", 90, 80],
"icmp": ["gunshot", 60, 100],
"tcp.len >= 100": ["open hi-hat", 90, 127],
}
# Map user provided operator to Python function
ops = {
"==": operator.eq,
"!=": operator.ne,
"<": operator.lt,
"<=": operator.le,
">": operator.gt,
">=": operator.ge,
}
# TShark fields which contain IP addresses
ipFields = [
"ip.addr",
"ip.src",
"ip.dst",
"ipv6.addr",
"ipv6.src",
"ipv6.dst",
]
# Instrument and Percussion map from
# https://www.midi.org/specifications/item/gm-level-1-sound-set
melodic = {
"acoustic grand piano": 1,
"bright acoustic piano": 2,
"electric grand piano": 3,
"honky-tonk piano": 4,
"electric piano 1": 5,
"electric piano 2": 6,
"harpsichord": 7,
"clavi": 8,
"celesta": 9,
"glockenspiel": 10,
"music box": 11,
"vibraphone": 12,
"marimba": 13,
"xylophone": 14,
"tubular bells": 15,
"dulcimer": 16,
"drawbar organ": 17,
"percussive organ": 18,
"rock organ": 19,
"church organ": 20,
"reed organ": 21,
"accordion": 22,
"harmonica": 23,
"tango accordion": 24,
"acoustic guitar (nylon)": 25,
"acoustic guitar (steel)": 26,
"electric guitar (jazz)": 27,
"electric guitar (clean)": 28,
"electric guitar (muted)": 29,
"overdriven guitar": 30,
"distortion guitar": 31,
"guitar harmonics": 32,
"acoustic bass": 33,
"electric bass (finger)": 34,
"electric bass (pick)": 35,
"fretless bass": 36,
"slap bass 1": 37,
"slap bass 2": 38,
"synth bass 1": 39,
"synth bass 2": 40,
"violin": 41,
"viola": 42,
"cello": 43,
"contrabass": 44,
"tremolo strings": 45,
"pizzicato strings": 46,
"orchestral harp": 47,
"timpani": 48,
"string ensemble 1": 49,
"string ensemble 2": 50,
"synthstrings 1": 51,
"synthstrings 2": 52,
"choir aahs": 53,
"voice oohs": 54,
"synth voice": 55,
"orchestra hit": 56,
"trumpet": 57,
"trombone": 58,
"tuba": 59,
"muted trumpet": 60,
"french horn": 61,
"brass section": 62,
"synthbrass 1": 63,
"synthbrass 2": 64,
"soprano sax": 65,
"alto sax": 66,
"tenor sax": 67,
"baritone sax": 68,
"oboe": 69,
"english horn": 70,
"bassoon": 71,
"clarinet": 72,
"piccolo": 73,
"flute": 74,
"recorder": 75,
"pan flute": 76,
"blown bottle": 77,
"shakuhachi": 78,
"whistle": 79,
"ocarina": 80,
"lead 1 (square)": 81,
"lead 2 (sawtooth)": 82,
"lead 3 (calliope)": 83,
"lead 4 (chiff)": 84,
"lead 5 (charang)": 85,
"lead 6 (voice)": 86,
"lead 7 (fifths)": 87,
"lead 8 (bass + lead)": 88,
"pad 1 (new age)": 89,
"pad 2 (warm)": 90,
"pad 3 (polysynth)": 91,
"pad 4 (choir)": 92,
"pad 5 (bowed)": 93,
"pad 6 (metallic)": 94,
"pad 7 (halo)": 95,
"pad 8 (sweep)": 96,
"fx 1 (rain)": 97,
"fx 2 (soundtrack)": 98,
"fx 3 (crystal)": 99,
"fx 4 (atmosphere)": 100,
"fx 5 (brightness)": 101,
"fx 6 (goblins)": 102,
"fx 7 (echoes)": 103,
"fx 8 (sci-fi)": 104,
"sitar": 105,
"banjo": 106,
"shamisen": 107,
"koto": 108,
"kalimba": 109,
"bag pipe": 110,
"fiddle": 111,
"shanai": 112,
"tinkle bell": 113,
"agogo": 114,
"steel drums": 115,
"woodblock": 116,
"taiko drum": 117,
"melodic tom": 118,
"synth drum": 119,
"reverse cymbal": 120,
"guitar fret noise": 121,
"breath noise": 122,
"seashore": 123,
"bird tweet": 124,
"telephone ring": 125,
"helicopter": 126,
"applause": 127,
"gunshot": 128,
}
percussion = {
"acoustic bass drum": 35,
"bass drum 1": 36,
"side stick": 37,
"acoustic snare": 38,
"hand clap": 39,
"electric snare": 40,
"low floor tom": 41,
"closed hi hat": 42,
"high floor tom": 43,
"pedal hi-hat": 44,
"low tom": 45,
"open hi-hat": 46,
"low-mid tom": 47,
"hi-mid tom": 48,
"crash cymbal 1": 49,
"high tom": 50,
"ride cymbal 1": 51,
"chinese cymbal": 52,
"ride bell": 53,
"tambourine": 54,
"splash cymbal": 55,
"cowbell": 56,
"crash cymbal 2": 57,
"vibraslap": 58,
"ride cymbal 2": 59,
"hi bongo": 60,
"low bongo": 61,
"mute hi conga": 62,
"open hi conga": 63,
"low conga": 64,
"high timbale": 65,
"low timbale": 66,
"high agogo": 67,
"low agogo": 68,
"cabasa": 69,
"maracas": 70,
"short whistle": 71,
"long whistle": 72,
"short guiro": 73,
"long guiro": 74,
"claves": 75,
"hi wood block": 76,
"low wood block": 77,
"mute cuica": 78,
"open cuica": 79,
"mute triangle": 80,
"open triangle": 81,
}