Skip to content

Commit 1fb806e

Browse files
committed
refactor: Trim the k prefix from types and packages
Historically, Fibratus has been envisioned as a tool to exclusively interact with the NT Kernel Logger ETW provider. Since then, more providers have been integrated, some of them operating in userspace. Thus, the assumption that the provenance of all events is coming out the kernel is no longer valid. It is semantically more correct to represent all types, packages, and identifier in a generic way. The most prominent example is the `Kevent` structure being renamed to `Event`.
1 parent 6e9efb8 commit 1fb806e

File tree

241 files changed

+5506
-5585
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

241 files changed

+5506
-5585
lines changed

.github/workflows/master.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
./make.bat mc
8585
./make.bat
8686
env:
87-
TAGS: kcap,filament,yara,yara_static
87+
TAGS: cap,filament,yara,yara_static
8888
- uses: actions/upload-artifact@v4
8989
with:
9090
name: "fibratus-amd64.exe"
@@ -176,7 +176,7 @@ jobs:
176176
export PKG_CONFIG_PATH=$(pwd)/pkg-config
177177
./make.bat test
178178
env:
179-
TAGS: kcap,yara,yara_static
179+
TAGS: cap,yara,yara_static
180180

181181
lint:
182182
runs-on: windows-latest

.github/workflows/pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
./make.bat mc
8787
./make.bat
8888
env:
89-
TAGS: kcap,filament,yara,yara_static
89+
TAGS: cap,filament,yara,yara_static
9090
- uses: actions/upload-artifact@v4
9191
with:
9292
name: "fibratus-amd64.exe"
@@ -158,7 +158,7 @@ jobs:
158158
export PKG_CONFIG_PATH=$(pwd)/pkg-config
159159
./make.bat test
160160
env:
161-
TAGS: kcap,yara,yara_static
161+
TAGS: cap,yara,yara_static
162162

163163
lint:
164164
runs-on: windows-latest

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
./make.bat mc
8686
./make.bat
8787
env:
88-
TAGS: kcap,filament,yara,yara_static
88+
TAGS: cap,filament,yara,yara_static
8989
- name: Install Wix
9090
shell: bash
9191
run: |

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
run:
22
build-tags:
3-
- kcap
3+
- cap
44
- filament
55
deadline: 10m
66

cmd/fibratus/app/capture/capture_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929

3030
var Command = &cobra.Command{
3131
Use: "capture [filter]",
32-
Short: "Capture event stream to the kcap (capture) file",
32+
Short: "Capture event stream to the cap (capture) file",
3333
RunE: capture,
3434
}
3535

cmd/fibratus/app/list/list.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import (
2424
"github.com/jedib0t/go-pretty/v6/table"
2525
"github.com/rabbitstack/fibratus/internal/bootstrap"
2626
"github.com/rabbitstack/fibratus/pkg/config"
27+
"github.com/rabbitstack/fibratus/pkg/event"
2728
"github.com/rabbitstack/fibratus/pkg/filter/fields"
28-
"github.com/rabbitstack/fibratus/pkg/kevent/ktypes"
2929
"github.com/spf13/cobra"
3030
"os"
3131
"path/filepath"
@@ -34,7 +34,7 @@ import (
3434

3535
var Command = &cobra.Command{
3636
Use: "list",
37-
Short: "Show info about filaments, filter fields or kernel event types",
37+
Short: "Show info about filaments, filter fields or event types",
3838
}
3939

4040
var listFilamentsCmd = &cobra.Command{
@@ -50,10 +50,9 @@ var listFieldsCmd = &cobra.Command{
5050
}
5151

5252
var listEventsCmd = &cobra.Command{
53-
Use: "kevents",
54-
Aliases: []string{"events"},
55-
Short: "List supported kernel event types",
56-
Run: listEvents,
53+
Use: "events",
54+
Short: "List supported event types",
55+
Run: listEvents,
5756
}
5857

5958
var cfg = config.NewWithOpts(config.WithList())
@@ -131,8 +130,8 @@ func listEvents(cmd *cobra.Command, args []string) {
131130
t.AppendHeader(table.Row{"Name", "Category", "Description"})
132131
t.SetStyle(table.StyleLight)
133132

134-
for _, ktyp := range ktypes.GetKtypesMeta() {
135-
t.AppendRow(table.Row{ktyp.Name, ktyp.Category, ktyp.Description})
133+
for _, ev := range event.GetTypesMeta() {
134+
t.AppendRow(table.Row{ev.Name, ev.Category, ev.Description})
136135
}
137136

138137
t.Render()

cmd/fibratus/app/replay/replay_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828

2929
var Command = &cobra.Command{
3030
Use: "replay",
31-
Short: "Replay event stream from the kcap (capture) file",
31+
Short: "Replay event stream from the cap (capture) file",
3232
RunE: replay,
3333
}
3434

cmd/fibratus/app/stats/stats.go

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ func init() {
4747
type Stats struct {
4848
AggregatorBatchEvents int `json:"aggregator.batch.events"`
4949
AggregatorFlushesCount int `json:"aggregator.flushes.count"`
50-
AggregatorKeventErrors int `json:"aggregator.kevent.errors"`
50+
AggregatorEventErrors int `json:"aggregator.event.errors"`
5151
AggregatorTransformerErrors map[string]int `json:"aggregator.transformer.errors"`
5252
AggregatorWorkerClientPublishErrors int `json:"aggregator.worker.client.publish.errors"`
53-
FilamentKdictErrors int `json:"filament.kdict.errors"`
54-
FilamentKeventBatchFlushes int `json:"filament.kevent.batch.flushes"`
55-
FilamentKeventErrors map[string]int `json:"filament.kevent.errors"`
56-
FilamentKeventProcessErrors int `json:"filament.kevent.process.errors"`
53+
FilamentDictErrors int `json:"filament.dict.errors"`
54+
FilamentEventBatchFlushes int `json:"filament.event.batch.flushes"`
55+
FilamentEventErrors map[string]int `json:"filament.event.errors"`
56+
FilamentEventProcessErrors int `json:"filament.event.process.errors"`
5757
FilterAccessorErrors map[string]int `json:"filter.accessor.errors"`
5858
FsFileObjectHandleHits int `json:"fs.file.object.handle.hits"`
5959
FsFileObjectMisses int `json:"fs.file.object.misses"`
@@ -67,28 +67,27 @@ type Stats struct {
6767
HandleTypeNameMisses int `json:"handle.type.name.misses"`
6868
HandleWaitTimeouts int `json:"handle.wait.timeouts"`
6969
HostnameErrors map[string]int `json:"hostname.errors"`
70-
KcapFlusherErrors map[string]int `json:"kcap.flusher.errors"`
71-
KcapHandleWriteErrors int `json:"kcap.handle.write.errors"`
72-
KcapKeventUnmarshalErrors int `json:"kcap.kevent.unmarshal.errors"`
73-
KcapKeventWriteErrors int `json:"kcap.kevent.write.errors"`
74-
KcapKstreamConsumerErrors int `json:"kcap.kstream.consumer.errors"`
75-
KcapOverflowErrors int `json:"kcap.overflow.errors"`
76-
KcapReadBytes int `json:"kcap.read.bytes"`
77-
KcapReadKevents int `json:"kcap.read.kevents"`
78-
KcapReaderDroppedByFilter int `json:"kcap.reader.dropped.by.filter"`
79-
KcapReaderHandleUnmarshalErrors int `json:"kcap.reader.handle.unmarshal.errors"`
80-
KeventPrcoessorFailures int `json:"kevent.processor.failures"`
81-
KeventSeqInitErrors map[string]int `json:"kevent.seq.init.errors"`
82-
KeventSeqStoreErrors int `json:"kevent.seq.store.errors"`
83-
KeventTimestampUnmarshalErrors int `json:"kevent.timestamp.unmarshal.errors"`
84-
KstreamDroppedKevents int `json:"kstream.dropped.kevents"`
85-
KstreamKbuffersRead int `json:"kstream.kbuffers.read"`
86-
KstreamKeventsEnqueued int `json:"kstream.kevents.enqueued"`
87-
KstreamKeventsDequeued int `json:"kstream.kevents.dequeued"`
88-
KstreamUnknownKevents int `json:"kstream.kevents.unknown"`
89-
KstreamKeventsProcessed int `json:"kstream.kevents.processed"`
90-
KstreamExcludedKevents int `json:"kstream.excluded.kevents"`
91-
KstreamKeventsFailures map[string]int `json:"kstream.kevents.failures"`
70+
CapFlusherErrors map[string]int `json:"cap.flusher.errors"`
71+
CapHandleWriteErrors int `json:"cap.handle.write.errors"`
72+
CapEventUnmarshalErrors int `json:"cap.event.unmarshal.errors"`
73+
CapEventWriteErrors int `json:"cap.event.write.errors"`
74+
CapEventSourceConsumerErrors int `json:"cap.eventsource.consumer.errors"`
75+
CapOverflowErrors int `json:"cap.overflow.errors"`
76+
CapReadBytes int `json:"cap.read.bytes"`
77+
CapReadEvents int `json:"cap.read.events"`
78+
CapReaderDroppedByFilter int `json:"cap.reader.dropped.by.filter"`
79+
CapReaderHandleUnmarshalErrors int `json:"cap.reader.handle.unmarshal.errors"`
80+
EventProcessorFailures int `json:"event.processor.failures"`
81+
EventSeqInitErrors map[string]int `json:"event.seq.init.errors"`
82+
EventSeqStoreErrors int `json:"event.seq.store.errors"`
83+
EventTimestampUnmarshalErrors int `json:"event.timestamp.unmarshal.errors"`
84+
EventSourceBuffersRead int `json:"eventsource.buffers.read"`
85+
EventSourceEventsEnqueued int `json:"eventsource.events.enqueued"`
86+
EventSourceEventsDequeued int `json:"eventsource.events.dequeued"`
87+
EventSourceUnknownEvents int `json:"eventsource.events.unknown"`
88+
EventSourceEventsProcessed int `json:"eventsource.events.processed"`
89+
EventSourceExcludedEvents int `json:"eventsource.excluded.events"`
90+
EventSourceEventsFailures map[string]int `json:"eventsource.events.failures"`
9291
LoggerErrors map[string]int `json:"logger.errors"`
9392
OutputAMQPChannelFailures int `json:"output.amqp.channel.failures"`
9493
OutputAMQPConnectionFailures int `json:"output.amqp.connection.failures"`

filaments/fishy_netio.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,23 @@
2929

3030

3131
def on_init():
32-
kfilter("kevt.category = 'net' and ps.name in (%s)" % (', '.join([f'\'{ps}\'' for ps in __procs__])))
32+
set_filter("evt.category = 'net' and ps.name in (%s)" % (', '.join([f'\'{ps}\'' for ps in __procs__])))
3333

3434

3535
@dotdictify
36-
def on_next_kevent(kevent):
37-
print(kevent)
38-
notify = True if kevent.pid in __pids__ else False
36+
def on_next_event(event):
37+
notify = True if event.pid in __pids__ else False
3938
if not notify:
4039
emit_alert(
41-
f'Anomalous network I/O detected to {kevent.kparams.dip}:{kevent.kparams.dport}',
42-
text(kevent),
40+
f'Anomalous network I/O detected to {event.params.dip}:{event.params.dport}',
41+
text(Event),
4342
severity='critical',
4443
tags=['anomalous netio']
4544
)
46-
__pids__.append(kevent.pid)
45+
__pids__.append(event.pid)
4746

4847

49-
def text(kevent):
48+
def text(event):
5049
return """
5150
5251
Source IP: %s
@@ -63,11 +62,11 @@ def text(kevent):
6362
User: %s
6463
6564
""" % (
66-
kevent.kparams.sip,
67-
kevent.kparams.sport,
68-
kevent.kparams.dip,
69-
kevent.kparams.dport,
70-
kevent.kparams.dport_name,
71-
kevent.exe,
72-
kevent.comm,
73-
kevent.cwd, kevent.sid)
65+
event.params.sip,
66+
event.params.sport,
67+
event.params.dip,
68+
event.params.dport,
69+
event.params.dport_name,
70+
event.exe,
71+
event.comm,
72+
event.cwd, event.sid)

filaments/teamviewer_remote_file_copy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,16 @@
5252

5353

5454
def on_init():
55-
kfilter("kevt.name = 'CreateFile' and ps.name = 'TeamViewer.exe' and file.operation = 'create' "
55+
kfilter("evt.name = 'CreateFile' and ps.name = 'TeamViewer.exe' and file.operation = 'create' "
5656
"and file.extension in (%s)"
5757
% (', '.join([f'\'{ext}\'' for ext in extensions])))
5858

5959

6060
@dotdictify
61-
def on_next_kevent(kevent):
61+
def on_next_kevent(event):
6262
emit_alert(
6363
f'Remote File Copy via TeamViewer',
64-
f'TeamViewer downloaded an executable or script file {kevent.kparams.file_name} via transfer session',
64+
f'TeamViewer downloaded an executable or script file {event.params.file_name} via transfer session',
6565
severity=__severity__,
6666
tags=[__tags__]
6767
)

0 commit comments

Comments
 (0)