@memrov2/pentcloud-service 0.0.0-stage → 0.1.1-dev.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 +19 -2
- package/THIRD_PARTY_NOTICES.md +9 -0
- package/package.json +36 -4
- package/src/index.d.mts +12 -0
- package/src/index.mjs +108 -0
- package/src/worker.d.mts +14 -0
- package/src/worker.mjs +3 -0
- package/tools.lock.json +114 -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,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# PentCloud service
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Nmap, Naabu and Masscan in a separate native Cloudflare runtime. **Version 0.1.0 SDK.** The npm package contains adapter code only. Nmap image redistribution terms still apply.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install @memrov2/pentcloud-service@0.1.0
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
export { ServiceRunner } from '@memrov2/pentcloud-service/worker';
|
|
11
|
+
const runner = env.TOOL.getByName(runId);
|
|
12
|
+
try {
|
|
13
|
+
const result = await runner.run({tool:'nmap',target:'192.0.2.1',ports:[443]});
|
|
14
|
+
// Save the result in your existing private assessment store.
|
|
15
|
+
} finally {
|
|
16
|
+
await runner.stop();
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
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,9 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
The original PentCloud adapter source and type declarations in this npm SDK are MIT licensed. The tarball includes pin metadata, but no third-party tool executables, source archives, datasets or container images.
|
|
4
|
+
|
|
5
|
+
- Nmap 7.95: [Nmap Public Source License 0.95](https://svn.nmap.org/nmap-releases/nmap-7.95/LICENSE). The selected Debian distribution also carries its package copyright metadata; image redistribution requires review of the applicable terms.
|
|
6
|
+
- Naabu 2.7.0: [MIT](https://github.com/projectdiscovery/naabu/blob/v2.7.0/LICENSE.md).
|
|
7
|
+
- Masscan 1.3.2: [AGPLv3](https://github.com/robertdavidgraham/masscan/blob/1.3.2/LICENSE).
|
|
8
|
+
|
|
9
|
+
Upstream programs, data and image dependencies retain their own licenses and notices. Image builders preserve those notices. Building or distributing a separate image requires compliance with its components' terms; this adapter SDK grants no additional rights to them. Image-specific cautions in `tools.lock.json` remain in effect.
|
package/package.json
CHANGED
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memrov2/pentcloud-service",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1-dev.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"description": "Cloudflare-native service tool pack",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/Memrov/PentCloud-tools.git",
|
|
10
|
+
"directory": "packages/service"
|
|
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.1-dev.0"
|
|
37
|
+
}
|
|
38
|
+
}
|
package/src/index.d.mts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ToolCommand, PackLock } from "@memrov2/pentcloud-tool-runtime";
|
|
2
|
+
export type PackRequest =
|
|
3
|
+
| { tool: "nmap" | "naabu"; target: string; ports: number[] }
|
|
4
|
+
| {
|
|
5
|
+
tool: "masscan";
|
|
6
|
+
target: string;
|
|
7
|
+
ports: number[];
|
|
8
|
+
adapter?: string;
|
|
9
|
+
routerMac?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const lock: PackLock;
|
|
12
|
+
export declare function buildCommand(input: PackRequest): ToolCommand;
|
package/src/index.mjs
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import lock from "../tools.lock.json" with { type: "json" };
|
|
2
|
+
export { lock };
|
|
3
|
+
export function buildCommand(input) {
|
|
4
|
+
if (
|
|
5
|
+
!input ||
|
|
6
|
+
Object.keys(input).some(
|
|
7
|
+
(k) => !["tool", "target", "ports", "adapter", "routerMac"].includes(k),
|
|
8
|
+
) ||
|
|
9
|
+
!["nmap", "naabu", "masscan"].includes(input.tool)
|
|
10
|
+
)
|
|
11
|
+
throw new TypeError("Unsupported service request");
|
|
12
|
+
const host = input.target;
|
|
13
|
+
if (
|
|
14
|
+
typeof host !== "string" ||
|
|
15
|
+
!/^\d{1,3}(?:\.\d{1,3}){3}$/.test(host) ||
|
|
16
|
+
host.split(".").some((n) => Number(n) > 255 || String(Number(n)) !== n)
|
|
17
|
+
)
|
|
18
|
+
throw new TypeError("Select one explicit IPv4 address from recon results");
|
|
19
|
+
if (
|
|
20
|
+
!Array.isArray(input.ports) ||
|
|
21
|
+
!input.ports.length ||
|
|
22
|
+
input.ports.length > 16 ||
|
|
23
|
+
input.ports.some((p) => !Number.isInteger(p) || p < 1 || p > 65535)
|
|
24
|
+
)
|
|
25
|
+
throw new TypeError("Select one to sixteen explicit ports");
|
|
26
|
+
if (
|
|
27
|
+
input.tool !== "masscan" &&
|
|
28
|
+
(input.adapter !== undefined || input.routerMac !== undefined)
|
|
29
|
+
)
|
|
30
|
+
throw new TypeError("Adapter settings belong to Masscan");
|
|
31
|
+
if (
|
|
32
|
+
input.adapter !== undefined &&
|
|
33
|
+
(typeof input.adapter !== "string" ||
|
|
34
|
+
!/^[a-zA-Z0-9_.-]{1,15}$/.test(input.adapter))
|
|
35
|
+
)
|
|
36
|
+
throw new TypeError("Invalid network interface");
|
|
37
|
+
if (
|
|
38
|
+
input.routerMac !== undefined &&
|
|
39
|
+
(typeof input.routerMac !== "string" ||
|
|
40
|
+
!/^(?:[a-f0-9]{2}:){5}[a-f0-9]{2}$/i.test(input.routerMac))
|
|
41
|
+
)
|
|
42
|
+
throw new TypeError("Invalid router MAC");
|
|
43
|
+
const ports = [...new Set(input.ports)].sort((a, b) => a - b).join(",");
|
|
44
|
+
let args;
|
|
45
|
+
if (input.tool === "nmap")
|
|
46
|
+
args = [
|
|
47
|
+
"-sT",
|
|
48
|
+
"-Pn",
|
|
49
|
+
"-n",
|
|
50
|
+
"--max-retries",
|
|
51
|
+
"0",
|
|
52
|
+
"--max-rate",
|
|
53
|
+
"2",
|
|
54
|
+
"--host-timeout",
|
|
55
|
+
"30s",
|
|
56
|
+
"--open",
|
|
57
|
+
"-oX",
|
|
58
|
+
"-",
|
|
59
|
+
"-p",
|
|
60
|
+
ports,
|
|
61
|
+
host,
|
|
62
|
+
];
|
|
63
|
+
else if (input.tool === "naabu")
|
|
64
|
+
args = [
|
|
65
|
+
"-host",
|
|
66
|
+
host,
|
|
67
|
+
"-p",
|
|
68
|
+
ports,
|
|
69
|
+
"-s",
|
|
70
|
+
"CONNECT",
|
|
71
|
+
"-rate",
|
|
72
|
+
"2",
|
|
73
|
+
"-c",
|
|
74
|
+
"1",
|
|
75
|
+
"-retries",
|
|
76
|
+
"1",
|
|
77
|
+
"-timeout",
|
|
78
|
+
"1000",
|
|
79
|
+
"-verify",
|
|
80
|
+
"-json",
|
|
81
|
+
"-silent",
|
|
82
|
+
"-duc",
|
|
83
|
+
"-no-stdin",
|
|
84
|
+
];
|
|
85
|
+
else {
|
|
86
|
+
if (!/^\d+\.\d+\.\d+\.\d+$/.test(host))
|
|
87
|
+
throw new TypeError("Masscan requires one IPv4 address");
|
|
88
|
+
args = [
|
|
89
|
+
host + "/32",
|
|
90
|
+
"-p" + ports,
|
|
91
|
+
"--rate",
|
|
92
|
+
"2",
|
|
93
|
+
"--wait",
|
|
94
|
+
"2",
|
|
95
|
+
"--retries",
|
|
96
|
+
"0",
|
|
97
|
+
"-oJ",
|
|
98
|
+
"-",
|
|
99
|
+
];
|
|
100
|
+
if (input.adapter) args.push("--adapter", input.adapter);
|
|
101
|
+
if (input.routerMac) args.push("--router-mac", input.routerMac);
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
argv: ["/opt/pentcloud-service/bin/" + input.tool, ...args],
|
|
105
|
+
stdin: "",
|
|
106
|
+
timeoutMs: 75000,
|
|
107
|
+
};
|
|
108
|
+
}
|
package/src/worker.d.mts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
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 ServiceRunner extends DurableObject {
|
|
5
|
+
ready(): Promise<{ image: string; instance: "lite"; readyMs: number }>;
|
|
6
|
+
run(input: PackRequest): Promise<ToolResult>;
|
|
7
|
+
retire(): Promise<{ stopped: boolean; retired: true }>;
|
|
8
|
+
stop(): Promise<{ stopped: boolean }>;
|
|
9
|
+
capabilities(): Promise<{
|
|
10
|
+
platform: string;
|
|
11
|
+
architecture: string;
|
|
12
|
+
rawPacketSocket: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
package/src/worker.mjs
ADDED
package/tools.lock.json
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"packId": "service",
|
|
4
|
+
"packVersion": "0.1.0",
|
|
5
|
+
"platform": "linux/amd64",
|
|
6
|
+
"baseImage": "docker.io/library/debian@sha256:a72b4433de1cf7d6bae0c4cee74d0547f58601a643b3375f070c51600d63b6b2",
|
|
7
|
+
"tools": [
|
|
8
|
+
{
|
|
9
|
+
"tool": "nmap",
|
|
10
|
+
"version": "7.95"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"tool": "masscan",
|
|
14
|
+
"version": "1.3.2"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"tool": "naabu",
|
|
18
|
+
"version": "v2.7.0",
|
|
19
|
+
"url": "https://github.com/projectdiscovery/naabu/releases/download/v2.7.0/naabu_2.7.0_linux_amd64.zip",
|
|
20
|
+
"format": "zip",
|
|
21
|
+
"member": "naabu",
|
|
22
|
+
"sha256": "0cc77c0ca32d2f519ffbaa7665bb0e7c88c40753ab22f03551d453a1a823e9f0",
|
|
23
|
+
"binarySha256": "34b22eb195238380947792e9c83f4276d2182871df1842d2eb927db0659e6276"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"assets": [],
|
|
27
|
+
"debs": [
|
|
28
|
+
{
|
|
29
|
+
"package": "libblas3",
|
|
30
|
+
"version": "3.12.1-6",
|
|
31
|
+
"url": "https://deb.debian.org/debian/pool/main/l/lapack/libblas3_3.12.1-6_amd64.deb",
|
|
32
|
+
"sha256": "4af245ecafc30bfa1de9d20af02fec96654ead2f06b1dac40cb03fc9eb0bfbe6",
|
|
33
|
+
"format": "deb"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"package": "libdbus-1-3",
|
|
37
|
+
"version": "1.16.2-2",
|
|
38
|
+
"url": "https://deb.debian.org/debian/pool/main/d/dbus/libdbus-1-3_1.16.2-2_amd64.deb",
|
|
39
|
+
"sha256": "bbcb711daff7e104b5f80f9b05475b6142674bfe65518a36a56e96a91068a3f5",
|
|
40
|
+
"format": "deb"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"package": "liblinear4",
|
|
44
|
+
"version": "2.3.0+dfsg-5+b2",
|
|
45
|
+
"url": "https://deb.debian.org/debian/pool/main/libl/liblinear/liblinear4_2.3.0%2bdfsg-5%2bb2_amd64.deb",
|
|
46
|
+
"sha256": "10a58649cab30f1671ea605372db284d1e0d67929c45568f2a6a8d52b805b643",
|
|
47
|
+
"format": "deb"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"package": "liblua5.4-0",
|
|
51
|
+
"version": "5.4.7-1+b2",
|
|
52
|
+
"url": "https://deb.debian.org/debian/pool/main/l/lua5.4/liblua5.4-0_5.4.7-1%2bb2_amd64.deb",
|
|
53
|
+
"sha256": "3456e23667f21a5bea4f2182ec878621bf4c47fbc9819fdaad8835d6d1ee6247",
|
|
54
|
+
"format": "deb"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"package": "libpcap0.8t64",
|
|
58
|
+
"version": "1.10.5-2",
|
|
59
|
+
"url": "https://deb.debian.org/debian/pool/main/libp/libpcap/libpcap0.8t64_1.10.5-2_amd64.deb",
|
|
60
|
+
"sha256": "6a756d536a5b0cd3ef92f19ff9f22ed80c66baadbc0fe55d599f4aa0c27d3f86",
|
|
61
|
+
"format": "deb"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"package": "libssh2-1t64",
|
|
65
|
+
"version": "1.11.1-1+deb13u2",
|
|
66
|
+
"url": "https://deb.debian.org/debian/pool/main/libs/libssh2/libssh2-1t64_1.11.1-1%2bdeb13u2_amd64.deb",
|
|
67
|
+
"sha256": "dbb1024c192d4d292b7cfa902b96076cfe81b56a5eed4fb28da36e8bf543e49a",
|
|
68
|
+
"format": "deb"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"package": "nmap-common",
|
|
72
|
+
"version": "7.95+dfsg-3",
|
|
73
|
+
"url": "https://deb.debian.org/debian/pool/main/n/nmap/nmap-common_7.95%2bdfsg-3_all.deb",
|
|
74
|
+
"sha256": "a24ae027e9f819fa11bf04224d09da0a3a5686ba8af347432a19657e89af42b4",
|
|
75
|
+
"format": "deb"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"package": "nmap",
|
|
79
|
+
"version": "7.95+dfsg-3",
|
|
80
|
+
"url": "https://deb.debian.org/debian/pool/main/n/nmap/nmap_7.95%2bdfsg-3_amd64.deb",
|
|
81
|
+
"sha256": "517b1c7558b7c1e7bc095fc7ed73432a26bff46e527a8fde9fea9289c9c1ee98",
|
|
82
|
+
"format": "deb"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"package": "masscan",
|
|
86
|
+
"version": "2:1.3.2+ds1-2",
|
|
87
|
+
"url": "https://deb.debian.org/debian/pool/main/m/masscan/masscan_1.3.2%2bds1-2_amd64.deb",
|
|
88
|
+
"sha256": "860f0d0175ca4b3b3ae8fc34aa7a873bcde34c1a0ceec1e4651cb9241d58850f",
|
|
89
|
+
"format": "deb"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"executables": [
|
|
93
|
+
"nmap",
|
|
94
|
+
"masscan",
|
|
95
|
+
"naabu"
|
|
96
|
+
],
|
|
97
|
+
"runtime": {
|
|
98
|
+
"enableInternet": true,
|
|
99
|
+
"vcpu": 1,
|
|
100
|
+
"memoryMib": 512,
|
|
101
|
+
"diskMb": 3000
|
|
102
|
+
},
|
|
103
|
+
"files": false,
|
|
104
|
+
"links": {
|
|
105
|
+
"nmap": "/usr/bin/nmap",
|
|
106
|
+
"masscan": "/usr/bin/masscan"
|
|
107
|
+
},
|
|
108
|
+
"filesystemLinks": {
|
|
109
|
+
"usr/lib/x86_64-linux-gnu/libblas.so.3": "blas/libblas.so.3"
|
|
110
|
+
},
|
|
111
|
+
"privateOnlyReasons": [
|
|
112
|
+
"Nmap NPSL redistribution requires review before public image publication"
|
|
113
|
+
]
|
|
114
|
+
}
|