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

Function BenchmarkRunRules

pkg/rules/engine_test.go:513–580  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

511}
512
513func BenchmarkRunRules(b *testing.B) {
514 b.ReportAllocs()
515 e := NewEngine(new(ps.SnapshotterMock), newConfig("_fixtures/default/*.yml"))
516 rs, err := e.Compile()
517 require.NoError(b, err)
518 require.NotNil(b, rs)
519
520 b.ResetTimer()
521
522 evts := []*event.Event{
523 {
524 Type: event.ConnectTCPv4,
525 Name: "Recv",
526 Tid: 2484,
527 PID: 859,
528 Category: event.Net,
529 PS: &types.PS{
530 Name: "cmd.exe",
531 },
532 Params: event.Params{
533 params.NetDport: {Name: params.NetDport, Type: params.Uint16, Value: uint16(443)},
534 params.NetSport: {Name: params.NetSport, Type: params.Uint16, Value: uint16(43123)},
535 params.NetSIP: {Name: params.NetSIP, Type: params.IPv4, Value: net.ParseIP("127.0.0.1")},
536 params.NetDIP: {Name: params.NetDIP, Type: params.IPv4, Value: net.ParseIP("216.58.201.174")},
537 },
538 Metadata: make(map[event.MetadataKey]any),
539 },
540 {
541 Type: event.CreateProcess,
542 Name: "CreateProcess",
543 Category: event.Process,
544 Tid: 2484,
545 PID: 859,
546 PS: &types.PS{
547 Name: "powershell.exe",
548 },
549 Params: event.Params{
550 params.ProcessID: {Name: params.ProcessID, Type: params.PID, Value: 2323},
551 params.ProcessParentID: {Name: params.ProcessParentID, Type: params.PID, Value: uint32(8390)},
552 params.ProcessName: {Name: params.ProcessName, Type: params.UnicodeString, Value: "spotify.exe"},
553 params.Cmdline: {Name: params.Cmdline, Type: params.UnicodeString, Value: `C:\Users\admin\AppData\Roaming\Spotify\Spotify.exe --type=crashpad-handler /prefetch:7 --max-uploads=5 --max-db-size=20 --max-db-age=5 --monitor-self-annotation=ptype=crashpad-handler "--metrics-dir=C:\Users\admin\AppData\Local\Spotify\User Data" --url=https://crashdump.spotify.com:443/ --annotation=platform=win32 --annotation=product=spotify --annotation=version=1.1.4.197 --initial-client-data=0x5a4,0x5a0,0x5a8,0x59c,0x5ac,0x6edcbf60,0x6edcbf70,0x6edcbf7c`},
554 params.Exe: {Name: params.Exe, Type: params.UnicodeString, Value: `C:\Users\admin\AppData\Roaming\Spotify\Spotify.exe`},
555 params.UserSID: {Name: params.UserSID, Type: params.UnicodeString, Value: `admin\SYSTEM`},
556 },
557 Metadata: make(map[event.MetadataKey]any),
558 },
559 {
560 Type: event.CreateHandle,
561 Name: "CreateHandle",
562 Category: event.Handle,
563 Tid: 2484,
564 PID: 859,
565 PS: &types.PS{
566 Name: "powershell.exe",
567 },
568 Params: event.Params{
569 params.ProcessID: {Name: params.ProcessID, Type: params.PID, Value: 2323},
570 },

Callers

nothing calls this directly

Calls 4

CompileMethod · 0.95
ProcessEventMethod · 0.95
NewEngineFunction · 0.85
newConfigFunction · 0.85

Tested by

no test coverage detected