MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / TestInterpolateFields

Function TestInterpolateFields

pkg/filter/filter_test.go:1407–1540  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1405}
1406
1407func TestInterpolateFields(t *testing.T) {
1408 var tests = []struct {
1409 original string
1410 interpolated string
1411 evts []*event.Event
1412 }{
1413 {
1414 original: "Credential discovery via %ps.name (%evt.arg[cmdline]) and user %ps.sid",
1415 interpolated: "Credential discovery via VaultCmd.exe (VaultCmd.exe /listcreds:Windows Credentials /all) and user LOCAL\\tor",
1416 evts: []*event.Event{
1417 {
1418 Type: event.CreateProcess,
1419 Category: event.Process,
1420 Name: "CreateProcess",
1421 PID: 1023,
1422 PS: &pstypes.PS{
1423 Name: "VaultCmd.exe",
1424 Ppid: 345,
1425 SID: "LOCAL\\tor",
1426 },
1427 Params: event.Params{
1428 params.Cmdline: {Name: params.Cmdline, Type: params.UnicodeString, Value: `VaultCmd.exe /listcreds:Windows Credentials /all`},
1429 },
1430 },
1431 },
1432 },
1433 {
1434 original: "Credential discovery via %ps.name and pid %evt.pid",
1435 interpolated: "Credential discovery via N/A and pid 1023",
1436 evts: []*event.Event{
1437 {
1438 Type: event.CreateProcess,
1439 Category: event.Process,
1440 Name: "CreateProcess",
1441 PID: 1023,
1442 },
1443 },
1444 },
1445 {
1446 original: "Suspicious thread start module %thread.start_address.module",
1447 interpolated: "Suspicious thread start module C:\\Windows\\System32\\vault.dll",
1448 evts: []*event.Event{
1449 {
1450 Type: event.CreateThread,
1451 Category: event.Thread,
1452 Name: "CreateThread",
1453 PID: 1023,
1454 Params: event.Params{
1455 params.StartAddressModule: {Name: params.StartAddressModule, Type: params.UnicodeString, Value: "C:\\Windows\\System32\\vault.dll"},
1456 },
1457 },
1458 },
1459 },
1460 {
1461 original: `Detected an attempt by <code>%1.ps.name</code> process to access
1462and read the memory of the <b>Local Security And Authority Subsystem Service</b>
1463and subsequently write the <code>%2.file.path</code> dump file to the disk device`,
1464 interpolated: `Detected an attempt by <code>taskmgr.exe</code> process to access

Callers

nothing calls this directly

Calls 1

InterpolateFieldsFunction · 0.85

Tested by

no test coverage detected