@cyberstrike-io/cyberstrike 1.1.0 → 1.1.1
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/LICENSE +46 -0
- package/bin/cyberstrike +172 -4
- package/package.json +20 -4
- package/postinstall.mjs +125 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# CyberStrike Licensing
|
|
2
|
+
|
|
3
|
+
CyberStrike is a derivative work based on [OpenCode](https://github.com/anomalyco/opencode),
|
|
4
|
+
which is licensed under the MIT License.
|
|
5
|
+
|
|
6
|
+
This project uses a dual-license structure:
|
|
7
|
+
|
|
8
|
+
## Original Code (from OpenCode)
|
|
9
|
+
|
|
10
|
+
All original code from the OpenCode project remains under the
|
|
11
|
+
**MIT License**. See [LICENSE-MIT](LICENSE-MIT) for the full text.
|
|
12
|
+
|
|
13
|
+
## CyberStrike Modifications and New Code
|
|
14
|
+
|
|
15
|
+
All modifications, additions, and new code written by the CyberStrike team
|
|
16
|
+
are licensed under the **PolyForm Noncommercial License 1.0.0**.
|
|
17
|
+
See [LICENSE-POLYFORM](LICENSE-POLYFORM) for the full text.
|
|
18
|
+
|
|
19
|
+
### What this means:
|
|
20
|
+
|
|
21
|
+
- **Individuals**: You may freely use, modify, and distribute CyberStrike
|
|
22
|
+
for personal, educational, research, and other noncommercial purposes.
|
|
23
|
+
|
|
24
|
+
- **Noncommercial organizations**: Charitable, educational, public research,
|
|
25
|
+
and government institutions may use CyberStrike freely.
|
|
26
|
+
|
|
27
|
+
- **Commercial use**: Commercial use of CyberStrike modifications and new code
|
|
28
|
+
is **not permitted** without a separate commercial license from CyberStrike.
|
|
29
|
+
Contact: licensing@cyberstrike.us
|
|
30
|
+
|
|
31
|
+
- **Original OpenCode code**: The portions of code originating from OpenCode
|
|
32
|
+
remain under MIT and are not subject to the PolyForm restrictions.
|
|
33
|
+
|
|
34
|
+
## How to Identify Code Origin
|
|
35
|
+
|
|
36
|
+
- Commits before the fork date originate from OpenCode (MIT License).
|
|
37
|
+
- Commits after the fork date are CyberStrike modifications (PolyForm Noncommercial).
|
|
38
|
+
- When in doubt, refer to `git log` and the upstream repository.
|
|
39
|
+
|
|
40
|
+
## Required Notice
|
|
41
|
+
|
|
42
|
+
Required Notice: Copyright 2026 CyberStrike (https://cyberstrike.us)
|
|
43
|
+
|
|
44
|
+
## Commercial Licensing
|
|
45
|
+
|
|
46
|
+
For commercial licensing inquiries, contact: licensing@cyberstrike.us
|
package/bin/cyberstrike
CHANGED
|
@@ -1,5 +1,173 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
|
|
3
|
+
const childProcess = require("child_process")
|
|
4
|
+
const fs = require("fs")
|
|
5
|
+
const path = require("path")
|
|
6
|
+
const os = require("os")
|
|
7
|
+
|
|
8
|
+
function run(target) {
|
|
9
|
+
const result = childProcess.spawnSync(target, process.argv.slice(2), {
|
|
10
|
+
stdio: "inherit",
|
|
11
|
+
})
|
|
12
|
+
if (result.error) {
|
|
13
|
+
console.error(result.error.message)
|
|
14
|
+
process.exit(1)
|
|
15
|
+
}
|
|
16
|
+
const code = typeof result.status === "number" ? result.status : 0
|
|
17
|
+
process.exit(code)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const envPath = process.env.OPENCODE_BIN_PATH
|
|
21
|
+
if (envPath) {
|
|
22
|
+
run(envPath)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const scriptPath = fs.realpathSync(__filename)
|
|
26
|
+
const scriptDir = path.dirname(scriptPath)
|
|
27
|
+
|
|
28
|
+
const platformMap = {
|
|
29
|
+
darwin: "darwin",
|
|
30
|
+
linux: "linux",
|
|
31
|
+
win32: "windows",
|
|
32
|
+
}
|
|
33
|
+
const archMap = {
|
|
34
|
+
x64: "x64",
|
|
35
|
+
arm64: "arm64",
|
|
36
|
+
arm: "arm",
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let platform = platformMap[os.platform()]
|
|
40
|
+
if (!platform) {
|
|
41
|
+
platform = os.platform()
|
|
42
|
+
}
|
|
43
|
+
let arch = archMap[os.arch()]
|
|
44
|
+
if (!arch) {
|
|
45
|
+
arch = os.arch()
|
|
46
|
+
}
|
|
47
|
+
const base = "opencode-" + platform + "-" + arch
|
|
48
|
+
const binary = platform === "windows" ? "opencode.exe" : "opencode"
|
|
49
|
+
|
|
50
|
+
function supportsAvx2() {
|
|
51
|
+
if (arch !== "x64") return false
|
|
52
|
+
|
|
53
|
+
if (platform === "linux") {
|
|
54
|
+
try {
|
|
55
|
+
return /(^|\s)avx2(\s|$)/i.test(fs.readFileSync("/proc/cpuinfo", "utf8"))
|
|
56
|
+
} catch {
|
|
57
|
+
return false
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (platform === "darwin") {
|
|
62
|
+
try {
|
|
63
|
+
const result = childProcess.spawnSync("sysctl", ["-n", "hw.optional.avx2_0"], {
|
|
64
|
+
encoding: "utf8",
|
|
65
|
+
timeout: 1500,
|
|
66
|
+
})
|
|
67
|
+
if (result.status !== 0) return false
|
|
68
|
+
return (result.stdout || "").trim() === "1"
|
|
69
|
+
} catch {
|
|
70
|
+
return false
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (platform === "windows") {
|
|
75
|
+
const cmd =
|
|
76
|
+
'(Add-Type -MemberDefinition "[DllImport(""kernel32.dll"")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);" -Name Kernel32 -Namespace Win32 -PassThru)::IsProcessorFeaturePresent(40)'
|
|
77
|
+
|
|
78
|
+
for (const exe of ["powershell.exe", "pwsh.exe", "pwsh", "powershell"]) {
|
|
79
|
+
try {
|
|
80
|
+
const result = childProcess.spawnSync(exe, ["-NoProfile", "-NonInteractive", "-Command", cmd], {
|
|
81
|
+
encoding: "utf8",
|
|
82
|
+
timeout: 3000,
|
|
83
|
+
windowsHide: true,
|
|
84
|
+
})
|
|
85
|
+
if (result.status !== 0) continue
|
|
86
|
+
const out = (result.stdout || "").trim().toLowerCase()
|
|
87
|
+
if (out === "true" || out === "1") return true
|
|
88
|
+
if (out === "false" || out === "0") return false
|
|
89
|
+
} catch {
|
|
90
|
+
continue
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return false
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return false
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const names = (() => {
|
|
101
|
+
const avx2 = supportsAvx2()
|
|
102
|
+
const baseline = arch === "x64" && !avx2
|
|
103
|
+
|
|
104
|
+
if (platform === "linux") {
|
|
105
|
+
const musl = (() => {
|
|
106
|
+
try {
|
|
107
|
+
if (fs.existsSync("/etc/alpine-release")) return true
|
|
108
|
+
} catch {
|
|
109
|
+
// ignore
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
try {
|
|
113
|
+
const result = childProcess.spawnSync("ldd", ["--version"], { encoding: "utf8" })
|
|
114
|
+
const text = ((result.stdout || "") + (result.stderr || "")).toLowerCase()
|
|
115
|
+
if (text.includes("musl")) return true
|
|
116
|
+
} catch {
|
|
117
|
+
// ignore
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return false
|
|
121
|
+
})()
|
|
122
|
+
|
|
123
|
+
if (musl) {
|
|
124
|
+
if (arch === "x64") {
|
|
125
|
+
if (baseline) return [`${base}-baseline-musl`, `${base}-musl`, `${base}-baseline`, base]
|
|
126
|
+
return [`${base}-musl`, `${base}-baseline-musl`, base, `${base}-baseline`]
|
|
127
|
+
}
|
|
128
|
+
return [`${base}-musl`, base]
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (arch === "x64") {
|
|
132
|
+
if (baseline) return [`${base}-baseline`, base, `${base}-baseline-musl`, `${base}-musl`]
|
|
133
|
+
return [base, `${base}-baseline`, `${base}-musl`, `${base}-baseline-musl`]
|
|
134
|
+
}
|
|
135
|
+
return [base, `${base}-musl`]
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (arch === "x64") {
|
|
139
|
+
if (baseline) return [`${base}-baseline`, base]
|
|
140
|
+
return [base, `${base}-baseline`]
|
|
141
|
+
}
|
|
142
|
+
return [base]
|
|
143
|
+
})()
|
|
144
|
+
|
|
145
|
+
function findBinary(startDir) {
|
|
146
|
+
let current = startDir
|
|
147
|
+
for (;;) {
|
|
148
|
+
const modules = path.join(current, "node_modules")
|
|
149
|
+
if (fs.existsSync(modules)) {
|
|
150
|
+
for (const name of names) {
|
|
151
|
+
const candidate = path.join(modules, name, "bin", binary)
|
|
152
|
+
if (fs.existsSync(candidate)) return candidate
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
const parent = path.dirname(current)
|
|
156
|
+
if (parent === current) {
|
|
157
|
+
return
|
|
158
|
+
}
|
|
159
|
+
current = parent
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const resolved = findBinary(scriptDir)
|
|
164
|
+
if (!resolved) {
|
|
165
|
+
console.error(
|
|
166
|
+
"It seems that your package manager failed to install the right version of the opencode CLI for your platform. You can try manually installing " +
|
|
167
|
+
names.map((n) => `\"${n}\"`).join(" or ") +
|
|
168
|
+
" package",
|
|
169
|
+
)
|
|
170
|
+
process.exit(1)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
run(resolved)
|
package/package.json
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyberstrike-io/cyberstrike",
|
|
3
|
-
"version": "1.1.0",
|
|
4
3
|
"description": "The first open-source AI agent built for offensive security. Autonomous pentesting from your terminal.",
|
|
4
|
+
"bin": {
|
|
5
|
+
"cyberstrike": "./bin/cyberstrike"
|
|
6
|
+
},
|
|
7
|
+
"scripts": {
|
|
8
|
+
"postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
|
|
9
|
+
},
|
|
10
|
+
"version": "1.1.1",
|
|
5
11
|
"license": "AGPL-3.0-only",
|
|
6
12
|
"keywords": [
|
|
7
13
|
"cyberstrike",
|
|
@@ -30,7 +36,17 @@
|
|
|
30
36
|
"type": "git",
|
|
31
37
|
"url": "https://github.com/CyberStrikeus/CyberStrike.git"
|
|
32
38
|
},
|
|
33
|
-
"
|
|
34
|
-
"cyberstrike": "
|
|
39
|
+
"optionalDependencies": {
|
|
40
|
+
"@cyberstrike-io/cyberstrike-darwin-x64": "1.1.1",
|
|
41
|
+
"@cyberstrike-io/cyberstrike-linux-x64-baseline-musl": "1.1.1",
|
|
42
|
+
"@cyberstrike-io/cyberstrike-linux-arm64-musl": "1.1.1",
|
|
43
|
+
"@cyberstrike-io/cyberstrike-linux-x64-baseline": "1.1.1",
|
|
44
|
+
"@cyberstrike-io/cyberstrike-darwin-x64-baseline": "1.1.1",
|
|
45
|
+
"@cyberstrike-io/cyberstrike-linux-arm64": "1.1.1",
|
|
46
|
+
"@cyberstrike-io/cyberstrike-windows-x64": "1.1.1",
|
|
47
|
+
"@cyberstrike-io/cyberstrike-windows-x64-baseline": "1.1.1",
|
|
48
|
+
"@cyberstrike-io/cyberstrike-linux-x64-musl": "1.1.1",
|
|
49
|
+
"@cyberstrike-io/cyberstrike-darwin-arm64": "1.1.1",
|
|
50
|
+
"@cyberstrike-io/cyberstrike-linux-x64": "1.1.1"
|
|
35
51
|
}
|
|
36
|
-
}
|
|
52
|
+
}
|
package/postinstall.mjs
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from "fs"
|
|
4
|
+
import path from "path"
|
|
5
|
+
import os from "os"
|
|
6
|
+
import { fileURLToPath } from "url"
|
|
7
|
+
import { createRequire } from "module"
|
|
8
|
+
|
|
9
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
10
|
+
const require = createRequire(import.meta.url)
|
|
11
|
+
|
|
12
|
+
function detectPlatformAndArch() {
|
|
13
|
+
// Map platform names
|
|
14
|
+
let platform
|
|
15
|
+
switch (os.platform()) {
|
|
16
|
+
case "darwin":
|
|
17
|
+
platform = "darwin"
|
|
18
|
+
break
|
|
19
|
+
case "linux":
|
|
20
|
+
platform = "linux"
|
|
21
|
+
break
|
|
22
|
+
case "win32":
|
|
23
|
+
platform = "windows"
|
|
24
|
+
break
|
|
25
|
+
default:
|
|
26
|
+
platform = os.platform()
|
|
27
|
+
break
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Map architecture names
|
|
31
|
+
let arch
|
|
32
|
+
switch (os.arch()) {
|
|
33
|
+
case "x64":
|
|
34
|
+
arch = "x64"
|
|
35
|
+
break
|
|
36
|
+
case "arm64":
|
|
37
|
+
arch = "arm64"
|
|
38
|
+
break
|
|
39
|
+
case "arm":
|
|
40
|
+
arch = "arm"
|
|
41
|
+
break
|
|
42
|
+
default:
|
|
43
|
+
arch = os.arch()
|
|
44
|
+
break
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return { platform, arch }
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function findBinary() {
|
|
51
|
+
const { platform, arch } = detectPlatformAndArch()
|
|
52
|
+
const packageName = `@cyberstrike-io/cyberstrike-${platform}-${arch}`
|
|
53
|
+
const binaryName = platform === "windows" ? "cyberstrike.exe" : "cyberstrike"
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
// Use require.resolve to find the package
|
|
57
|
+
const packageJsonPath = require.resolve(`${packageName}/package.json`)
|
|
58
|
+
const packageDir = path.dirname(packageJsonPath)
|
|
59
|
+
const binaryPath = path.join(packageDir, "bin", binaryName)
|
|
60
|
+
|
|
61
|
+
if (!fs.existsSync(binaryPath)) {
|
|
62
|
+
throw new Error(`Binary not found at ${binaryPath}`)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return { binaryPath, binaryName }
|
|
66
|
+
} catch (error) {
|
|
67
|
+
throw new Error(`Could not find package ${packageName}: ${error.message}`)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function prepareBinDirectory(binaryName) {
|
|
72
|
+
const binDir = path.join(__dirname, "bin")
|
|
73
|
+
const targetPath = path.join(binDir, binaryName)
|
|
74
|
+
|
|
75
|
+
// Ensure bin directory exists
|
|
76
|
+
if (!fs.existsSync(binDir)) {
|
|
77
|
+
fs.mkdirSync(binDir, { recursive: true })
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Remove existing binary/symlink if it exists
|
|
81
|
+
if (fs.existsSync(targetPath)) {
|
|
82
|
+
fs.unlinkSync(targetPath)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return { binDir, targetPath }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function symlinkBinary(sourcePath, binaryName) {
|
|
89
|
+
const { targetPath } = prepareBinDirectory(binaryName)
|
|
90
|
+
|
|
91
|
+
fs.symlinkSync(sourcePath, targetPath)
|
|
92
|
+
console.log(`cyberstrike binary symlinked: ${targetPath} -> ${sourcePath}`)
|
|
93
|
+
|
|
94
|
+
// Verify the file exists after operation
|
|
95
|
+
if (!fs.existsSync(targetPath)) {
|
|
96
|
+
throw new Error(`Failed to symlink binary to ${targetPath}`)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async function main() {
|
|
101
|
+
try {
|
|
102
|
+
if (os.platform() === "win32") {
|
|
103
|
+
// On Windows, the .exe is already included in the package and bin field points to it
|
|
104
|
+
// No postinstall setup needed
|
|
105
|
+
console.log("Windows detected: binary setup not needed (using packaged .exe)")
|
|
106
|
+
return
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// On non-Windows platforms, just verify the binary package exists
|
|
110
|
+
// Don't replace the wrapper script - it handles binary execution
|
|
111
|
+
const { binaryPath } = findBinary()
|
|
112
|
+
console.log(`Platform binary verified at: ${binaryPath}`)
|
|
113
|
+
console.log("Wrapper script will handle binary execution")
|
|
114
|
+
} catch (error) {
|
|
115
|
+
console.error("Failed to setup cyberstrike binary:", error.message)
|
|
116
|
+
process.exit(1)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
try {
|
|
121
|
+
main()
|
|
122
|
+
} catch (error) {
|
|
123
|
+
console.error("Postinstall script error:", error.message)
|
|
124
|
+
process.exit(0)
|
|
125
|
+
}
|