Skip to content

Commit bd08785

Browse files
authored
Updated API and Selenium tests to validate Raw Access Read panel on User Security Dashboard (#426)
* Updated API & Sel tests for Create Remote Threads panel * Updated tests for Powershell network connections panel * Updated APi & Sel test for Raw Access Read panel on User Security Dashboard
1 parent 657b844 commit bd08785

File tree

4 files changed

+163
-5
lines changed

4 files changed

+163
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"winlog": {
3+
"computer_name": "C2.lme.local",
4+
"event_id" : "9",
5+
"keywords": [
6+
"Audit Failure"
7+
],
8+
"user": {
9+
"name": "APItestuserid",
10+
"domain": "test"
11+
},
12+
"event_data": {
13+
"LogonType": "2",
14+
"SubjectUserName": "-",
15+
"FailureReason": "%%2313",
16+
"SubjectDomainName": "-",
17+
"IpAddress": "194.169.175.22",
18+
"TargetUserName": "solidart",
19+
"LogonProcessName": "NtLmSsp ",
20+
"SubjectUserSid": "S-1-0-0",
21+
"TargetUserSid": "S-1-0-0",
22+
"AuthenticationPackageName": "NTLM",
23+
"ProcessId" : "1234"
24+
},
25+
"@timestamp": "2024-06-12T09:50:18.252Z",
26+
"host": {
27+
"name": "C2.lme.local"
28+
}
29+
},
30+
"process": {
31+
"parent": {
32+
"name": "powershell.exe",
33+
"executable": "powershell.exe",
34+
"args": "test"
35+
},
36+
"command_line": "invoke",
37+
"executable" : "powershell.exe",
38+
"args" : "test"
39+
},
40+
"event": {
41+
"code": "4624",
42+
"provider": "Microsoft-Windows-Sysmon",
43+
"action": "Logon",
44+
"outcome": "failure"
45+
},
46+
"user": {
47+
"name": "APItestuserid",
48+
"domain": "test"
49+
},
50+
"host": {
51+
"name": "C2.lme.local"
52+
},
53+
"destination": {
54+
"domain": "newtestdomain",
55+
"ip" : "1.2.3.4"
56+
}
57+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{
2+
"aggs": {
3+
"2": {
4+
"terms": {
5+
"field": "user.name",
6+
"order": {
7+
"_count": "desc"
8+
},
9+
"size": 100
10+
}
11+
}
12+
},
13+
"script_fields": {},
14+
"stored_fields": [
15+
"*"
16+
],
17+
"runtime_mappings": {
18+
"day_of_week": {
19+
"type": "long",
20+
"script": {
21+
"source": "emit(doc['@timestamp'].value.dayOfWeekEnum.getValue())"
22+
}
23+
},
24+
"hour_of_day": {
25+
"type": "long",
26+
"script": {
27+
"source": "emit (doc['@timestamp'].value.getHour())"
28+
}
29+
}
30+
},
31+
"_source": false,
32+
"query": {
33+
"bool": {
34+
"must": [],
35+
"filter": [
36+
{
37+
"bool": {
38+
"filter": [
39+
{
40+
"bool": {
41+
"should": [
42+
{
43+
"term": {
44+
"winlog.event_id": {
45+
"value": "9"
46+
}
47+
}
48+
}
49+
],
50+
"minimum_should_match": 1
51+
}
52+
},
53+
{
54+
"bool": {
55+
"should": [
56+
{
57+
"term": {
58+
"event.provider": {
59+
"value": "Microsoft-Windows-Sysmon"
60+
}
61+
}
62+
}
63+
],
64+
"minimum_should_match": 1
65+
}
66+
}
67+
]
68+
}
69+
},
70+
{
71+
"range": {
72+
"@timestamp": {
73+
"format": "strict_date_optional_time",
74+
"gte": "2009-08-23T13:29:55.216Z",
75+
"lte": "2024-08-23T13:29:55.216Z"
76+
}
77+
}
78+
}
79+
],
80+
"should": [],
81+
"must_not": []
82+
}
83+
},
84+
"highlight": {
85+
"pre_tags": [
86+
"@kibana-highlighted-field@"
87+
],
88+
"post_tags": [
89+
"@/kibana-highlighted-field@"
90+
],
91+
"fields": {
92+
"*": {}
93+
},
94+
"fragment_size": 2147483647
95+
}
96+
}

testing/tests/api_tests/data_insertion_tests/test_server.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@ def test_powershellNetworkConnections(es_host, es_port, username, password):
7979
second_response_loaded=insert_winlog_data(es_host, es_port, username, password, 'filter_powershellnetworkconnections.json', 'powershellnetworkconnections.json', 1)
8080

8181
# Check to make sure the data was inserted
82-
assert(second_response_loaded['aggregations']['2']['buckets'][0]['key'] == 'APItestuserid')
82+
assert(second_response_loaded['aggregations']['2']['buckets'][0]['key'] == 'APItestuserid')
8383

84-
85-
84+
85+
def test_rawaccessevents(es_host, es_port, username, password):
86+
87+
second_response_loaded=insert_winlog_data(es_host, es_port, username, password, 'filter_rawaccessevents.json', 'rawaccessevents.json', 1)
88+
89+
# Check to make sure the data was inserted
90+
assert(second_response_loaded['aggregations']['2']['buckets'][0]['key'] == 'APItestuserid')

testing/tests/selenium_tests/cluster/test_user_security_dashboard.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ def test_references_to_temporary_files(self, setup_login, kibana_url, timeout):
127127
driver = setup_login
128128
dashboard_test_function(driver, kibana_url, timeout, self.dashboard_id, "References to temporary files", ".needarealvaluehere",".visError")
129129

130-
@pytest.mark.skip(reason="Skipping this test")
130+
#@pytest.mark.skip(reason="Skipping this test")
131131
def test_raw_access_read(self, setup_login, kibana_url, timeout):
132132
driver = setup_login
133-
dashboard_test_function(driver, kibana_url, timeout, self.dashboard_id, "RawAccessRead (Sysmon Event 9)", ".needarealvaluehere",".euiDataGrid__noResults")
133+
dashboard_test_function(driver, kibana_url, timeout, self.dashboard_id, "RawAccessRead (Sysmon Event 9)", ".euiDataGrid",".euiDataGrid__noResults")
134134

135135
def test_windows_defender_title(self, setup_login, kibana_url, timeout):
136136
driver = setup_login

0 commit comments

Comments
 (0)