-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathdatabase.py
3015 lines (2975 loc) · 268 KB
/
database.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
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
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
from neo4j import GraphDatabase
import util
import log
import sys
class Driver:
def __init__(self, user, password, db, u_search="", g_search="", c_search="", regex=""):
try:
self.driver = GraphDatabase.driver("neo4j://localhost:7687", auth=(user, password))
self.database = db
self.user_search = u_search
self.group_search = g_search
self.computer_search = c_search
self.regex = regex
self.queries = {
'1': {
'query': 'MATCH (n:User {hasspn: true}) RETURN n.name AS result ORDER BY n.name',
'desc': 'List all kerberoastable users',
'message_generator': lambda r: (r.get('result') is not None) and f'{log.default}User {log.reset}{log.red}{r["result"]}{log.reset}{log.default} is kerberoastable{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'2': {
'query': 'MATCH (n:User {owned: true, hasspn: true}) RETURN n.name AS result ORDER BY n.name',
'desc': 'List all kerberoastable users for owned principals',
'message_generator': lambda r: (r.get('result') is not None) and f'{log.default}User {log.reset}{log.red}{r["result"]}{log.reset}{log.default} is kerberoastable{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'3': {
'query': 'MATCH p=(u:User)-[:CanRDP]->(c:Computer) RETURN u.name,c.name ORDER BY u.name',
'desc': 'List all user RDP privileges',
'message_generator': lambda r: (r.get('u.name') is not None and r.get('c.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["u.name"]}{log.reset}{log.default} CanRDP to {log.reset}{log.red}{r["c.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'4': {
'query': 'MATCH p=(g:Group)-[:CanRDP]->(c:Computer) RETURN g.name,c.name ORDER BY g.name',
'desc': 'List all group RDP privileges',
'message_generator': lambda r: (r.get('g.name') is not None and r.get('c.name') is not None) and f'{log.default}Group {log.reset}{log.red}{r["g.name"]}{log.reset}{log.default} CanRDP to {log.reset}{log.red}{r["c.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'5': {
'query': 'MATCH p=(g:Group)-[:CanRDP]->(c:Computer) WHERE (g.objectid =~ "(?i)S-1-5-21-.*-513" OR g.objectid =~ "(?i).*-S-1-5-11" OR g.objectid =~ "(?i).*-S-1-1-0" OR g.objectid =~ "(?i).*-S-1-5-32-545") RETURN g.name,c.name ORDER BY g.name',
'desc': 'List all RDP privileges for Users, Domain Users, Authenticated Users, or Everyone groups',
'message_generator': lambda r: (r.get('g.name') is not None and r.get('c.name') is not None) and f'{log.default}Group {log.reset}{log.red}{r["g.name"]}{log.reset}{log.default} CanRDP to {log.reset}{log.red}{r["c.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'6': {
'query': 'MATCH p=(m:Group)-[:MemberOf]->(g:Group)-[:CanRDP]->(n:Computer) WHERE (m.objectid =~ "(?i)S-1-5-21-.*-513" OR m.objectid =~ "(?i).*-S-1-5-11" OR m.objectid =~ "(?i).*-S-1-1-0" OR m.objectid =~ "(?i).*-S-1-5-32-545") RETURN m.name,n.name,g.name ORDER BY m.name',
'desc': 'List all group-delegated RDP privileges for Users, Domain Users, Authenticated Users, or Everyone groups',
'message_generator': lambda r: (r.get('m.name') is not None and r.get('n.name') is not None and r.get('g.name') is not None) and f'{log.default}Group {log.reset}{log.red}{r["m.name"]}{log.reset}{log.default} is MemberOf {log.reset}{log.red}{r["g.name"]} {log.reset}{log.default}which CanRDP to {log.reset}{log.red}{r["n.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'7': {
'query': 'MATCH p=(m {owned: true})-[:CanRDP]->(c:Computer) RETURN m.name,c.name,labels(m) ORDER BY m.name',
'desc': 'List all RDP privileges for owned principals',
'message_generator': lambda r: (r.get('m.name') is not None and r.get('c.name') is not None) and f'{log.red}{r["m.name"]} {log.reset}{log.default}({r["labels(m)"][0]}/{r["labels(m)"][1]}){log.reset}{log.default} CanRDP to {log.reset}{log.red}{r["c.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'8': {
'query': 'MATCH (n {owned: true})-[:MemberOf]->(g:Group)-[:CanRDP]->(m:Computer) RETURN n.name,labels(n),m.name,g.name ORDER BY n.name',
'desc': 'List all group-delegated RDP privileges for owned principals',
'message_generator': lambda r: (r.get('m.name') is not None and r.get('n.name') is not None and r.get('g.name') is not None) and f'{log.red}{r["n.name"]} {log.reset}{log.default}({r["labels(n)"][0]}/{r["labels(n)"][1]}){log.reset}{log.default} is MemberOf {log.reset}{log.red}{r["g.name"]} {log.reset}{log.default}which CanRDP to {log.reset}{log.red}{r["m.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'9': {
'query': 'MATCH (c:Computer {unconstraineddelegation: true}) RETURN c.name ORDER BY c.name',
'desc': 'List all Unconstrained Delegation',
'message_generator': lambda r: (r.get('c.name') is not None) and f'{log.default}Computer {log.reset}{log.red}{r["c.name"]}{log.reset}{log.default} has unconstrained delegation privilege{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'10': {
'query': 'MATCH (H:Computer) WHERE H.operatingsystem =~ \'.*(2000|2003|2008|xp|vista|7|me).*\' RETURN H.name,H.operatingsystem ORDER BY H.name',
'desc': 'List all unsupported OSs',
'message_generator': lambda r: (r.get('H.name') is not None and r.get('H.operatingsystem') is not None) and f'{log.default}Computer {log.reset}{log.red}{r["H.name"]}{log.reset}{log.default} is unsupported with OS {log.reset}{log.red}{r["H.operatingsystem"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'11': {
'query': 'MATCH (g:Group) WHERE g.name =~ \'.*((?i)admin|adm).*\' RETURN g.name ORDER BY g.name',
'desc': 'List groups containing "admin"',
'message_generator': lambda r: (r.get('g.name') is not None) and f'{log.default}Admin group {log.reset}{log.red}{r["g.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'12': {
'query': 'MATCH (u:User) WHERE u.name =~ \'.*((?i)admin|adm).*\' RETURN u.name ORDER BY u.name',
'desc': 'List users containing "admin"',
'message_generator': lambda r: (r.get('u.name') is not None) and f'{log.default}Admin user {log.reset}{log.red}{r["u.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'13': {
'query': 'MATCH p=shortestPath((m:User)-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)admin|adm).*" AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all user shortest paths to admin groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'14': {
'query': 'MATCH p=shortestPath((m:Group)-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)admin|adm).*" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all group shortest paths to admin groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'15': {
'query': 'MATCH p=shortestPath((m:Computer)-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)admin|adm).*" AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all computer shortest paths to admin groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'16': {
'query': 'MATCH p=shortestPath((m:Group)-[r*1..]->(n:Group)) WHERE (m.objectid =~ "(?i)S-1-5-21-.*-513" OR m.objectid =~ "(?i).*-S-1-5-11" OR m.objectid =~ "(?i).*-S-1-1-0" OR m.objectid =~ "(?i).*-S-1-5-32-545") AND n.name =~ ".*((?i)admin|adm).*" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to admin groups for Users, Domain Users, Authenticated Users, or Everyone groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'17': {
'query': 'MATCH p=shortestPath((m {owned: true})-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)admin|adm).*" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to admin groups for owned principals',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'18': {
'query': 'MATCH (g:Group) WHERE g.name =~ \'.*((?i)sql).*\' RETURN g.name ORDER BY g.name',
'desc': 'List groups containing "sql"',
'message_generator': lambda r: (r.get('g.name') is not None) and f'{log.default}SQL group {log.reset}{log.red}{r["g.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'19': {
'query': 'MATCH (u:User) WHERE u.name =~ \'.*((?i)sql).*\' RETURN u.name ORDER BY u.name',
'desc': 'List users containing "sql"',
'message_generator': lambda r: (r.get('u.name') is not None) and f'{log.default}SQL user {log.reset}{log.red}{r["u.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'20': {
'query': 'MATCH (c:Computer) WHERE c.name =~ \'.*((?i)sql).*\' RETURN c.name ORDER BY c.name',
'desc': 'List computers containing "sql"',
'message_generator': lambda r: (r.get('c.name') is not None) and f'{log.default}SQL computer {log.reset}{log.red}{r["c.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'21': {
'query': 'MATCH p=shortestPath((m:User)-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)SQL).*" AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all user shortest paths to SQL groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'22': {
'query': 'MATCH p=shortestPath((m:Group)-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)SQL).*" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all group shortest paths to SQL groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'23': {
'query': 'MATCH p=shortestPath((m:Computer)-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)SQL).*" AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all computer shortest paths to SQL groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'24': {
'query': 'MATCH p=shortestPath((m:Group)-[r*1..]->(n:Group)) WHERE (m.objectid =~ "(?i)S-1-5-21-.*-513" OR m.objectid =~ "(?i).*-S-1-5-11" OR m.objectid =~ "(?i).*-S-1-1-0" OR m.objectid =~ "(?i).*-S-1-5-32-545") AND n.name =~ ".*((?i)SQL).*" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to SQL groups for Users, Domain Users, Authenticated Users, or Everyone groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'25': {
'query': 'MATCH p=shortestPath((m {owned: true})-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)SQL).*" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to SQL groups for owned principals',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'26': {
'query': 'MATCH (u:User) WHERE u.name =~ \'.*((?i)svc|service).*\' RETURN u.name ORDER BY u.name',
'desc': 'List users containing "svc/service"',
'message_generator': lambda r: (r.get('u.name') is not None) and f'{log.default}Service user {log.reset}{log.red}{r["u.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'27': {
'query': 'MATCH (g:Group) WHERE g.name =~ \'.*((?i)svc|service).*\' RETURN g.name ORDER BY g.name',
'desc': 'List groups containing "svc/service"',
'message_generator': lambda r: (r.get('g.name') is not None) and f'{log.default}Service group {log.reset}{log.red}{r["g.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'28': {
'query': 'MATCH p=shortestPath((m:User)-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)service|svc).*" AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all user shortest paths to service groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'29': {
'query': 'MATCH p=shortestPath((m:Group)-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)service|svc).*" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all group shortest paths to service groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'30': {
'query': 'MATCH p=shortestPath((m:Computer)-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)service|svc).*" AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all computer shortest paths to service groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'31': {
'query': 'MATCH p=shortestPath((m:Group)-[r*1..]->(n:Group)) WHERE (m.objectid =~ "(?i)S-1-5-21-.*-513" OR m.objectid =~ "(?i).*-S-1-5-11" OR m.objectid =~ "(?i).*-S-1-1-0" OR m.objectid =~ "(?i).*-S-1-5-32-545") AND n.name =~ ".*((?i)service|svc).*" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to service groups for Users, Domain Users, Authenticated Users, or Everyone groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'32': {
'query': 'MATCH p=shortestPath((m {owned: true})-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)service|svc).*" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to service groups for owned principals',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'33': {
'query': 'MATCH (u:User) WHERE u.name =~ \'.*((?i)web).*\' RETURN u.name ORDER BY u.name',
'desc': 'List users containing "web"',
'message_generator': lambda r: (r.get('u.name') is not None) and f'{log.default}Web user {log.reset}{log.red}{r["u.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'34': {
'query': 'MATCH (g:Group) WHERE g.name =~ \'.*((?i)web).*\' RETURN g.name ORDER BY g.name',
'desc': 'List groups containing "web"',
'message_generator': lambda r: (r.get('g.name') is not None) and f'{log.default}Web group {log.reset}{log.red}{r["g.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'35': {
'query': 'MATCH (c:Computer) WHERE c.name =~ \'.*((?i)web).*\' RETURN c.name ORDER BY c.name',
'desc': 'List computers containing "web"',
'message_generator': lambda r: (r.get('c.name') is not None) and f'{log.default}Web computer {log.reset}{log.red}{r["c.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'36': {
'query': 'MATCH p=shortestPath((m:User)-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)WEB).*" AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all user shortest paths to web groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'37': {
'query': 'MATCH p=shortestPath((m:Group)-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)WEB).*" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all group shortest paths to web groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'38': {
'query': 'MATCH p=shortestPath((m:Computer)-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)WEB).*" AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all computer shortest paths to web groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'39': {
'query': 'MATCH p=shortestPath((m:Group)-[r*1..]->(n:Group)) WHERE (m.objectid =~ "(?i)S-1-5-21-.*-513" OR m.objectid =~ "(?i).*-S-1-5-11" OR m.objectid =~ "(?i).*-S-1-1-0" OR m.objectid =~ "(?i).*-S-1-5-32-545") AND n.name =~ ".*((?i)WEB).*" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to web groups for Users, Domain Users, Authenticated Users, or Everyone groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'40': {
'query': 'MATCH p=shortestPath((m {owned: true})-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)WEB).*" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to web groups for owned principals',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'41': {
'query': 'MATCH (u:User) WHERE u.name =~ \'.*((?i)dev).*\' RETURN u.name ORDER BY u.name',
'desc': 'List users containing "dev"',
'message_generator': lambda r: (r.get('u.name') is not None) and f'{log.default}Dev user {log.reset}{log.red}{r["u.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'42': {
'query': 'MATCH (g:Group) WHERE g.name =~ \'.*((?i)dev).*\' RETURN g.name ORDER BY g.name',
'desc': 'List groups containing "dev"',
'message_generator': lambda r: (r.get('g.name') is not None) and f'{log.default}Dev group {log.reset}{log.red}{r["g.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'43': {
'query': 'MATCH (c:Computer) WHERE c.name =~ \'.*((?i)dev).*\' RETURN c.name ORDER BY c.name',
'desc': 'List computers containing "dev"',
'message_generator': lambda r: (r.get('c.name') is not None) and f'{log.default}Dev computer {log.reset}{log.red}{r["c.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'44': {
'query': 'MATCH (u:User) WHERE u.name =~ \'.*((?i)prod).*\' RETURN u.name ORDER BY u.name',
'desc': 'List users containing "prod"',
'message_generator': lambda r: (r.get('u.name') is not None) and f'{log.default}Prod user {log.reset}{log.red}{r["u.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'45': {
'query': 'MATCH (g:Group) WHERE g.name =~ \'.*((?i)prod).*\' RETURN g.name ORDER BY g.name',
'desc': 'List groups containing "prod"',
'message_generator': lambda r: (r.get('g.name') is not None) and f'{log.default}Prod group {log.reset}{log.red}{r["g.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'46': {
'query': 'MATCH (c:Computer) WHERE c.name =~ \'.*((?i)prod).*\' RETURN c.name ORDER BY c.name',
'desc': 'List computers containing "prod"',
'message_generator': lambda r: (r.get('c.name') is not None) and f'{log.default}Prod computer {log.reset}{log.red}{r["c.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'47': {
'query': 'MATCH (n:Group) WHERE n.objectid =~ "(?i)S-1-5-21-.*-512" WITH n MATCH p=(n)<-[r:MemberOf*1..]-(m) RETURN m.name ORDER BY m.name',
'desc': 'List all Domain Admins',
'message_generator': lambda r: (r.get('m.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["m.name"]}{log.reset}{log.default} is MemberOf Domain Admins{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'48': {
'query': 'MATCH p=shortestPath((m:User)-[r*1..]->(n:Group)) WHERE n.objectid =~ "(?i)S-1-5-21-.*-512" AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all user shortest paths to Domain Admins',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'49': {
'query': 'MATCH p=shortestPath((m:Group)-[r*1..]->(n:Group)) WHERE n.objectid =~ "(?i)S-1-5-21-.*-512" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all group shortest paths to Domain Admins',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'50': {
'query': 'MATCH p=shortestPath((m:Computer)-[r*1..]->(n:Group)) WHERE n.objectid =~ "(?i)S-1-5-21-.*-512" AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all computer shortest paths to Domain Admins',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'51': {
'query': 'MATCH p=shortestPath((m:Group)-[r*1..]->(n:Group)) WHERE (m.objectid =~ "(?i)S-1-5-21-.*-513" OR m.objectid =~ "(?i).*-S-1-5-11" OR m.objectid =~ "(?i).*-S-1-1-0" OR m.objectid =~ "(?i).*-S-1-5-32-545") AND n.objectid =~ "(?i)S-1-5-21-.*-512" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to Domain Admins for Users, Domain Users, Authenticated Users, or Everyone groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'52': {
'query': 'MATCH p=shortestPath((m {owned: true})-[r*1..]->(n:Group)) WHERE n.objectid =~ "(?i)S-1-5-21-.*-512" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to Domain Admins for owned principals',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'53': {
'query': 'MATCH (n:Group) WHERE n.objectid =~ "(?i)S-1-5-21-.*-519" WITH n MATCH p=(n)<-[r:MemberOf*1..]-(m) RETURN m.name ORDER BY m.name',
'desc': 'List all Enterprise Admins',
'message_generator': lambda r: (r.get('m.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["m.name"]}{log.reset}{log.default} is MemberOf Enterprise Admins{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'54': {
'query': 'MATCH p=shortestPath((m:User)-[r*1..]->(n:Group)) WHERE n.objectid =~ "(?i)S-1-5-21-.*-519" AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all user shortest paths to Enterprise Admins',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'55': {
'query': 'MATCH p=shortestPath((m:Group)-[r*1..]->(n:Group)) WHERE n.objectid =~ "(?i)S-1-5-21-.*-519" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all group shortest paths to Enterprise Admins',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'56': {
'query': 'MATCH p=shortestPath((m:Computer)-[r*1..]->(n:Group)) WHERE n.objectid =~ "(?i)S-1-5-21-.*-519" AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all computer shortest paths to Enterprise Admins',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'57': {
'query': 'MATCH p=shortestPath((m:Group)-[r*1..]->(n:Group)) WHERE (m.objectid =~ "(?i)S-1-5-21-.*-513" OR m.objectid =~ "(?i).*-S-1-5-11" OR m.objectid =~ "(?i).*-S-1-1-0" OR m.objectid =~ "(?i).*-S-1-5-32-545") AND n.objectid =~ "(?i)S-1-5-21-.*-519" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to Enterprise Admins for Users, Domain Users, Authenticated Users, or Everyone groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'58': {
'query': 'MATCH p=shortestPath((m {owned: true})-[r*1..]->(n:Group)) WHERE n.objectid =~ "(?i)S-1-5-21-.*-519" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to Enterprise Admins for owned principals',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'59': {
'query': 'MATCH p=(m:Computer)-[r:HasSession]->(n:User) RETURN n.name,m.name ORDER BY n.name',
'desc': 'List all sessions',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} HasSession on {log.reset}{log.red}{r["m.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'60': {
'query': 'MATCH p=(m:Computer)-[r:HasSession]->(n:User {owned: true}) RETURN n.name,m.name ORDER BY n.name',
'desc': 'List all sessions for owned principals',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} HasSession on {log.reset}{log.red}{r["m.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'61': {
'query': 'MATCH (u:User {dontreqpreauth: true}) RETURN u.name ORDER BY u.name',
'desc': 'List all AS-REP roastable users',
'message_generator': lambda r: (r.get('u.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["u.name"]}{log.reset}{log.default} is AS-REP roastable{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'62': {
'query': 'MATCH (u:User {dontreqpreauth: true, owned: true}) RETURN u.name ORDER BY u.name',
'desc': 'List all AS-REP roastable users for owned principals',
'message_generator': lambda r: (r.get('u.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["u.name"]}{log.reset}{log.default} is AS-REP roastable{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'63': {
'query': 'MATCH (m:User {highvalue: true}) RETURN m.name ORDER BY m.name',
'desc': 'List all high-value users',
'message_generator': lambda r: (r.get('m.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["m.name"]}{log.reset}{log.default} is high value{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'64': {
'query': 'MATCH (m:Group {highvalue: true}) RETURN m.name ORDER BY m.name',
'desc': 'List all high-value groups',
'message_generator': lambda r: (r.get('m.name') is not None) and f'{log.default}Group {log.reset}{log.red}{r["m.name"]}{log.reset}{log.default} is high value{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'65': {
'query': 'MATCH (m:Computer {highvalue: true}) RETURN m.name ORDER BY m.name',
'desc': 'List all high-value computers',
'message_generator': lambda r: (r.get('m.name') is not None) and f'{log.default}Computer {log.reset}{log.red}{r["m.name"]}{log.reset}{log.default} is high value{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'66': {
'query': 'MATCH p=(n {highvalue: true}) RETURN n.name,labels(n) ORDER BY n.name',
'desc': 'List all high-value principals',
'message_generator': lambda r: (r.get('n.name') is not None) and f'{log.red}{r["n.name"]} {log.reset}{log.default}({r["labels(n)"][0]}/{r["labels(n)"][1]}){log.reset}{log.default} is high value{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'67': {
'query': 'MATCH (m {highvalue: true, owned: true}) RETURN m.name,labels(m) ORDER BY m.name',
'desc': 'List all high-value owned principals',
'message_generator': lambda r: (r.get('m.name') is not None) and f'{log.red}{r["m.name"]} {log.reset}{log.default}({r["labels(m)"][0]}/{r["labels(m)"][1]}){log.reset}{log.default} is high value{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'68': {
'query': 'MATCH p=(n:User)-[r:MemberOf*1..]->(m:Group {highvalue: true}) RETURN n.name,m.name ORDER BY n.name',
'desc': 'List all members of high-value groups',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} is MemberOf high value group {log.reset}{log.red}{r["m.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'69': {
'query': 'MATCH p=(n {owned: true})-[r:MemberOf*1..]->(m:Group {highvalue: true}) RETURN n.name,m.name,labels(n) ORDER BY n.name',
'desc': 'List all members of high-value groups for owned principals',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.red}{r["n.name"]} {log.reset}{log.default}({r["labels(n)"][0]}/{r["labels(n)"][1]}){log.reset}{log.default} is MemberOf high value group {log.reset}{log.red}{r["m.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'70': {
'query': 'MATCH (m:User),(n {highvalue: true}),p=shortestPath((m)-[r*1..]->(n)) WHERE NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") AND NOT m=n RETURN m.name,p ORDER BY m.name',
'desc': 'List all user shortest paths to high-value targets',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'71': {
'query': 'MATCH (m:Group),(n {highvalue: true}),p=shortestPath((m)-[r*1..]->(n)) WHERE NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") AND NOT m=n RETURN m.name,p ORDER BY m.name',
'desc': 'List all group shortest paths to high-value targets',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'72': {
'query': 'MATCH (m:Computer),(n {highvalue: true}),p=shortestPath((m)-[r*1..]->(n)) WHERE NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") AND NOT m=n RETURN m.name,p ORDER BY m.name',
'desc': 'List all computer shortest paths to high-value targets',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'73': {
'query': 'MATCH (m:Group),(n {highvalue: true}),p=shortestPath((m)-[r*1..]->(n)) WHERE (m.objectid =~ "(?i)S-1-5-21-.*-513" OR m.objectid =~ "(?i).*-S-1-5-11" OR m.objectid =~ "(?i).*-S-1-1-0" OR m.objectid =~ "(?i).*-S-1-5-32-545") AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") AND NOT m=n RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to high-value targets for Users, Domain Users, Authenticated Users, or Everyone groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'74': {
'query': 'MATCH (m {owned: true}),(n {highvalue: true}),p=shortestPath((m)-[r*1..]->(n)) WHERE NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") AND NOT m=n RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to high-value targets for owned principals',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'75': {
'query': 'MATCH p=shortestPath((m:User)-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)EXCHANGE).*" AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all user shortest paths to Exchange groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'76': {
'query': 'MATCH p=shortestPath((m:Group)-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)EXCHANGE).*" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all group shortest paths to Exchange groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'77': {
'query': 'MATCH p=shortestPath((m:Computer)-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)EXCHANGE).*" AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all computer shortest paths to Exchange groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'78': {
'query': 'MATCH p=shortestPath((m:Group)-[r*1..]->(n:Group)) WHERE (m.objectid =~ "(?i)S-1-5-21-.*-513" OR m.objectid =~ "(?i).*-S-1-5-11" OR m.objectid =~ "(?i).*-S-1-1-0" OR m.objectid =~ "(?i).*-S-1-5-32-545") AND n.name =~ ".*((?i)EXCHANGE).*" AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") AND NOT m=n RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to Exchange groups for Users, Domain Users, Authenticated Users, or Everyone groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'79': {
'query': 'MATCH p=shortestPath((m {owned: true})-[r*1..]->(n:Group)) WHERE n.name =~ ".*((?i)EXCHANGE).*" AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") AND NOT m=n RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to Exchange groups for owned principals',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'80': {
'query': 'MATCH p=(m:User)-[r:AdminTo]->(n:Computer) RETURN m.name, n.name ORDER BY m.name',
'desc': 'List all user AdminTo privileges',
'message_generator': lambda r: (r.get('m.name') is not None and r.get('n.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["m.name"]}{log.reset}{log.default} is AdminTo {log.reset}{log.red}{r["n.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'81': {
'query': 'MATCH p=(m:Group)-[r:AdminTo]->(n:Computer) RETURN m.name,n.name ORDER BY m.name',
'desc': 'List all group AdminTo privileges',
'message_generator': lambda r: (r.get('m.name') is not None and r.get('n.name') is not None) and f'{log.default}Group {log.reset}{log.red}{r["m.name"]}{log.reset}{log.default} is AdminTo {log.reset}{log.red}{r["n.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'82': {
'query': 'MATCH p=(m:Computer)-[r:AdminTo]->(n:Computer) RETURN m.name,n.name ORDER BY m.name',
'desc': 'List all computer AdminTo privileges',
'message_generator': lambda r: (r.get('m.name') is not None and r.get('n.name') is not None) and f'{log.default}Computer {log.reset}{log.red}{r["m.name"]}{log.reset}{log.default} is AdminTo {log.reset}{log.red}{r["n.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'83': {
'query': 'MATCH p=(m:Group)-[r:AdminTo]->(n:Computer) WHERE (m.objectid =~ "(?i)S-1-5-21-.*-513" OR m.objectid =~ "(?i).*-S-1-5-11" OR m.objectid =~ "(?i).*-S-1-1-0" OR m.objectid =~ "(?i).*-S-1-5-32-545") RETURN m.name,n.name ORDER BY m.name',
'desc': 'List all AdminTo privileges for Users, Domain Users, Authenticated Users, or Everyone groups',
'message_generator': lambda r: (r.get('m.name') is not None and r.get('n.name') is not None) and f'{log.default}Group {log.reset}{log.red}{r["m.name"]}{log.reset}{log.default} is AdminTo {log.reset}{log.red}{r["n.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'84': {
'query': 'MATCH p=(m:Group)-[:MemberOf]->(g:Group)-[:AdminTo]->(n:Computer) WHERE (m.objectid =~ "(?i)S-1-5-21-.*-513" OR m.objectid =~ "(?i).*-S-1-5-11" OR m.objectid =~ "(?i).*-S-1-1-0" OR m.objectid =~ "(?i).*-S-1-5-32-545") RETURN m.name,n.name,g.name ORDER BY m.name',
'desc': 'List all group-delegated AdminTo privileges for Users, Domain Users, Authenticated Users, or Everyone groups',
'message_generator': lambda r: (r.get('m.name') is not None and r.get('n.name') is not None and r.get('g.name') is not None) and f'{log.default}Group {log.reset}{log.red}{r["m.name"]}{log.reset}{log.default} is MemberOf {log.reset}{log.red}{r["g.name"]} {log.reset}{log.default}which is AdminTo {log.reset}{log.red}{r["n.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'85': {
'query': 'MATCH p=(m {owned: true})-[r:AdminTo]->(n:Computer) RETURN m.name,n.name,labels(m) ORDER BY m.name',
'desc': 'List all AdminTo privileges for owned principals',
'message_generator': lambda r: (r.get('m.name') is not None and r.get('n.name') is not None) and f'{log.red}{r["m.name"]} {log.reset}{log.default}({r["labels(m)"][0]}/{r["labels(m)"][1]}){log.reset}{log.default} is AdminTo {log.reset}{log.red}{r["n.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'86': {
'query': 'MATCH (n {owned: true})-[:MemberOf]->(g:Group)-[:AdminTo]->(m:Computer) RETURN n.name,labels(n),m.name,g.name ORDER BY n.name',
'desc': 'List all group-delegated AdminTo privileges for owned principals',
'message_generator': lambda r: (r.get('m.name') is not None and r.get('n.name') is not None and r.get('g.name') is not None) and f'{log.red}{r["n.name"]} {log.reset}{log.default}({r["labels(n)"][0]}/{r["labels(n)"][1]}){log.reset}{log.default} is MemberOf {log.reset}{log.red}{r["g.name"]} {log.reset}{log.default}which is AdminTo {log.reset}{log.red}{r["m.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'87': {
'query': 'MATCH (m)-[:AdminTo]->(n:Computer)-[:MemberOf]->(g:Group) WHERE g.objectid =~ "(?i)S-1-5-21-.*-516" RETURN m.name,n.name,labels(m) ORDER BY m.name',
'desc': 'List all AdminTo privileges to Domain Controllers',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.red}{r["m.name"]} {log.reset}{log.default}({r["labels(m)"][0]}/{r["labels(m)"][1]}){log.reset}{log.default} is AdminTo {log.reset}{log.red}{r["n.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'88': {
'query': 'MATCH p=(n:User)-[r:ReadLAPSPassword]->(m:Computer) RETURN n.name,m.name ORDER by n.name',
'desc': 'List all user ReadLAPSPassword privileges',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} can read LAPS passwords for {log.reset}{log.red}{r["m.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'89': {
'query': 'MATCH p=(n:Group)-[r:ReadLAPSPassword]->(m:Computer) RETURN n.name,m.name ORDER by n.name',
'desc': 'List all group ReadLAPSPassword privileges',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.default}Group {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} can read LAPS passwords for {log.reset}{log.red}{r["m.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'90': {
'query': 'MATCH p=(n:Computer)-[r:ReadLAPSPassword]->(m:Computer) RETURN n.name,m.name ORDER by n.name',
'desc': 'List all computer ReadLAPSPassword privileges',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.default}Computer {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} can read LAPS passwords for {log.reset}{log.red}{r["m.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'91': {
'query': 'MATCH p=(n:Group)-[r:ReadLAPSPassword]->(m:Computer) WHERE (n.objectid =~ "(?i)S-1-5-21-.*-513" OR n.objectid =~ "(?i).*-S-1-5-11" OR n.objectid =~ "(?i).*-S-1-1-0" OR n.objectid =~ "(?i).*-S-1-5-32-545") RETURN n.name,m.name ORDER by n.name',
'desc': 'List all ReadLAPSPassword privileges for Users, Domain Users, Authenticated Users, or Everyone groups',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.default}Group {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} can read LAPS passwords for {log.reset}{log.red}{r["m.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'92': {
'query': 'MATCH p=(m {owned: true})-[r:ReadLAPSPassword]->(n:Computer) RETURN n.name,m.name,labels(m) ORDER by m.name',
'desc': 'List all ReadLAPSPassword privileges for owned principals',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.red}{r["m.name"]} {log.reset}{log.default}({r["labels(m)"][0]}/{r["labels(m)"][1]}){log.reset}{log.default} can read LAPS passwords for {log.reset}{log.red}{r["n.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'93': {
'query': 'MATCH p=(n:User)-[r:SyncLAPSPassword]->(m:Computer) RETURN n.name,m.name ORDER by n.name',
'desc': 'List all user SyncLAPSPassword privileges',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} can sync LAPS passwords for {log.reset}{log.red}{r["m.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'94': {
'query': 'MATCH p=(n:Group)-[r:SyncLAPSPassword]->(m:Computer) RETURN n.name,m.name ORDER by n.name',
'desc': 'List all group SyncLAPSPassword privileges',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.default}Group {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} can sync LAPS passwords for {log.reset}{log.red}{r["m.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'95': {
'query': 'MATCH p=(n:Computer)-[r:SyncLAPSPassword]->(m:Computer) RETURN n.name,m.name ORDER by n.name',
'desc': 'List all computer SyncLAPSPassword privileges',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.default}Computer {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} can sync LAPS passwords for {log.reset}{log.red}{r["m.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'96': {
'query': 'MATCH p=(n:Group)-[r:SyncLAPSPassword]->(m:Computer) WHERE (n.objectid =~ "(?i)S-1-5-21-.*-513" OR n.objectid =~ "(?i).*-S-1-5-11" OR n.objectid =~ "(?i).*-S-1-1-0" OR n.objectid =~ "(?i).*-S-1-5-32-545") RETURN n.name,m.name ORDER by n.name',
'desc': 'List all SyncLAPSPassword privileges for Users, Domain Users, Authenticated Users, or Everyone groups',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.default}Group {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} can sync LAPS passwords for {log.reset}{log.red}{r["m.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'97': {
'query': 'MATCH p=(m {owned: true})-[r:SyncLAPSPassword]->(n:Computer) RETURN n.name,m.name,labels(m) ORDER by m.name',
'desc': 'List all SyncLAPSPassword privileges for owned principals',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.red}{r["m.name"]} {log.reset}{log.default}({r["labels(m)"][0]}/{r["labels(m)"][1]}){log.reset}{log.default} can sync LAPS passwords for {log.reset}{log.red}{r["n.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'98': {
'query': 'MATCH (n:User)-[r:DumpSMSAPassword]->(m) RETURN n.name,m.name,labels(m) ORDER BY n.name',
'desc': 'List all user DumpSMSAPassword privileges',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} has DumpSMSAPassword over {log.reset}{log.red}{r["m.name"]} {log.reset}{log.default}({r["labels(m)"][0]}/{r["labels(m)"][1]}){log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'99': {
'query': 'MATCH (n:Group)-[r:DumpSMSAPassword]->(m) RETURN n.name,m.name,labels(m) ORDER BY n.name',
'desc': 'List all group DumpSMSAPassword privileges',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.default}Group {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} has DumpSMSAPassword over {log.reset}{log.red}{r["m.name"]} {log.reset}{log.default}({r["labels(m)"][0]}/{r["labels(m)"][1]}){log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'100': {
'query': 'MATCH (n:Computer)-[r:DumpSMSAPassword]->(m) RETURN n.name,m.name,labels(m) ORDER BY n.name',
'desc': 'List all computer DumpSMSAPassword privileges',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.default}Computer {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} has DumpSMSAPassword over {log.reset}{log.red}{r["m.name"]} {log.reset}{log.default}({r["labels(m)"][0]}/{r["labels(m)"][1]}){log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'101': {
'query': 'MATCH (n:Group)-[r:DumpSMSAPassword]->(m) WHERE (n.objectid =~ "(?i)S-1-5-21-.*-513" OR n.objectid =~ "(?i).*-S-1-5-11" OR n.objectid =~ "(?i).*-S-1-1-0" OR n.objectid =~ "(?i).*-S-1-5-32-545") RETURN n.name,m.name,labels(m) ORDER BY n.name',
'desc': 'List all DumpSMSAPassword privileges for Users, Domain Users, Authenticated Users, and Everyone groups',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.default}Group {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} has DumpSMSAPassword over {log.reset}{log.red}{r["m.name"]} {log.reset}{log.default}({r["labels(m)"][0]}/{r["labels(m)"][1]}){log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'102': {
'query': 'MATCH (n {owned: true})-[r:DumpSMSAPassword]->(m) RETURN n.name,m.name,labels(m),labels(n) ORDER BY n.name',
'desc': 'List all DumpSMSAPassword privileges for owned principals',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None) and f'{log.red}{r["n.name"]} {log.reset}{log.default}({r["labels(n)"][0]}/{r["labels(n)"][1]}){log.reset}{log.default} has DumpSMSAPassword over {log.reset}{log.red}{r["m.name"]} {log.reset}{log.default}({r["labels(m)"][0]}/{r["labels(m)"][1]}){log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'103': {
'query': 'MATCH (n:User)-[:MemberOf*1..]->(g:Group) WHERE g.objectid ENDS WITH \'-512\' MATCH p = (c:Computer)-[:HasSession]->(n) RETURN n.name,c.name ORDER BY n.name',
'desc': 'List Domain Admin sessions',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('c.name') is not None) and f'{log.default}Domain admin {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} HasSession on {log.reset}{log.red}{r["c.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'104': {
'query': 'MATCH (n:User)-[:MemberOf*1..]->(g:Group) WHERE g.objectid ENDS WITH \'-519\' MATCH p = (c:Computer)-[:HasSession]->(n) RETURN n.name,c.name ORDER BY n.name',
'desc': 'List Enterprise Admin sessions',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('c.name') is not None) and f'{log.default}Enterprise admin {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} HasSession on {log.reset}{log.red}{r["c.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'105': {
'query': 'MATCH (n:User) RETURN n.name ORDER BY n.name',
'desc': 'List all users',
'message_generator': lambda r: (r.get('n.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["n.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'106': {
'query': 'MATCH (n:Group) RETURN n.name ORDER BY n.name',
'desc': 'List all groups',
'message_generator': lambda r: (r.get('n.name') is not None) and f'{log.default}Group {log.reset}{log.red}{r["n.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'107': {
'query': 'MATCH (n:Computer) RETURN n.name ORDER BY n.name',
'desc': 'List all computers',
'message_generator': lambda r: (r.get('n.name') is not None) and f'{log.default}Computer {log.reset}{log.red}{r["n.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'108': {
'query': 'MATCH (m {owned: true}) RETURN m.name,labels(m) ORDER BY m.name',
'desc': 'List all owned principals',
'message_generator': lambda r: (r.get('m.name') is not None) and f'{log.default}Owned principal {log.reset}{log.red}{r["m.name"]} {log.reset}{log.default}({r["labels(m)"][0]}/{r["labels(m)"][1]}){log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'109': {
'query': 'MATCH (n:Computer {enabled: true}) RETURN n.name ORDER BY n.name',
'desc': 'List all enabled computers',
'message_generator': lambda r: (r.get('n.name') is not None) and f'{log.default}Computer {log.reset}{log.red}{r["n.name"]} {log.reset}{log.default}is enabled{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'110': {
'query': 'MATCH (n:Computer {enabled: false}) RETURN n.name ORDER BY n.name',
'desc': 'List all disabled computers',
'message_generator': lambda r: (r.get('n.name') is not None) and f'{log.default}Computer {log.reset}{log.red}{r["n.name"]} {log.reset}{log.default}is disabled{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'111': {
'query': 'MATCH (n:Group) WHERE n.objectid =~ "(?i)S-1-5-21-.*-516" WITH n MATCH p=(n)<-[r:MemberOf*1..]-(m) RETURN m.name ORDER BY m.name',
'desc': 'List all Domain Controllers',
'message_generator': lambda r: (r.get('m.name') is not None) and f'{log.default}Computer {log.reset}{log.red}{r["m.name"]}{log.reset}{log.default} is a Domain Controller{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'112': {
'query': 'MATCH (n:Group) WHERE n.objectid =~ "(?i)S-1-5-21-.*-516" WITH n MATCH p=(n)<-[r:MemberOf*1..]-(m) RETURN m.name,m.operatingsystem ORDER BY m.name',
'desc': 'List all Domain Controllers OSs',
'message_generator': lambda r: (r.get('m.name') is not None and r.get('m.operatingsystem') is not None) and f'{log.default}Domain Controller {log.reset}{log.red}{r["m.name"]}{log.reset}{log.default} OS {log.reset}{log.red}{r["m.operatingsystem"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'113': {
'query': 'MATCH p=shortestPath((m:User)-[r*1..]->(n:Group)) WHERE n.objectid =~ "(?i)S-1-5-21-.*-516" AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all user shortest paths to Domain Controllers',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'114': {
'query': 'MATCH p=shortestPath((m:Group)-[r*1..]->(n:Group)) WHERE n.objectid =~ "(?i)S-1-5-21-.*-516" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all group shortest paths to Domain Controllers',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'115': {
'query': 'MATCH p=shortestPath((m:Computer)-[r*1..]->(n:Group)) WHERE n.objectid =~ "(?i)S-1-5-21-.*-516" AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all computer shortest paths to Domain Controllers',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'116': {
'query': 'MATCH p=shortestPath((m:Group)-[r*1..]->(n:Group)) WHERE (m.objectid =~ "(?i)S-1-5-21-.*-513" OR m.objectid =~ "(?i).*-S-1-5-11" OR m.objectid =~ "(?i).*-S-1-1-0" OR m.objectid =~ "(?i).*-S-1-5-32-545") AND n.objectid =~ "(?i)S-1-5-21-.*-516" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to Domain Controllers for Users, Domain Users, Authenticated Users, or Everyone groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'117': {
'query': 'MATCH p=shortestPath((m {owned: true})-[r*1..]->(n:Group)) WHERE n.objectid =~ "(?i)S-1-5-21-.*-516" AND NOT m=n AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to Domain Controllers for owned principals',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'118': {
'query': 'MATCH (n:User {passwordnotreqd: true}) RETURN n.name ORDER BY n.name',
'desc': 'List all users that don\'t require a password',
'message_generator': lambda r: (r.get('n.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} is not required to have a password{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'119': {
'query': 'MATCH (n:User {passwordnotreqd: true, owned: true}) RETURN n.name ORDER BY n.name',
'desc': 'List all users that don\'t require a password for owned principals',
'message_generator': lambda r: (r.get('n.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} is not required to have a password{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'120': {
'query': 'MATCH (n:User {pwdneverexpires: true}) RETURN n.name ORDER BY n.name',
'desc': 'List all users where password never expires',
'message_generator': lambda r: (r.get('n.name') is not None) and f'{log.default}User\'s {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} password is set to never expire{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'121': {
'query': 'MATCH (n:User {pwdneverexpires: true, owned: true}) RETURN n.name ORDER BY n.name',
'desc': 'List all users where password never expires for owned principals',
'message_generator': lambda r: (r.get('n.name') is not None) and f'{log.default}User\'s {log.reset}{log.red}{r["n.name"]}{log.reset}{log.default} password is set to never expire{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'122': {
'query': 'MATCH (u:User)-[:AllowedToDelegate]->(c:Computer) RETURN u.name,c.name ORDER BY u.name',
'desc': 'List all user Constrained Delegation',
'message_generator': lambda r: (r.get('u.name') is not None and r.get('c.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["u.name"]}{log.reset}{log.default} is allowed to delegate for {log.reset}{log.red}{r["c.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'123': {
'query': 'MATCH (g:Group)-[:AllowedToDelegate]->(c:Computer) RETURN g.name,c.name ORDER BY g.name',
'desc': 'List all group Constrained Delegation',
'message_generator': lambda r: (r.get('g.name') is not None and r.get('c.name') is not None) and f'{log.default}Group {log.reset}{log.red}{r["g.name"]}{log.reset}{log.default} is allowed to delegate for {log.reset}{log.red}{r["c.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'124': {
'query': 'MATCH (c1:Computer)-[:AllowedToDelegate]->(c2:Computer) RETURN c1.name,c2.name ORDER BY c1.name',
'desc': 'List all computer Constrained Delegation',
'message_generator': lambda r: (r.get('c1.name') is not None and r.get('c2.name') is not None) and f'{log.default}Computer {log.reset}{log.red}{r["c1.name"]}{log.reset}{log.default} is allowed to delegate for {log.reset}{log.red}{r["c2.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'125': {
'query': 'MATCH (n:GPO) RETURN n.name ORDER BY n.name',
'desc': 'List all GPOs',
'message_generator': lambda r: (r.get('n.name') is not None) and f'{log.default}GPO {log.reset}{log.red}{r["n.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'126': {
'query': 'MATCH (n:Domain) RETURN n.name ORDER BY n.name',
'desc': 'List all domains',
'message_generator': lambda r: (r.get('n.name') is not None) and f'{log.default}Domain {log.reset}{log.red}{r["n.name"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'127': {
'query': 'MATCH p=(n:Domain)-[r:TrustedBy]->(m:Domain) RETURN r.trusttype,n.name,m.name ORDER by n.name',
'desc': 'List all domain trusts',
'message_generator': lambda r: (r.get('n.name') is not None and r.get('m.name') is not None and r.get('r.trusttype') is not None) and f'{log.default}Domain {log.reset}{log.red}{r["n.name"]} {log.reset}{log.default}is trusted by {log.reset}{log.red}{r["m.name"]} {log.reset}{log.default}with type {log.reset}{log.red}{r["r.trusttype"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'128': {
'query': 'MATCH p=shortestPath((m:User)-[r*1..]->(n:Domain)) WHERE NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") AND NOT m=n RETURN m.name,p ORDER BY m.name',
'desc': 'List all user shortest paths to domains',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'129': {
'query': 'MATCH p=shortestPath((m:Group)-[r*1..]->(n:Domain)) WHERE NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") AND NOT m=n RETURN m.name,p ORDER BY m.name',
'desc': 'List all group shortest paths to domains',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'130': {
'query': 'MATCH p=shortestPath((m:Computer)-[r*1..]->(n:Domain)) WHERE NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") AND NOT m=n RETURN m.name,p ORDER BY m.name',
'desc': 'List all computer shortest paths to domains',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'131': {
'query': 'MATCH p=shortestPath((m:Domain)-[r*1..]->(n:Domain)) WHERE NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") AND NONE (r in relationships(p) WHERE type(r)="TrustedBy") AND NOT m=n RETURN m.name,p ORDER BY m.name',
'desc': 'List all domain shortest paths to domains',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'132': {
'query': 'MATCH p=shortestPath((m:Group)-[r*1..]->(n:Domain)) WHERE (m.objectid =~ "(?i)S-1-5-21-.*-513" OR m.objectid =~ "(?i).*-S-1-5-11" OR m.objectid =~ "(?i).*-S-1-1-0" OR m.objectid =~ "(?i).*-S-1-5-32-545") AND NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") AND NOT m=n RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to domains for Users, Domain Users, Authenticated Users, or Everyone groups',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'133': {
'query': 'MATCH p=shortestPath((m {owned: true})-[r*1..]->(n:Domain)) WHERE NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NONE (r in relationships(p) WHERE type(r)="GetChangesInFilteredSet") AND NOT m=n RETURN m.name,p ORDER BY m.name',
'desc': 'List all shortest paths to domains for owned principals',
'message_generator': None,
'handler': self.handle_path_query,
'type': 'general',
},
'134': {
'query': 'MATCH (c:Computer) WHERE c.haslaps = true RETURN c.name ORDER BY c.name',
'desc': 'List computers with LAPS enabled',
'message_generator': lambda r: (r.get('c.name') is not None) and f'{log.default}Computer {log.reset}{log.red}{r["c.name"]}{log.reset}{log.default} has LAPS enabled{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'135': {
'query': 'MATCH (c:Computer) WHERE c.haslaps = false RETURN c.name ORDER BY c.name',
'desc': 'List computers with LAPS disabled',
'message_generator': lambda r: (r.get('c.name') is not None) and f'{log.default}Computer {log.reset}{log.red}{r["c.name"]}{log.reset}{log.default} has LAPS disabled{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'136': {
'query': 'MATCH (u:User) WHERE u.description =~ \'.*((?i)pass|pw|:).*\' RETURN u.name,u.description ORDER BY u.name',
'desc': 'List potential passwords in descriptions',
'message_generator': lambda r: (r.get('u.name') is not None and r.get('u.description') is not None) and f'{log.default}User {log.reset}{log.red}{r["u.name"]}{log.reset}{log.default} may have password in description {log.reset}{log.red}{r["u.description"]}{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'137': {
'query': 'MATCH (m:User {highvalue: true}) RETURN m.name ORDER BY m.name',
'desc': 'List all high-value users',
'message_generator': lambda r: (r.get('m.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["m.name"]}{log.reset}{log.default} is high value{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'138': {
'query': 'MATCH (m:User {sensitive: true}) RETURN m.name ORDER BY m.name',
'desc': 'List all sensitive users',
'message_generator': lambda r: (r.get('m.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["m.name"]}{log.reset}{log.default} is sensitive{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'139': {
'query': 'MATCH (m:User {admincount: true}) RETURN m.name ORDER BY m.name',
'desc': 'List all users with an admin count',
'message_generator': lambda r: (r.get('m.name') is not None) and f'{log.default}User {log.reset}{log.red}{r["m.name"]}{log.reset}{log.default} has an admin count{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'140': {
'query': 'MATCH (m:Group {admincount: true}) RETURN m.name ORDER BY m.name',
'desc': 'List all groups with an admin count',
'message_generator': lambda r: (r.get('m.name') is not None) and f'{log.default}Group {log.reset}{log.red}{r["m.name"]}{log.reset}{log.default} has an admin count{log.reset}' or None,
'handler': self.handle_standard_query,
'type': 'general',
},
'141': {
'query': 'MATCH (m:Computer {admincount: true}) RETURN m.name ORDER BY m.name',
'desc': 'List all computers with an admin count',