@myth-tools/myth 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +55 -0
- package/run.js +177 -0
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@myth-tools/myth",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "An ultra-fast AI-powered reconnaissance agent for Kali Linux",
|
|
5
|
+
"main": "run.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"myth": "run.js",
|
|
8
|
+
"myth-cli": "run.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"postinstall": "node provision-browser.js",
|
|
12
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/myth-tools/MYTH-CLI.git"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/myth-tools/MYTH-CLI/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://myth.work.gd",
|
|
22
|
+
"funding": "https://github.com/sponsors/myth-tools",
|
|
23
|
+
"files": [
|
|
24
|
+
"run.js"
|
|
25
|
+
],
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=16.0.0"
|
|
28
|
+
},
|
|
29
|
+
"os": [
|
|
30
|
+
"linux"
|
|
31
|
+
],
|
|
32
|
+
"cpu": [
|
|
33
|
+
"x64",
|
|
34
|
+
"arm64"
|
|
35
|
+
],
|
|
36
|
+
"keywords": [
|
|
37
|
+
"kali",
|
|
38
|
+
"reconnaissance",
|
|
39
|
+
"ai",
|
|
40
|
+
"agent",
|
|
41
|
+
"security",
|
|
42
|
+
"osint",
|
|
43
|
+
"cli"
|
|
44
|
+
],
|
|
45
|
+
"author": "myth-tools <shesher0llms@gmail.com>",
|
|
46
|
+
"creator": {
|
|
47
|
+
"name": "Shesher Hasan",
|
|
48
|
+
"role": "Chief Architect",
|
|
49
|
+
"contact": "shesher0llms@gmail.com",
|
|
50
|
+
"organization": "myth-tools",
|
|
51
|
+
"clearance_level": "OPERATIVE-LEVEL-4 (SENIOR ARCHITECT)",
|
|
52
|
+
"system_license": "MYTH-INSTITUTIONAL-COMMERCIAL-2026-BETA"
|
|
53
|
+
},
|
|
54
|
+
"license": "MIT"
|
|
55
|
+
}
|
package/run.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* MYTH CLI — Native Execution Link (Node.js Proxy)
|
|
5
|
+
*
|
|
6
|
+
* This advanced interceptor allows the MYTH neural core to be deployed dynamically
|
|
7
|
+
* via `npx` without sacrificing the strict, system-level sandboxing (Bubblewrap)
|
|
8
|
+
* required for offensive security operations.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const { spawn } = require('child_process');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const os = require('os');
|
|
14
|
+
const fs = require('fs');
|
|
15
|
+
|
|
16
|
+
// Stylized output handlers respecting TTY
|
|
17
|
+
const isTTY = process.stdout.isTTY;
|
|
18
|
+
const format = {
|
|
19
|
+
red: (str) => isTTY ? `\x1b[31m${str}\x1b[0m` : str,
|
|
20
|
+
green: (str) => isTTY ? `\x1b[32m${str}\x1b[0m` : str,
|
|
21
|
+
yellow: (str) => isTTY ? `\x1b[33m${str}\x1b[0m` : str,
|
|
22
|
+
cyan: (str) => isTTY ? `\x1b[36m${str}\x1b[0m` : str,
|
|
23
|
+
bold: (str) => isTTY ? `\x1b[1m${str}\x1b[0m` : str,
|
|
24
|
+
dim: (str) => isTTY ? `\x1b[2m${str}\x1b[0m` : str,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// ─── 0. System Constraint Validation ───
|
|
28
|
+
if (os.platform() !== 'linux') {
|
|
29
|
+
console.error(format.red(format.bold(`✘ [FATAL ARCHITECTURE ERROR]`)));
|
|
30
|
+
console.error(format.red(`MYTH is a highly specialized offensive security operative.`));
|
|
31
|
+
console.error(format.yellow(`It enforces strict sandboxing via Linux user namespaces (Bubblewrap).`));
|
|
32
|
+
console.error(`Current OS: ${os.platform()} is NOT supported. Deploy on Kali Linux or Ubuntu.\n`);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Perform a robust resolution of the NATIVE neural core binary.
|
|
38
|
+
* This filters out Node.js symlinks to prevent infinite proxy loops.
|
|
39
|
+
* @param {string} cmd Binary to locate
|
|
40
|
+
* @returns {string|null} Resolved path or null
|
|
41
|
+
*/
|
|
42
|
+
const getCommandPath = (cmd) => {
|
|
43
|
+
try {
|
|
44
|
+
// FAST-PATH: Probe standard tactical locations directly (Zero-Latency)
|
|
45
|
+
const fastPaths = ['/usr/bin/myth', '/usr/local/bin/myth'];
|
|
46
|
+
for (const fp of fastPaths) {
|
|
47
|
+
if (fs.existsSync(fp)) {
|
|
48
|
+
const stats = fs.statSync(fp);
|
|
49
|
+
if (stats.isFile()) return fp;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// FALLBACK: Find all occurrences of the command in PATH
|
|
54
|
+
const output = require('child_process')
|
|
55
|
+
.execSync(`whereis -b ${cmd} | cut -d: -f2`, { stdio: 'pipe' })
|
|
56
|
+
.toString()
|
|
57
|
+
.trim();
|
|
58
|
+
|
|
59
|
+
const paths = output.split(/\s+/).filter(p => !!p);
|
|
60
|
+
|
|
61
|
+
for (const p of paths) {
|
|
62
|
+
// A professional native install typically sits in /usr/bin or /usr/local/bin
|
|
63
|
+
// We ignore any path that looks like an npm/nvm/bun/node directory
|
|
64
|
+
const isNodeScript = p.includes('node_modules') ||
|
|
65
|
+
p.includes('.npm') ||
|
|
66
|
+
p.includes('.nvm') ||
|
|
67
|
+
p.includes('.bun');
|
|
68
|
+
|
|
69
|
+
if (!isNodeScript && fs.existsSync(p)) {
|
|
70
|
+
// Ensure it's not a directory and is a real binary
|
|
71
|
+
const stats = fs.statSync(p);
|
|
72
|
+
if (stats.isFile()) return p;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
} catch {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* ─── 1. Core Deployment Orchestrator ───
|
|
83
|
+
* Elevates privileges securely and invokes the native bash implementation.
|
|
84
|
+
*/
|
|
85
|
+
async function executeDeployment() {
|
|
86
|
+
console.log(`\n` + format.cyan(format.bold(`⚡ TACTICAL PROXY: MYTH Neural Core Offline`)));
|
|
87
|
+
console.log(format.dim(`MYTH operates complex Linux sandboxes and requires host-level dependencies (Bubblewrap, Nmap, Tor).\nTo orchestrate these tools autonomously, we must first arm your environment natively.`));
|
|
88
|
+
console.log(format.yellow(`\n⚠ SECURITY NOTICE: You will securely be prompted for your 'sudo' password.`));
|
|
89
|
+
console.log(format.dim(` Executing: 'curl -fsSL https://myth.work.gd/install.sh | sudo bash'\n`));
|
|
90
|
+
|
|
91
|
+
return new Promise((resolve, reject) => {
|
|
92
|
+
// Spawn remote bash installer directly with strict pipefail catching
|
|
93
|
+
const proc = spawn('bash', ['-c', 'set -euo pipefail; curl -fsSL https://myth.work.gd/install.sh | sudo bash'], {
|
|
94
|
+
stdio: 'inherit'
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
proc.on('error', (err) => {
|
|
98
|
+
console.error(format.red(`\n✘ [SPAWN ERROR] Failed to initialize deployment: ${err.message}`));
|
|
99
|
+
reject(err);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
proc.on('close', (code) => {
|
|
103
|
+
if (code !== 0) {
|
|
104
|
+
console.error(format.red(format.bold(`\n✘ [DEPLOYMENT FAILED] System configuration aborted.`)));
|
|
105
|
+
process.exit(code || 1);
|
|
106
|
+
}
|
|
107
|
+
resolve();
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* ─── 2. Transparent Telemetry Forwarder ───
|
|
114
|
+
* Binds standard I/O and propagates OS-level signals identically to a native run.
|
|
115
|
+
*/
|
|
116
|
+
async function forwardTelemetry(binaryPath, args) {
|
|
117
|
+
return new Promise((resolve, reject) => {
|
|
118
|
+
const proc = spawn(binaryPath, args, {
|
|
119
|
+
stdio: 'inherit',
|
|
120
|
+
env: process.env
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
proc.on('error', (err) => {
|
|
124
|
+
console.error(format.red(`\n✘ [CORE CRASH] Failed to invoke neural core: ${err.message}`));
|
|
125
|
+
reject(err);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// Industry-Grade Signal Propagation
|
|
129
|
+
// Safely pass Ctrl+C, TERM, and system interrupts down to the Rust core
|
|
130
|
+
const signals = ['SIGINT', 'SIGTERM', 'SIGHUP', 'SIGQUIT', 'SIGUSR1', 'SIGUSR2'];
|
|
131
|
+
signals.forEach((signal) => {
|
|
132
|
+
process.on(signal, () => {
|
|
133
|
+
if (proc && !proc.killed) {
|
|
134
|
+
proc.kill(signal);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
proc.on('close', (code) => {
|
|
140
|
+
resolve(code || 0);
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// ─── Phase Zero: Entry Point Orchestration ───
|
|
146
|
+
(async () => {
|
|
147
|
+
try {
|
|
148
|
+
const rawArgs = process.argv.slice(2);
|
|
149
|
+
const finalArgs = rawArgs.length === 0 ? ['chat'] : rawArgs;
|
|
150
|
+
|
|
151
|
+
let mythPath = getCommandPath('myth');
|
|
152
|
+
|
|
153
|
+
// Bootstrap logic - Only show headers/logs if we are actually installing
|
|
154
|
+
if (!mythPath) {
|
|
155
|
+
await executeDeployment();
|
|
156
|
+
|
|
157
|
+
mythPath = getCommandPath('myth');
|
|
158
|
+
if (!mythPath) {
|
|
159
|
+
console.error(format.red(format.bold(`\n✘ [FATAL] MYTH footprint vanished. PATH resolution failed after successful install.`)));
|
|
160
|
+
console.error(format.yellow(`Try reloading your shell: "source ~/.bashrc" and execute again.`));
|
|
161
|
+
process.exit(1);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
console.log(format.green(format.bold(`\n✔ MYTH NEURAL CORE SYNCHRONIZED.`)));
|
|
165
|
+
console.log(format.dim(`The 'myth' command is now natively available on your system.\n`));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Forward raw telemetry or default to 'chat' mission
|
|
169
|
+
// Handover is silent and transparent
|
|
170
|
+
const code = await forwardTelemetry(mythPath, finalArgs);
|
|
171
|
+
process.exit(code);
|
|
172
|
+
} catch (e) {
|
|
173
|
+
console.error(format.red(`\n✘ [PROXY FAILURE] An unrecoverable exception occurred in the Node interceptor.`));
|
|
174
|
+
console.error(format.dim(e.stack));
|
|
175
|
+
process.exit(1);
|
|
176
|
+
}
|
|
177
|
+
})();
|