@memrov2/pentcloud-reference 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +15 -2
- package/THIRD_PARTY_NOTICES.md +3 -0
- package/package.json +36 -4
- package/src/index.d.mts +14 -0
- package/src/index.mjs +77 -0
- package/src/worker.d.mts +20 -0
- package/src/worker.mjs +8 -0
- package/tools.lock.json +89 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PentCloud contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
#
|
|
1
|
+
# PentCloud reference
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Searchsploit and pinned ExploitDB references in a separate native Cloudflare runtime. **Version 0.1.0 SDK.** readSource(path) returns bounded source bytes and SHA-256 from the same pinned revision, without execution.
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
export { ReferenceRunner } from '@memrov2/pentcloud-reference/worker';
|
|
7
|
+
const runner = env.TOOL.getByName(runId);
|
|
8
|
+
try {
|
|
9
|
+
const result = await runner.run({tool:'searchsploit',query:'2.4.49'});
|
|
10
|
+
// Save the result in your existing private assessment store.
|
|
11
|
+
} finally {
|
|
12
|
+
await runner.stop();
|
|
13
|
+
}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Configure the matching named Container image. See [interfaces, build instructions, verification and limits](https://github.com/Memrov/PentCloud-tools/blob/main/docs/remaining-bundles.md) before integration. This package does not deploy or modify PentCloud.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
The adapter is MIT licensed. Original runtime programs and data retain their upstream licenses and notices, preserved in the image. The package lock lists every pinned input. Unreleased candidate; no license grant for third-party redistribution is implied.
|
package/package.json
CHANGED
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memrov2/pentcloud-reference",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"description": "Cloudflare-native reference tool pack",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/Memrov/PentCloud-tools.git",
|
|
10
|
+
"directory": "packages/reference"
|
|
11
|
+
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=22"
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./src/index.d.mts",
|
|
18
|
+
"import": "./src/index.mjs"
|
|
19
|
+
},
|
|
20
|
+
"./worker": {
|
|
21
|
+
"types": "./src/worker.d.mts",
|
|
22
|
+
"import": "./src/worker.mjs"
|
|
23
|
+
},
|
|
24
|
+
"./tools.lock.json": "./tools.lock.json"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"src",
|
|
28
|
+
"tools.lock.json",
|
|
29
|
+
"LICENSE",
|
|
30
|
+
"THIRD_PARTY_NOTICES.md"
|
|
31
|
+
],
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@memrov2/pentcloud-tool-runtime": "0.1.0"
|
|
37
|
+
}
|
|
38
|
+
}
|
package/src/index.d.mts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ToolCommand, PackLock } from "@memrov2/pentcloud-tool-runtime";
|
|
2
|
+
export type PackRequest = { tool: "searchsploit"; query: string };
|
|
3
|
+
export declare const lock: PackLock;
|
|
4
|
+
export declare function buildCommand(input: PackRequest): ToolCommand;
|
|
5
|
+
|
|
6
|
+
export declare function fetchReference(
|
|
7
|
+
path: string,
|
|
8
|
+
fetcher?: typeof fetch,
|
|
9
|
+
): Promise<{
|
|
10
|
+
path: string;
|
|
11
|
+
revision: string;
|
|
12
|
+
sha256: string;
|
|
13
|
+
bytes: Uint8Array;
|
|
14
|
+
}>;
|
package/src/index.mjs
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import lock from "../tools.lock.json" with { type: "json" };
|
|
2
|
+
export { lock };
|
|
3
|
+
export async function fetchReference(path, fetcher = fetch) {
|
|
4
|
+
if (typeof path === "string" && path.startsWith("/opt/exploitdb/"))
|
|
5
|
+
path = path.slice("/opt/exploitdb/".length);
|
|
6
|
+
if (
|
|
7
|
+
typeof path !== "string" ||
|
|
8
|
+
path.length > 240 ||
|
|
9
|
+
!/^(?:exploits|shellcodes)\/[a-z0-9_./-]+$/i.test(path) ||
|
|
10
|
+
path.split("/").some((p) => !p || p === "." || p === "..")
|
|
11
|
+
)
|
|
12
|
+
throw new TypeError("Select a pinned exploit reference path");
|
|
13
|
+
const url =
|
|
14
|
+
"https://gitlab.com/exploit-database/exploitdb/-/raw/" +
|
|
15
|
+
lock.dataRevision +
|
|
16
|
+
"/" +
|
|
17
|
+
path;
|
|
18
|
+
const response = await fetcher(url, {
|
|
19
|
+
redirect: "manual",
|
|
20
|
+
credentials: "omit",
|
|
21
|
+
signal: AbortSignal.timeout(15000),
|
|
22
|
+
});
|
|
23
|
+
if (
|
|
24
|
+
!response.ok ||
|
|
25
|
+
Number(response.headers.get("Content-Length") ?? 0) > 1048576
|
|
26
|
+
) {
|
|
27
|
+
await response.body?.cancel();
|
|
28
|
+
throw new Error("Reference source unavailable or oversized");
|
|
29
|
+
}
|
|
30
|
+
const reader = response.body?.getReader();
|
|
31
|
+
if (!reader) throw new Error("Reference source body missing");
|
|
32
|
+
const chunks = [];
|
|
33
|
+
let length = 0;
|
|
34
|
+
while (true) {
|
|
35
|
+
const item = await reader.read();
|
|
36
|
+
if (item.done) break;
|
|
37
|
+
length += item.value.length;
|
|
38
|
+
if (length > 1048576) {
|
|
39
|
+
await reader.cancel();
|
|
40
|
+
throw new Error("Reference source exceeds one MiB");
|
|
41
|
+
}
|
|
42
|
+
chunks.push(item.value);
|
|
43
|
+
}
|
|
44
|
+
const bytes = new Uint8Array(length);
|
|
45
|
+
let offset = 0;
|
|
46
|
+
for (const chunk of chunks) {
|
|
47
|
+
bytes.set(chunk, offset);
|
|
48
|
+
offset += chunk.length;
|
|
49
|
+
}
|
|
50
|
+
const digest = await crypto.subtle.digest("SHA-256", bytes);
|
|
51
|
+
return {
|
|
52
|
+
path,
|
|
53
|
+
revision: lock.dataRevision,
|
|
54
|
+
sha256: [...new Uint8Array(digest)]
|
|
55
|
+
.map((x) => x.toString(16).padStart(2, "0"))
|
|
56
|
+
.join(""),
|
|
57
|
+
bytes,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export function buildCommand(input) {
|
|
61
|
+
if (
|
|
62
|
+
!input ||
|
|
63
|
+
Object.keys(input).some((k) => !["tool", "query"].includes(k)) ||
|
|
64
|
+
input.tool !== "searchsploit" ||
|
|
65
|
+
typeof input.query !== "string" ||
|
|
66
|
+
!input.query.trim() ||
|
|
67
|
+
input.query.length > 160 ||
|
|
68
|
+
input.query.startsWith("-") ||
|
|
69
|
+
!/^[a-z0-9 _./:+-]+$/i.test(input.query)
|
|
70
|
+
)
|
|
71
|
+
throw new TypeError("Use read-only search words");
|
|
72
|
+
return {
|
|
73
|
+
argv: ["/opt/pentcloud-reference/bin/searchsploit", "--json", input.query],
|
|
74
|
+
stdin: "",
|
|
75
|
+
timeoutMs: 75000,
|
|
76
|
+
};
|
|
77
|
+
}
|
package/src/worker.d.mts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DurableObject } from "cloudflare:workers";
|
|
2
|
+
import type { ToolResult } from "@memrov2/pentcloud-tool-runtime";
|
|
3
|
+
import type { PackRequest } from "./index.mjs";
|
|
4
|
+
export declare class ReferenceRunner extends DurableObject {
|
|
5
|
+
run(input: PackRequest): Promise<ToolResult>;
|
|
6
|
+
stop(): Promise<{ stopped: boolean }>;
|
|
7
|
+
readSource(
|
|
8
|
+
path: string,
|
|
9
|
+
): Promise<{
|
|
10
|
+
path: string;
|
|
11
|
+
revision: string;
|
|
12
|
+
sha256: string;
|
|
13
|
+
bytes: Uint8Array;
|
|
14
|
+
}>;
|
|
15
|
+
capabilities(): Promise<{
|
|
16
|
+
platform: string;
|
|
17
|
+
architecture: string;
|
|
18
|
+
rawPacketSocket: boolean;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
package/src/worker.mjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRunner } from "@memrov2/pentcloud-tool-runtime/worker";
|
|
2
|
+
import { lock, buildCommand, fetchReference } from "./index.mjs";
|
|
3
|
+
const Runtime = createRunner(lock, buildCommand);
|
|
4
|
+
export class ReferenceRunner extends Runtime {
|
|
5
|
+
readSource(path) {
|
|
6
|
+
return fetchReference(path);
|
|
7
|
+
}
|
|
8
|
+
}
|
package/tools.lock.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"packId": "reference",
|
|
4
|
+
"packVersion": "0.1.0",
|
|
5
|
+
"platform": "linux/amd64",
|
|
6
|
+
"baseImage": "docker.io/library/debian@sha256:a72b4433de1cf7d6bae0c4cee74d0547f58601a643b3375f070c51600d63b6b2",
|
|
7
|
+
"tools": [
|
|
8
|
+
{
|
|
9
|
+
"tool": "searchsploit",
|
|
10
|
+
"version": "f08907b1"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"assets": [
|
|
14
|
+
{
|
|
15
|
+
"url": "https://gitlab.com/exploit-database/exploitdb/-/raw/f08907b131f851c2ec3c052906f82ca83703ebef/searchsploit",
|
|
16
|
+
"path": "exploitdb/searchsploit",
|
|
17
|
+
"sha256": "16efc27312c6d3d9ea1be6e24ebc187e811c0606a33e52e80f1cbaabab77845f",
|
|
18
|
+
"executable": true
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"url": "https://gitlab.com/exploit-database/exploitdb/-/raw/f08907b131f851c2ec3c052906f82ca83703ebef/.searchsploit_rc",
|
|
22
|
+
"path": "exploitdb/.searchsploit_rc",
|
|
23
|
+
"sha256": "a06c057c1bd2ce5c1ca42d04e1fe0b43127c9ba7dffeabc491681e5bf7ddad6c",
|
|
24
|
+
"executable": false
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"url": "https://gitlab.com/exploit-database/exploitdb/-/raw/f08907b131f851c2ec3c052906f82ca83703ebef/files_exploits.csv",
|
|
28
|
+
"path": "exploitdb/files_exploits.csv",
|
|
29
|
+
"sha256": "10f31864b85c342c8a777a0248227dcd1e11ae50b246fcfa8bb8051bdc151062",
|
|
30
|
+
"executable": false
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"url": "https://gitlab.com/exploit-database/exploitdb/-/raw/f08907b131f851c2ec3c052906f82ca83703ebef/files_shellcodes.csv",
|
|
34
|
+
"path": "exploitdb/files_shellcodes.csv",
|
|
35
|
+
"sha256": "d458fe46dff2144fa0a6f9ea5dcaa185f881b90d7ef5117740abb4ad5c2beb92",
|
|
36
|
+
"executable": false
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"url": "https://gitlab.com/exploit-database/exploitdb/-/raw/f08907b131f851c2ec3c052906f82ca83703ebef/LICENSE.md",
|
|
40
|
+
"path": "exploitdb/LICENSE.md",
|
|
41
|
+
"sha256": "8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643",
|
|
42
|
+
"executable": false
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"debs": [
|
|
46
|
+
{
|
|
47
|
+
"package": "libonig5",
|
|
48
|
+
"version": "6.9.9-1+b1",
|
|
49
|
+
"url": "https://deb.debian.org/debian/pool/main/libo/libonig/libonig5_6.9.9-1%2bb1_amd64.deb",
|
|
50
|
+
"sha256": "3abee130696244050500bcc7870e3b4cb82ddd87149ece3fd55010c3d4e1d18c",
|
|
51
|
+
"format": "deb"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"package": "libjq1",
|
|
55
|
+
"version": "1.7.1-6+deb13u4",
|
|
56
|
+
"url": "https://deb.debian.org/debian-security/pool/updates/main/j/jq/libjq1_1.7.1-6%2bdeb13u4_amd64.deb",
|
|
57
|
+
"sha256": "70bb2cbd66d5ada4349067ae9f61d0560b3b359d4203f2c051ca5773153ae0ba",
|
|
58
|
+
"format": "deb"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"package": "jq",
|
|
62
|
+
"version": "1.7.1-6+deb13u4",
|
|
63
|
+
"url": "https://deb.debian.org/debian-security/pool/updates/main/j/jq/jq_1.7.1-6%2bdeb13u4_amd64.deb",
|
|
64
|
+
"sha256": "7350392f700e20e46b7ae174a57f54e4ea106dd559753646d629b4e618bf2bff",
|
|
65
|
+
"format": "deb"
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"executables": [
|
|
69
|
+
"searchsploit"
|
|
70
|
+
],
|
|
71
|
+
"runtime": {
|
|
72
|
+
"enableInternet": false,
|
|
73
|
+
"vcpu": 1,
|
|
74
|
+
"memoryMib": 512,
|
|
75
|
+
"diskMb": 3000
|
|
76
|
+
},
|
|
77
|
+
"files": false,
|
|
78
|
+
"dataRevision": "f08907b131f851c2ec3c052906f82ca83703ebef",
|
|
79
|
+
"referenceFiles": {
|
|
80
|
+
"searchsploit": "exploitdb/searchsploit",
|
|
81
|
+
".searchsploit_rc": "exploitdb/.searchsploit_rc",
|
|
82
|
+
"files_exploits.csv": "exploitdb/files_exploits.csv",
|
|
83
|
+
"files_shellcodes.csv": "exploitdb/files_shellcodes.csv",
|
|
84
|
+
"LICENSE.md": "exploitdb/LICENSE.md"
|
|
85
|
+
},
|
|
86
|
+
"links": {
|
|
87
|
+
"searchsploit": "/opt/exploitdb/searchsploit"
|
|
88
|
+
}
|
|
89
|
+
}
|