@@ -35,6 +35,7 @@ import (
3535 "github.com/rabbitstack/fibratus/pkg/sys"
3636 "github.com/rabbitstack/fibratus/pkg/util/log"
3737 "github.com/rabbitstack/fibratus/pkg/util/signals"
38+ yconfig "github.com/rabbitstack/fibratus/pkg/yara/config"
3839 "github.com/sirupsen/logrus"
3940 "golang.org/x/sys/windows"
4041)
@@ -49,8 +50,8 @@ const (
4950)
5051
5152var (
52- className = windows .StringToUTF16Ptr ("fibratus" )
53- alertTitle = "Malicious Activity Detected"
53+ className = windows .StringToUTF16Ptr ("fibratus" )
54+ defaultSystrayTitle = "Malicious Activity Detected"
5455)
5556
5657// Msg represents the data exchanged between systray client/server.
@@ -77,6 +78,24 @@ func (m Msg) decode(output any) error {
7778 return decoder .Decode (m .Data )
7879}
7980
81+ func systrayTitle (alert alertsender.Alert ) string {
82+ switch alert .Title {
83+ case yconfig .MemoryThreatAlertTitle , yconfig .FileThreatAlertTitle :
84+ return alert .Title
85+ default :
86+ return defaultSystrayTitle
87+ }
88+ }
89+
90+ func systrayText (alert alertsender.Alert ) string {
91+ switch alert .Title {
92+ case yconfig .MemoryThreatAlertTitle , yconfig .FileThreatAlertTitle :
93+ return alert .Text
94+ default :
95+ return alert .Title
96+ }
97+ }
98+
8099type Systray struct {
81100 systrayIcon * sys.SystrayIcon
82101 window sys.Hwnd
@@ -222,7 +241,7 @@ func (s *Systray) handleMessage(m Msg) error {
222241 logrus .Errorf ("unable to decode alert: %v" , err )
223242 return err
224243 }
225- return s .systrayIcon .ShowBalloonNotification (alertTitle , alert . Title , s .config .Sound , s .config .QuietMode )
244+ return s .systrayIcon .ShowBalloonNotification (systrayTitle ( alert ), systrayText ( alert ) , s .config .Sound , s .config .QuietMode )
226245 }
227246 return nil
228247}
0 commit comments