-
Notifications
You must be signed in to change notification settings - Fork 0
/
cases_test.go
373 lines (323 loc) · 6.71 KB
/
cases_test.go
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
package match
var trueEmails = []string{
"adam@email.com",
"joha@gmail.com",
"koko_helo@hotmail.com",
"ahmed@bashery.net",
}
var falseEmails = []string{
"adam#gmail.com",
"joya_emmail.net",
"jawad@hotmail@org",
"55:59:59",
"01:66:59",
"23:23:oo",
}
var trueTime = []string{
"23:59:59",
"00:00:00",
"12:12:12",
"00:56:56",
"12:13:12",
"12:12:01",
"09:45",
"9:45",
"23:45",
"9:00am",
// "9am",
"9:00 A.M.",
"9:00 pm",
}
var falseTime = []string{
"55:59:59",
"01:66:59",
"23:23:oo",
"01:66:59",
"01:66:59",
"33:66:59",
"19:45 pm",
"19:45 am",
"9:60",
"pm23:45",
"9:00:am",
"9am",
"19:00 A.M.",
"9:00:pm",
}
///////////////////////
var trueLinks = []string{
"www.google.com",
"http://www.google.com",
"www.google.com/?query=dog",
"sub.example.com",
"http://www.google.com/%&#/?q=dog",
"google.com",
}
var falseLinks = []string{
"www#google.com",
"http://www.google@com",
"google#com/?query=dog",
"##.e.x.ample.com",
"hp://ww.co.com/%&#/?q=dog",
"google.000",
}
// Dates
var trueDates = []string{
"3-23-17",
"3.23.17",
"03.23.17",
"March 23th, 2017",
"Mar 23th 2017",
"Mar. 23th, 2017",
"23 Mar 2017",
}
var tPhons = []string{
"12345678900",
"1234567890",
"+1 234 567 8900",
"234-567-8900",
"1-234-567-8900",
"1.234.567.8900",
"5678900",
"567-8900",
"(003) 555-1212",
"+41 22 730 5989",
"+442345678900",
}
var tPhonesWithExts = []string{
"(523)222-8888 ext 527",
"(523)222-8888x623",
"(523)222-8888 x623",
"(523)222-8888 x 623",
"(523)222-8888EXT623",
"523-222-8888EXT623",
"(523) 222-8888 x 623",
}
var tEmails = []string{
"john.smith@gmail.com",
"john_smith@gmail.com",
"john@example.net",
"John@example.net",
}
var IPv4s = []string{
"127.0.0.1",
"192.168.1.1",
"8.8.8.8",
"192.30.253.113",
"216.58.194.46",
}
var IPv6s = []string{
"fe80:0000:0000:0000:0204:61ff:fe9d:f156",
"fe80:0:0:0:204:61ff:fe9d:f156",
"fe80::204:61ff:fe9d:f156",
"fe80:0000:0000:0000:0204:61ff:254.157.241.86",
"fe80:0:0:0:0204:61ff:254.157.241.86",
"::1",
}
var IPs = []string{
"127.0.0.1",
"192.168.1.1",
"8.8.8.8",
"192.30.253.113",
"216.58.194.46",
"fe80:0000:0000:0000:0204:61ff:fe9d:f156",
"fe80:0:0:0:204:61ff:fe9d:f156",
"fe80::204:61ff:fe9d:f156",
"fe80:0000:0000:0000:0204:61ff:254.157.241.86",
"fe80:0:0:0:0204:61ff:254.157.241.86",
"::1",
}
var trueNotKnownPorts = []string{
"1024",
"2121",
"8080",
"12345",
"55555",
"65535",
}
var faseNotKnownPorts = []string{
"21",
"80",
"1023",
"65536",
}
var tPrices = []string{
"$1.23",
"$1",
"$1,000",
"$10,000.00",
}
var failingPrices = []string{
"$1,10,0",
"$100.000",
}
var trueHexColors = []string{
"#fff",
"#123",
"#4e32ff",
}
var failingHexColors = []string{
"#zzz",
}
var trueCreditCards = []string{
"0000-0000-0000-0000",
"0123456789012345",
"0000 0000 0000 0000",
"012345678901234",
}
var trueBtcAddresses = []string{
"1LgqButDNV2rVHe9DATt6WqD8tKZEKvaK2",
"19P6EYhu6kZzRy9Au4wRRZVE8RemrxPbZP",
"1bones8KbQge9euDn523z5wVhwkTP3uc1",
"1Bow5EMqtDGV5n5xZVgdpRPJiiDK6XSjiC",
}
var falseBtcAddresses = []string{
"2LgqButDNV2rVHe9DATt6WqD8tKZEKvaK2",
"19Ry9Au4wRRZVE8RemrxPbZP",
"1bones8KbQge9euDn523z5wVhwkTP3uc12939",
"1Bow5EMqtDGV5n5xZVgdpR",
}
var trueStreetAddresses = []string{
"101 main st.",
"504 parkwood drive",
"3 elm boulevard",
"500 elm street ",
}
var falseStreetAddresses = []string{
"101 main straight",
}
var trueZipCodes = []string{
"02540",
"02540-4119",
}
var falseZipCodes = []string{
"101 main straight",
"123456",
}
var truePoBoxes = []string{
"PO Box 123456",
"p.o. box 234234",
}
var falsePoBoxes = []string{
"101 main straight",
}
var trueSSNs = []string{
"000-00-0000",
"111-11-1111",
"222-22-2222",
"123-45-6789",
}
var trueMD5Hexes = []string{
"b5ab01fad5a008d436f76aafc896f9c6",
"00000000000000000000000000000000",
"fffFFFfFFfFFFfFFFFfFfFfffffFfFFF",
}
var falseMD5Hexes = []string{
"b5ab01fad5a008d436f76aafc896f9c600000000",
"",
"7TS5x1trQs652k4AZ3hJE83YCvJRy0U8",
"b5ab01fad5a008-436f76aafc896f9c6",
}
var tureSHA1Hexes = []string{
"b5ab01fad5a008d436f76aafc896f9c6abcd1234",
"0000000000000000000000000000000000000000",
"fffFFFfFFfFFFfFFFFfFfFfffffFfFFFffffFFFF",
}
var falseSHA1Hexes = []string{
"b5ab01fad5a008d436f76aafc896f9c600000000202020202020202020202020",
"7TS5x1trQs652k4AZ3hJE83YCvJRy0U85x1trQs652k4AZ3hJE83YCvJRy0U8asd",
"b5ab01fad5a008-436f76aafc896f9c6-436f76aafc896f9c6-436f76aafc896",
"",
}
var trueSHA256Hexes = []string{
"3f4146a1d0b5dac26562ff7dc6248573f4e996cf764a0f517318ff398dcfa792",
"0000000000000000000000000000000000000000000000000000000000000000",
"fffFFFfFFfFFFfFFFFfFfFfffffFfFFFffffFFFFfffffFFFFFffFFffFFffFFff",
}
var falseSHA256Hexes = []string{
"3f4146a1d0b5dac26562ff7dc6248573f4e996cf764a0f517318ff398dcfa7920",
"",
"e9iLS075z9HAJlUWg2ZpK5hRxjLeSpIqMKJO67c739VYf7Bj7eR1WjOO82IHcXVd",
"b5ab01fad5a008-436f76aafc896f9c6-436f76aafc896f9c6-436f76aafc896",
}
var trueGUIDs = []string{
"00000000-0000-0000-0000-000000000000",
"00000000000000000000000000000000",
"88a310ed-0ac0-4a3d-b3a2-958fa291d061",
"27143ecab8a440cda6fb6effcf9b3c75",
}
var falseGUIDs = []string{
"88a310ed-0ac0_4a3d_b3a2_958fa291d061",
"88a310ed 0ac0 4a3d b3a2 958fa291d061",
"",
"Z8a310ed-0ac0-4a3d-b3a2-958fa291d061",
"88a310ed-zac0-4a3d-b3a2-958fa291d061",
"98a310ed-0ac0-za3d-b3a2-958fa291d061",
"88a310ed-0ac0-4a3d-z3a2-958fa291d061",
"88a310ed-0ac0-4a3d-b3a2-z58fa291d061",
}
var trueISBN13s = []string{
"978-3-16-148410-0",
"978-1-56619-909-4",
"133-1-12144-909-9",
}
var falseISBN13s = []string{
"1-56619-909-3",
"1-33342-100-1",
"2-33342-362-9",
}
var trueISBN10s = []string{
"1-56619-909-3",
"1-33342-100-1",
"2-33342-362-9",
}
var falseISBN10s = []string{
"978-3-16-148410-0",
"978-1-56619-909-4",
"133-1-12144-909-9",
}
var trueVISACreditCards = []string{
"4111 1111 1111 1111",
"4222 2222 2222 2222",
}
var falseVISACreditCards = []string{
"5500 0000 0000 0004",
"3400 0000 0000 009",
"3000 0000 0000 04",
}
var tureMCCreditCards = []string{
"5500 0000 0000 0004",
"5500 3334 0000 1234",
}
var falseMCCreditCards = []string{
"4111 1111 1111 1111",
"4222 2222 2222 2222",
"3400 0000 0000 009",
"3000 0000 0000 04",
}
var trueMACAddresses = []string{
"f8:2f:a4:fe:76:d2",
"F8:2F:A4:FE:76:D2",
"3D-F2-C9-A6-B3-4F",
}
var falseMACAddresses = []string{
"3D:F2:C9:A6:B3:4G",
"f0:2f:P4:Be:96:J5",
}
var trueIBANs = []string{
"FR1420041010050500013M02606",
"MU17BOMM0101101030300200000MUR",
"NO9386011117947",
}
var falseIBANs = []string{
"424220041010050500013M02606",
"GB29RBOS601613",
}
var trueGitRepos = []string{
"https://github.com/mingrammer/commonregex.git",
"git@github.com:mingrammer/commonregex.git",
}
var falseGitRepos = []string{
"https://github.com/mingrammer/commonregex",
"test@github.com:mingrammer/commonregex.git",
}