-
Notifications
You must be signed in to change notification settings - Fork 36
/
customqueries.json
230 lines (230 loc) · 12.4 KB
/
customqueries.json
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
{
"queries": [
{
"name": "Find all owned Domain Admins",
"requireNodeSelect": false,
"query": "MATCH (n:Group) WHERE n.name =~ {name} WITH n MATCH p=(n)<-[r:MemberOf*1..]-(m) WHERE exists(m.owned) AND NONE (x IN nodes(p) WHERE exists(x.blacklist)) AND NONE (x in relationships(p) WHERE exists(x.blacklist)) RETURN nodes(p),relationships(p)",
"allowCollapse": false,
"props": {"name": "(?i).*DOMAIN ADMINS.*"}
},
{
"name": "Find Shortest Paths from owned node to Domain Admins",
"requireNodeSelect": true,
"nodeSelectQuery": {
"query":"MATCH (n:Group) WHERE n.name =~ {name} RETURN n.name",
"queryProps": {"name":"(?i).*DOMAIN ADMINS.*"},
"onFinish": "MATCH (n),(m:Group {name:{result}}),p=shortestPath((n)-[*1..12]->(m)) WHERE exists(n.owned) AND NONE (x IN nodes(p) WHERE exists(x.blacklist)) AND NONE (x in relationships(p) WHERE exists(x.blacklist)) RETURN p",
"start":"",
"end": "{}",
"allowCollapse": true,
"boxTitle": "Select domain to map..."
}
},
{
"name": "Show Wave",
"requireNodeSelect": true,
"nodeSelectQuery": {
"query":"MATCH (n) WHERE exists(n.wave) WITH DISTINCT n.wave as d RETURN toString(d) ORDER BY d",
"queryProps": {},
"onFinish": "OPTIONAL MATCH (n1:User {wave:toInt({result})}) WITH collect(distinct n1) as c1 OPTIONAL MATCH (n2:Computer {wave:toInt({result})}) WITH collect(distinct n2) + c1 as c2 OPTIONAL MATCH (n3:Group {wave:toInt({result})}) WITH c2, collect(distinct n3) + c2 as c3 UNWIND c2 as n UNWIND c3 as m MATCH (n)-[r]->(m) WHERE not(exists(n.blacklist)) AND not(exists(m.blacklist)) AND not(exists(r.blacklist)) RETURN n,r,m",
"start": "",
"end": "",
"allowCollapse": true,
"boxTitle": "Select wave..."
}
},
{
"name": "Highlight Delta for Wave",
"requireNodeSelect": true,
"nodeSelectQuery": {
"query":"MATCH (n) WHERE exists(n.wave) WITH DISTINCT n.wave as d RETURN toString(d) ORDER BY d",
"queryProps": {},
"onFinish": "MATCH (n)-[r]->(m) WHERE n.wave<=toInt({result}) AND not(exists(n.blacklist)) AND not(exists(m.blacklist)) AND not(exists(r.blacklist)) RETURN n,r,m",
"start": "",
"end": "",
"allowCollapse": true,
"boxTitle": "Select wave to show deltas..."
}
},
{
"name": "Find Clusters of Password Reuse",
"requireNodeSelect": false,
"query": "MATCH p=(n)-[r:SharesPasswordWith]->(m) WHERE not(exists(n.blacklist)) AND not(exists(m.blacklist)) RETURN p",
"allowCollapse": true,
"props": {}
},
{
"name": "Show Blacklisted Nodes",
"requireNodeSelect": false,
"query": "MATCH (n) WHERE exists(n.blacklist) RETURN n",
"allowCollapse": true,
"props": {}
},
{
"name": "Show Blacklisted Relationships",
"requireNodeSelect": false,
"query": "MATCH (n)-[r]->(m) WHERE exists(r.blacklist) RETURN n,r,m",
"allowCollapse": true,
"props": {}
},
{
"name": "Show Blacklist",
"requireNodeSelect": false,
"query": "OPTIONAL MATCH (n {blacklist:true}) WITH n OPTIONAL MATCH p=(()-[{blacklist:true}]->()) RETURN n,p",
"allowCollapse": true,
"props": {}
},
{
"name": "Show owned Nodes",
"requireNodeSelect": false,
"query": "MATCH (n) WHERE exists(n.owned) RETURN n",
"allowCollapse": true,
"props": {}
},
{
"name": "Find Shortest Paths to DA Equivalency",
"requireNodeSelect": true,
"nodeSelectQuery": {
"query":"MATCH (n:Group) WHERE n.name =~ {name} RETURN n.name",
"queryProps": {"name":"(?i).*DOMAIN CONTROLLERS.*"},
"onFinish": "MATCH (n:User),(m:Group {name:{result}}),p=shortestPath((n)-[*1..]->(m)) RETURN p",
"start":"",
"end": "{}",
"allowCollapse": true,
"boxTitle": "Select domain to map..."
}
},
{
"name": "Find Shortest Paths to Domain Admins from Foreign User",
"requireNodeSelect": true,
"nodeSelectQuery": {
"query": "MATCH (n:Domain) RETURN n.name",
"queryProps":{},
"onFinish": "MATCH (n:User) WHERE NOT n.name ENDS WITH ('@' + {result}) WITH n MATCH (m:Group {name:('DOMAIN ADMINS@' + {result})}) WITH n,m MATCH p=shortestPath((n)-[*1..]->(m)) RETURN p",
"start": "{}",
"end": "",
"allowCollapse": true,
"boxTitle": "Select target domain..."
}
},
{
"name": "Show Connections over 22/tcp",
"requireNodeSelect": false,
"query": "MATCH p=((s:Computer)-[:Connected_22]->(d:Computer)) RETURN p",
"allowCollapse": true,
"props": {}
},
{
"name": "Show Connections over 80/tcp",
"requireNodeSelect": false,
"query": "MATCH p=((s:Computer)-[:Connected_80]->(d:Computer)) RETURN p",
"allowCollapse": true,
"props": {}
},
{
"name": "Show Connections over 135/tcp",
"requireNodeSelect": false,
"query": "MATCH p=((s:Computer)-[:Connected_135]->(d:Computer)) RETURN p",
"allowCollapse": true,
"props": {}
},
{
"name": "Show Connections over 139/tcp",
"requireNodeSelect": false,
"query": "MATCH p=((s:Computer)-[:Connected_139]->(d:Computer)) RETURN p",
"allowCollapse": true,
"props": {}
},
{
"name": "Show Connections over 389/tcp",
"requireNodeSelect": false,
"query": "MATCH p=((s:Computer)-[:Connected_389]->(d:Computer)) RETURN p",
"allowCollapse": true,
"props": {}
},
{
"name": "Show Connections over 443/tcp",
"requireNodeSelect": false,
"query": "MATCH p=((s:Computer)-[:Connected_443]->(d:Computer)) RETURN p",
"allowCollapse": true,
"props": {}
},
{
"name": "Show Connections over 445/tcp",
"requireNodeSelect": false,
"query": "MATCH p=((s:Computer)-[:Connected_445]->(d:Computer)) RETURN p",
"allowCollapse": true,
"props": {}
},
{
"name": "Show Connections over 1433/tcp",
"requireNodeSelect": false,
"query": "MATCH p=((s:Computer)-[:Connected_1433]->(d:Computer)) RETURN p",
"allowCollapse": true,
"props": {}
},
{
"name": "Show Connections over 1521/tcp",
"requireNodeSelect": false,
"query": "MATCH p=((s:Computer)-[:Connected_1521]->(d:Computer)) RETURN p",
"allowCollapse": true,
"props": {}
},
{
"name": "Show Connections over 3306/tcp",
"requireNodeSelect": false,
"query": "MATCH p=((s:Computer)-[:Connected_3306]->(d:Computer)) RETURN p",
"allowCollapse": true,
"props": {}
},
{
"name": "Show Connections over 3389/tcp",
"requireNodeSelect": false,
"query": "MATCH p=((s:Computer)-[:Connected_3389]->(d:Computer)) RETURN p",
"allowCollapse": true,
"props": {}
},
{
"name": "Show Connections over 5432/tcp",
"requireNodeSelect": false,
"query": "MATCH p=((s:Computer)-[:Connected_5432]->(d:Computer)) RETURN p",
"allowCollapse": true,
"props": {}
},
{
"name": "Show Database Connections",
"requireNodeSelect": false,
"query": "MATCH p=((s:Computer)-[:Connected_1433|Connected_1521|Connected_3306|Connected_5432]->(d:Computer)) RETURN p",
"allowCollapse": true,
"props": {}
},
{
"name": "Show Web App Connections",
"requireNodeSelect": false,
"query": "MATCH p=((s:Computer)-[:Connected_80|Connected_443]->(d:Computer)) RETURN p",
"allowCollapse": true,
"props": {}
},
{
"name": "Find Top 10 RDP Servers",
"requireNodeSelect": false,
"query": "MATCH (n:Computer)-[r:Connected_3389]->(m:Computer) WHERE NOT m.name STARTS WITH 'ANONYMOUS LOGON' AND NOT m.name='' WITH m, count(r) as rel_count order by rel_count desc LIMIT 10 MATCH (n)-[r:Connected_3389]->(m) RETURN n,r,m",
"allowCollapse": true,
"props": {}
},
{
"name": "Find Top 10 SSH Servers",
"requireNodeSelect": false,
"query": "MATCH (n:Computer)-[r:Connected_22]->(m:Computer) WHERE NOT m.name STARTS WITH 'ANONYMOUS LOGON' AND NOT m.name='' WITH m, count(r) as rel_count order by rel_count desc LIMIT 10 MATCH (n)-[r:Connected_22]->(m) RETURN n,r,m",
"allowCollapse": true,
"props": {}
},
{
"name": "Find Top 10 Web Apps with most Connections",
"requireNodeSelect": false,
"query": "MATCH (n:Computer)-[r:Connected_80|Connected_443]->(m:Computer) WHERE NOT m.name STARTS WITH 'ANONYMOUS LOGON' AND NOT m.name='' WITH m, count(r) as rel_count order by rel_count desc LIMIT 10 MATCH (n)-[r:Connected_80|Connected_443]->(m) RETURN n,r,m",
"allowCollapse": true,
"props": {}
}
]
}