nox-openclaw-hunter 1.0.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.
Files changed (211) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +140 -0
  3. package/bin/nox.js +2 -0
  4. package/dist/branding.d.ts +39 -0
  5. package/dist/branding.d.ts.map +1 -0
  6. package/dist/branding.js +66 -0
  7. package/dist/branding.js.map +1 -0
  8. package/dist/cli.d.ts +15 -0
  9. package/dist/cli.d.ts.map +1 -0
  10. package/dist/cli.js +94 -0
  11. package/dist/cli.js.map +1 -0
  12. package/dist/commands/export.d.ts +21 -0
  13. package/dist/commands/export.d.ts.map +1 -0
  14. package/dist/commands/export.js +616 -0
  15. package/dist/commands/export.js.map +1 -0
  16. package/dist/commands/index.d.ts +8 -0
  17. package/dist/commands/index.d.ts.map +1 -0
  18. package/dist/commands/index.js +8 -0
  19. package/dist/commands/index.js.map +1 -0
  20. package/dist/commands/isolate.d.ts +30 -0
  21. package/dist/commands/isolate.d.ts.map +1 -0
  22. package/dist/commands/isolate.js +547 -0
  23. package/dist/commands/isolate.js.map +1 -0
  24. package/dist/commands/purge.d.ts +22 -0
  25. package/dist/commands/purge.d.ts.map +1 -0
  26. package/dist/commands/purge.js +295 -0
  27. package/dist/commands/purge.js.map +1 -0
  28. package/dist/commands/scan.d.ts +23 -0
  29. package/dist/commands/scan.d.ts.map +1 -0
  30. package/dist/commands/scan.js +155 -0
  31. package/dist/commands/scan.js.map +1 -0
  32. package/dist/detector/app-bundle.d.ts +13 -0
  33. package/dist/detector/app-bundle.d.ts.map +1 -0
  34. package/dist/detector/app-bundle.js +27 -0
  35. package/dist/detector/app-bundle.js.map +1 -0
  36. package/dist/detector/cli-binary.d.ts +12 -0
  37. package/dist/detector/cli-binary.d.ts.map +1 -0
  38. package/dist/detector/cli-binary.js +66 -0
  39. package/dist/detector/cli-binary.js.map +1 -0
  40. package/dist/detector/config.d.ts +21 -0
  41. package/dist/detector/config.d.ts.map +1 -0
  42. package/dist/detector/config.js +337 -0
  43. package/dist/detector/config.js.map +1 -0
  44. package/dist/detector/detection-config.d.ts +24 -0
  45. package/dist/detector/detection-config.d.ts.map +1 -0
  46. package/dist/detector/detection-config.js +242 -0
  47. package/dist/detector/detection-config.js.map +1 -0
  48. package/dist/detector/docker.d.ts +10 -0
  49. package/dist/detector/docker.d.ts.map +1 -0
  50. package/dist/detector/docker.js +94 -0
  51. package/dist/detector/docker.js.map +1 -0
  52. package/dist/detector/index.d.ts +50 -0
  53. package/dist/detector/index.d.ts.map +1 -0
  54. package/dist/detector/index.js +155 -0
  55. package/dist/detector/index.js.map +1 -0
  56. package/dist/detector/network.d.ts +34 -0
  57. package/dist/detector/network.d.ts.map +1 -0
  58. package/dist/detector/network.js +205 -0
  59. package/dist/detector/network.js.map +1 -0
  60. package/dist/detector/process.d.ts +16 -0
  61. package/dist/detector/process.d.ts.map +1 -0
  62. package/dist/detector/process.js +47 -0
  63. package/dist/detector/process.js.map +1 -0
  64. package/dist/detector/service.d.ts +17 -0
  65. package/dist/detector/service.d.ts.map +1 -0
  66. package/dist/detector/service.js +51 -0
  67. package/dist/detector/service.js.map +1 -0
  68. package/dist/enforcer/docker-cleaner.d.ts +30 -0
  69. package/dist/enforcer/docker-cleaner.d.ts.map +1 -0
  70. package/dist/enforcer/docker-cleaner.js +163 -0
  71. package/dist/enforcer/docker-cleaner.js.map +1 -0
  72. package/dist/enforcer/file-remover.d.ts +34 -0
  73. package/dist/enforcer/file-remover.d.ts.map +1 -0
  74. package/dist/enforcer/file-remover.js +137 -0
  75. package/dist/enforcer/file-remover.js.map +1 -0
  76. package/dist/enforcer/index.d.ts +33 -0
  77. package/dist/enforcer/index.d.ts.map +1 -0
  78. package/dist/enforcer/index.js +142 -0
  79. package/dist/enforcer/index.js.map +1 -0
  80. package/dist/enforcer/process-killer.d.ts +18 -0
  81. package/dist/enforcer/process-killer.d.ts.map +1 -0
  82. package/dist/enforcer/process-killer.js +80 -0
  83. package/dist/enforcer/process-killer.js.map +1 -0
  84. package/dist/enforcer/service-stopper.d.ts +23 -0
  85. package/dist/enforcer/service-stopper.d.ts.map +1 -0
  86. package/dist/enforcer/service-stopper.js +95 -0
  87. package/dist/enforcer/service-stopper.js.map +1 -0
  88. package/dist/index.d.ts +6 -0
  89. package/dist/index.d.ts.map +1 -0
  90. package/dist/index.js +10 -0
  91. package/dist/index.js.map +1 -0
  92. package/dist/isolator/firewall.d.ts +25 -0
  93. package/dist/isolator/firewall.d.ts.map +1 -0
  94. package/dist/isolator/firewall.js +114 -0
  95. package/dist/isolator/firewall.js.map +1 -0
  96. package/dist/isolator/index.d.ts +63 -0
  97. package/dist/isolator/index.d.ts.map +1 -0
  98. package/dist/isolator/index.js +201 -0
  99. package/dist/isolator/index.js.map +1 -0
  100. package/dist/isolator/lockdown.d.ts +22 -0
  101. package/dist/isolator/lockdown.d.ts.map +1 -0
  102. package/dist/isolator/lockdown.js +401 -0
  103. package/dist/isolator/lockdown.js.map +1 -0
  104. package/dist/isolator/quarantine.d.ts +39 -0
  105. package/dist/isolator/quarantine.d.ts.map +1 -0
  106. package/dist/isolator/quarantine.js +364 -0
  107. package/dist/isolator/quarantine.js.map +1 -0
  108. package/dist/mdm/index.d.ts +93 -0
  109. package/dist/mdm/index.d.ts.map +1 -0
  110. package/dist/mdm/index.js +414 -0
  111. package/dist/mdm/index.js.map +1 -0
  112. package/dist/mdm/intune.d.ts +69 -0
  113. package/dist/mdm/intune.d.ts.map +1 -0
  114. package/dist/mdm/intune.js +409 -0
  115. package/dist/mdm/intune.js.map +1 -0
  116. package/dist/mdm/jamf.d.ts +58 -0
  117. package/dist/mdm/jamf.d.ts.map +1 -0
  118. package/dist/mdm/jamf.js +441 -0
  119. package/dist/mdm/jamf.js.map +1 -0
  120. package/dist/mdm/jumpcloud.d.ts +73 -0
  121. package/dist/mdm/jumpcloud.d.ts.map +1 -0
  122. package/dist/mdm/jumpcloud.js +470 -0
  123. package/dist/mdm/jumpcloud.js.map +1 -0
  124. package/dist/mdm/templates/detect.ps1.d.ts +30 -0
  125. package/dist/mdm/templates/detect.ps1.d.ts.map +1 -0
  126. package/dist/mdm/templates/detect.ps1.js +463 -0
  127. package/dist/mdm/templates/detect.ps1.js.map +1 -0
  128. package/dist/mdm/templates/detect.sh.d.ts +30 -0
  129. package/dist/mdm/templates/detect.sh.d.ts.map +1 -0
  130. package/dist/mdm/templates/detect.sh.js +474 -0
  131. package/dist/mdm/templates/detect.sh.js.map +1 -0
  132. package/dist/mdm/templates/enforce.ps1.d.ts +33 -0
  133. package/dist/mdm/templates/enforce.ps1.d.ts.map +1 -0
  134. package/dist/mdm/templates/enforce.ps1.js +681 -0
  135. package/dist/mdm/templates/enforce.ps1.js.map +1 -0
  136. package/dist/mdm/templates/enforce.sh.d.ts +33 -0
  137. package/dist/mdm/templates/enforce.sh.d.ts.map +1 -0
  138. package/dist/mdm/templates/enforce.sh.js +591 -0
  139. package/dist/mdm/templates/enforce.sh.js.map +1 -0
  140. package/dist/platform/darwin.d.ts +6 -0
  141. package/dist/platform/darwin.d.ts.map +1 -0
  142. package/dist/platform/darwin.js +192 -0
  143. package/dist/platform/darwin.js.map +1 -0
  144. package/dist/platform/index.d.ts +43 -0
  145. package/dist/platform/index.d.ts.map +1 -0
  146. package/dist/platform/index.js +27 -0
  147. package/dist/platform/index.js.map +1 -0
  148. package/dist/platform/linux.d.ts +6 -0
  149. package/dist/platform/linux.d.ts.map +1 -0
  150. package/dist/platform/linux.js +134 -0
  151. package/dist/platform/linux.js.map +1 -0
  152. package/dist/platform/windows.d.ts +6 -0
  153. package/dist/platform/windows.d.ts.map +1 -0
  154. package/dist/platform/windows.js +134 -0
  155. package/dist/platform/windows.js.map +1 -0
  156. package/dist/reporter/console.d.ts +27 -0
  157. package/dist/reporter/console.d.ts.map +1 -0
  158. package/dist/reporter/console.js +431 -0
  159. package/dist/reporter/console.js.map +1 -0
  160. package/dist/reporter/index.d.ts +11 -0
  161. package/dist/reporter/index.d.ts.map +1 -0
  162. package/dist/reporter/index.js +13 -0
  163. package/dist/reporter/index.js.map +1 -0
  164. package/dist/reporter/json.d.ts +61 -0
  165. package/dist/reporter/json.d.ts.map +1 -0
  166. package/dist/reporter/json.js +75 -0
  167. package/dist/reporter/json.js.map +1 -0
  168. package/dist/reporter/webhook.d.ts +57 -0
  169. package/dist/reporter/webhook.d.ts.map +1 -0
  170. package/dist/reporter/webhook.js +230 -0
  171. package/dist/reporter/webhook.js.map +1 -0
  172. package/dist/types/config.d.ts +116 -0
  173. package/dist/types/config.d.ts.map +1 -0
  174. package/dist/types/config.js +6 -0
  175. package/dist/types/config.js.map +1 -0
  176. package/dist/types/detection.d.ts +85 -0
  177. package/dist/types/detection.d.ts.map +1 -0
  178. package/dist/types/detection.js +5 -0
  179. package/dist/types/detection.js.map +1 -0
  180. package/dist/types/enforcement.d.ts +33 -0
  181. package/dist/types/enforcement.d.ts.map +1 -0
  182. package/dist/types/enforcement.js +5 -0
  183. package/dist/types/enforcement.js.map +1 -0
  184. package/dist/types/index.d.ts +8 -0
  185. package/dist/types/index.d.ts.map +1 -0
  186. package/dist/types/index.js +8 -0
  187. package/dist/types/index.js.map +1 -0
  188. package/dist/types/isolation.d.ts +55 -0
  189. package/dist/types/isolation.d.ts.map +1 -0
  190. package/dist/types/isolation.js +5 -0
  191. package/dist/types/isolation.js.map +1 -0
  192. package/dist/utils/exec.d.ts +48 -0
  193. package/dist/utils/exec.d.ts.map +1 -0
  194. package/dist/utils/exec.js +103 -0
  195. package/dist/utils/exec.js.map +1 -0
  196. package/dist/utils/fs.d.ts +34 -0
  197. package/dist/utils/fs.d.ts.map +1 -0
  198. package/dist/utils/fs.js +111 -0
  199. package/dist/utils/fs.js.map +1 -0
  200. package/dist/utils/index.d.ts +7 -0
  201. package/dist/utils/index.d.ts.map +1 -0
  202. package/dist/utils/index.js +7 -0
  203. package/dist/utils/index.js.map +1 -0
  204. package/dist/utils/logger.d.ts +14 -0
  205. package/dist/utils/logger.d.ts.map +1 -0
  206. package/dist/utils/logger.js +48 -0
  207. package/dist/utils/logger.js.map +1 -0
  208. package/docs/intune.md +390 -0
  209. package/docs/jamf.md +400 -0
  210. package/docs/jumpcloud.md +510 -0
  211. package/package.json +65 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-killer.d.ts","sourceRoot":"","sources":["../../src/enforcer/process-killer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGjE;;GAEG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,OAAe,EACvB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,iBAAiB,CAAC,CA2B5B;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,OAAe,GACtB,OAAO,CAAC,iBAAiB,EAAE,CAAC,CA8B9B;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,WAAW,EAAE,EACxB,MAAM,GAAE,OAAe,GACtB,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAgB9B"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Process killer for terminating OpenClaw processes.
3
+ */
4
+ import { logger } from '../utils/logger.js';
5
+ /**
6
+ * Kill a single process by PID.
7
+ */
8
+ export async function killProcess(platform, pid, dryRun = false, processName) {
9
+ const targetLabel = processName ? `${processName} (PID ${pid})` : `PID ${pid}`;
10
+ const action = {
11
+ type: 'kill-process',
12
+ target: targetLabel,
13
+ status: 'pending',
14
+ dryRun,
15
+ };
16
+ if (dryRun) {
17
+ logger.info(`[dry-run] Would kill process: ${targetLabel}`);
18
+ action.status = 'skipped';
19
+ return action;
20
+ }
21
+ try {
22
+ await platform.killProcess(pid);
23
+ logger.success(`Killed process: ${targetLabel}`);
24
+ action.status = 'success';
25
+ }
26
+ catch (err) {
27
+ const message = err instanceof Error ? err.message : String(err);
28
+ logger.error(`Failed to kill process ${targetLabel}: ${message}`);
29
+ action.status = 'failed';
30
+ action.error = message;
31
+ }
32
+ return action;
33
+ }
34
+ /**
35
+ * Kill all processes matching a given name.
36
+ */
37
+ export async function killProcessesByName(platform, name, dryRun = false) {
38
+ const actions = [];
39
+ try {
40
+ const processes = await platform.findProcesses(name);
41
+ if (processes.length === 0) {
42
+ logger.info(`No processes found matching: ${name}`);
43
+ return actions;
44
+ }
45
+ logger.info(`Found ${processes.length} process(es) matching: ${name}`);
46
+ for (const proc of processes) {
47
+ const action = await killProcess(platform, proc.pid, dryRun, proc.name);
48
+ actions.push(action);
49
+ }
50
+ }
51
+ catch (err) {
52
+ const message = err instanceof Error ? err.message : String(err);
53
+ logger.error(`Failed to find processes matching ${name}: ${message}`);
54
+ actions.push({
55
+ type: 'kill-process',
56
+ target: name,
57
+ status: 'failed',
58
+ error: message,
59
+ dryRun,
60
+ });
61
+ }
62
+ return actions;
63
+ }
64
+ /**
65
+ * Kill all OpenClaw-related processes from detection results.
66
+ */
67
+ export async function killDetectedProcesses(platform, processes, dryRun = false) {
68
+ const actions = [];
69
+ if (processes.length === 0) {
70
+ logger.info('No OpenClaw processes detected to kill');
71
+ return actions;
72
+ }
73
+ logger.info(`Killing ${processes.length} detected OpenClaw process(es)...`);
74
+ for (const proc of processes) {
75
+ const action = await killProcess(platform, proc.pid, dryRun, proc.name);
76
+ actions.push(action);
77
+ }
78
+ return actions;
79
+ }
80
+ //# sourceMappingURL=process-killer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-killer.js","sourceRoot":"","sources":["../../src/enforcer/process-killer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,oBA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OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,WAAW,SAAS,CAAC,MAAM,mCAAmC,CAAC,CAAC;IAE5E,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACxE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Service stopper for stopping and disabling OpenClaw services.
3
+ */
4
+ import type { Platform } from '../platform/index.js';
5
+ import type { EnforcementAction } from '../types/enforcement.js';
6
+ import type { ServiceDetection } from '../types/detection.js';
7
+ /**
8
+ * Stop a service by name.
9
+ */
10
+ export declare function stopService(platform: Platform, serviceName: string, dryRun?: boolean): Promise<EnforcementAction>;
11
+ /**
12
+ * Disable a service from starting on boot.
13
+ */
14
+ export declare function disableService(platform: Platform, serviceName: string, dryRun?: boolean): Promise<EnforcementAction>;
15
+ /**
16
+ * Stop and disable the OpenClaw gateway service.
17
+ */
18
+ export declare function stopAndDisableService(platform: Platform, serviceName: string, dryRun?: boolean): Promise<EnforcementAction[]>;
19
+ /**
20
+ * Stop the detected OpenClaw service.
21
+ */
22
+ export declare function stopDetectedService(platform: Platform, service: ServiceDetection, dryRun?: boolean): Promise<EnforcementAction[]>;
23
+ //# sourceMappingURL=service-stopper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-stopper.d.ts","sourceRoot":"","sources":["../../src/enforcer/service-stopper.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG9D;;GAEG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,MAAM,EACnB,MAAM,GAAE,OAAe,GACtB,OAAO,CAAC,iBAAiB,CAAC,CAmC5B;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,MAAM,EACnB,MAAM,GAAE,OAAe,GACtB,OAAO,CAAC,iBAAiB,CAAC,CA0B5B;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,MAAM,EACnB,MAAM,GAAE,OAAe,GACtB,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAY9B;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,gBAAgB,EACzB,MAAM,GAAE,OAAe,GACtB,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAkB9B"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Service stopper for stopping and disabling OpenClaw services.
3
+ */
4
+ import { logger } from '../utils/logger.js';
5
+ /**
6
+ * Stop a service by name.
7
+ */
8
+ export async function stopService(platform, serviceName, dryRun = false) {
9
+ const action = {
10
+ type: 'stop-service',
11
+ target: serviceName,
12
+ status: 'pending',
13
+ dryRun,
14
+ };
15
+ if (dryRun) {
16
+ logger.info(`[dry-run] Would stop service: ${serviceName}`);
17
+ action.status = 'skipped';
18
+ return action;
19
+ }
20
+ try {
21
+ // Check if service is running first
22
+ const isRunning = await platform.checkServiceRunning(serviceName);
23
+ if (!isRunning) {
24
+ logger.info(`Service not running: ${serviceName}`);
25
+ action.status = 'skipped';
26
+ return action;
27
+ }
28
+ await platform.stopService(serviceName);
29
+ logger.success(`Stopped service: ${serviceName}`);
30
+ action.status = 'success';
31
+ }
32
+ catch (err) {
33
+ const message = err instanceof Error ? err.message : String(err);
34
+ logger.error(`Failed to stop service ${serviceName}: ${message}`);
35
+ action.status = 'failed';
36
+ action.error = message;
37
+ }
38
+ return action;
39
+ }
40
+ /**
41
+ * Disable a service from starting on boot.
42
+ */
43
+ export async function disableService(platform, serviceName, dryRun = false) {
44
+ const action = {
45
+ type: 'stop-service',
46
+ target: `${serviceName} (disable)`,
47
+ status: 'pending',
48
+ dryRun,
49
+ };
50
+ if (dryRun) {
51
+ logger.info(`[dry-run] Would disable service: ${serviceName}`);
52
+ action.status = 'skipped';
53
+ return action;
54
+ }
55
+ try {
56
+ await platform.disableService(serviceName);
57
+ logger.success(`Disabled service: ${serviceName}`);
58
+ action.status = 'success';
59
+ }
60
+ catch (err) {
61
+ const message = err instanceof Error ? err.message : String(err);
62
+ logger.error(`Failed to disable service ${serviceName}: ${message}`);
63
+ action.status = 'failed';
64
+ action.error = message;
65
+ }
66
+ return action;
67
+ }
68
+ /**
69
+ * Stop and disable the OpenClaw gateway service.
70
+ */
71
+ export async function stopAndDisableService(platform, serviceName, dryRun = false) {
72
+ const actions = [];
73
+ // Stop the service first
74
+ const stopAction = await stopService(platform, serviceName, dryRun);
75
+ actions.push(stopAction);
76
+ // Then disable it from starting on boot
77
+ const disableAction = await disableService(platform, serviceName, dryRun);
78
+ actions.push(disableAction);
79
+ return actions;
80
+ }
81
+ /**
82
+ * Stop the detected OpenClaw service.
83
+ */
84
+ export async function stopDetectedService(platform, service, dryRun = false) {
85
+ const actions = [];
86
+ if (!service.found || !service.name) {
87
+ logger.info('No OpenClaw service detected');
88
+ return actions;
89
+ }
90
+ logger.info(`Stopping OpenClaw service: ${service.name}...`);
91
+ const serviceActions = await stopAndDisableService(platform, service.name, dryRun);
92
+ actions.push(...serviceActions);
93
+ return actions;
94
+ }
95
+ //# sourceMappingURL=service-stopper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-stopper.js","sourceRoot":"","sources":["../../src/enforcer/service-stopper.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO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U,CAAC,CAAC;IAEzB,wCAAwC;IACxC,MAAM,aAAa,GAAG,MAAM,cAAc,CAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IAC1E,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAE5B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,QAAkB,EAClB,OAAyB,EACzB,SAAkB,KAAK;IAEvB,MAAM,OAAO,GAAwB,EAAE,CAAC;IAExC,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpC,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QAC5C,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,8BAA8B,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC;IAE7D,MAAM,cAAc,GAAG,MAAM,qBAAqB,CAChD,QAAQ,EACR,OAAO,CAAC,IAAI,EACZ,MAAM,CACP,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,CAAC;IAEhC,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Nox OpenClaw Detector CLI - Entry point
3
+ * OpenClaw Detection & Enforcement by Nox Security
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Nox OpenClaw Detector CLI - Entry point
3
+ * OpenClaw Detection & Enforcement by Nox Security
4
+ */
5
+ import { run } from './cli.js';
6
+ run().catch((error) => {
7
+ console.error('Fatal error:', error);
8
+ process.exit(2);
9
+ });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACpB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Firewall management for blocking OpenClaw gateway traffic.
3
+ */
4
+ import type { IsolationAction } from '../types/isolation.js';
5
+ import type { Platform } from '../platform/index.js';
6
+ export interface FirewallOptions {
7
+ port?: number;
8
+ dryRun?: boolean;
9
+ }
10
+ /**
11
+ * Block outbound traffic to the OpenClaw gateway port.
12
+ * Requires explicit port - never falls back to default to avoid blocking legitimate services.
13
+ */
14
+ export declare function blockGatewayPort(platform: Platform, options?: FirewallOptions): Promise<IsolationAction>;
15
+ /**
16
+ * Unblock outbound traffic to the OpenClaw gateway port.
17
+ * Requires explicit port - never falls back to default.
18
+ */
19
+ export declare function unblockGatewayPort(platform: Platform, options?: FirewallOptions): Promise<IsolationAction>;
20
+ /**
21
+ * Check if a firewall rule is currently blocking the gateway port.
22
+ * Note: Implementation varies by platform and may require elevated permissions.
23
+ */
24
+ export declare function isPortBlocked(platform: Platform, port?: number): Promise<boolean>;
25
+ //# sourceMappingURL=firewall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firewall.d.ts","sourceRoot":"","sources":["../../src/isolator/firewall.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAMrD,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,QAAQ,EAClB,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,eAAe,CAAC,CAqC1B;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,QAAQ,EAClB,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,eAAe,CAAC,CAqC1B;AAED;;;GAGG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,QAAQ,EAClB,IAAI,GAAE,MAA6B,GAClC,OAAO,CAAC,OAAO,CAAC,CAsBlB"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Firewall management for blocking OpenClaw gateway traffic.
3
+ */
4
+ import { logger } from '../utils/logger.js';
5
+ import { validatePort } from '../utils/exec.js';
6
+ const DEFAULT_GATEWAY_PORT = 18789;
7
+ /**
8
+ * Block outbound traffic to the OpenClaw gateway port.
9
+ * Requires explicit port - never falls back to default to avoid blocking legitimate services.
10
+ */
11
+ export async function blockGatewayPort(platform, options = {}) {
12
+ if (!options.port) {
13
+ const action = {
14
+ type: 'block-port',
15
+ target: 'No port specified',
16
+ status: 'failed',
17
+ error: 'Port must be explicitly specified. Refusing to block default port to avoid blocking legitimate services.',
18
+ };
19
+ logger.error('Port blocking requires explicit port - refusing to use default');
20
+ return action;
21
+ }
22
+ const port = options.port;
23
+ const action = {
24
+ type: 'block-port',
25
+ target: `tcp/${port}`,
26
+ status: 'pending',
27
+ };
28
+ if (options.dryRun) {
29
+ logger.info(`[dry-run] Would block outbound TCP port ${port}`);
30
+ action.status = 'success';
31
+ return action;
32
+ }
33
+ try {
34
+ logger.info(`Blocking outbound TCP port ${port}...`);
35
+ await platform.blockPort(port);
36
+ action.status = 'success';
37
+ logger.success(`Blocked outbound TCP port ${port}`);
38
+ }
39
+ catch (err) {
40
+ action.status = 'failed';
41
+ action.error = err instanceof Error ? err.message : String(err);
42
+ logger.error(`Failed to block port ${port}: ${action.error}`);
43
+ }
44
+ return action;
45
+ }
46
+ /**
47
+ * Unblock outbound traffic to the OpenClaw gateway port.
48
+ * Requires explicit port - never falls back to default.
49
+ */
50
+ export async function unblockGatewayPort(platform, options = {}) {
51
+ if (!options.port) {
52
+ const action = {
53
+ type: 'block-port',
54
+ target: 'No port specified',
55
+ status: 'failed',
56
+ error: 'Port must be explicitly specified for unblocking.',
57
+ };
58
+ logger.error('Port unblocking requires explicit port');
59
+ return action;
60
+ }
61
+ const port = options.port;
62
+ const action = {
63
+ type: 'block-port',
64
+ target: `tcp/${port}`,
65
+ status: 'pending',
66
+ };
67
+ if (options.dryRun) {
68
+ logger.info(`[dry-run] Would unblock outbound TCP port ${port}`);
69
+ action.status = 'success';
70
+ return action;
71
+ }
72
+ try {
73
+ logger.info(`Unblocking outbound TCP port ${port}...`);
74
+ await platform.unblockPort(port);
75
+ action.status = 'success';
76
+ logger.success(`Unblocked outbound TCP port ${port}`);
77
+ }
78
+ catch (err) {
79
+ action.status = 'failed';
80
+ action.error = err instanceof Error ? err.message : String(err);
81
+ logger.error(`Failed to unblock port ${port}: ${action.error}`);
82
+ }
83
+ return action;
84
+ }
85
+ /**
86
+ * Check if a firewall rule is currently blocking the gateway port.
87
+ * Note: Implementation varies by platform and may require elevated permissions.
88
+ */
89
+ export async function isPortBlocked(platform, port = DEFAULT_GATEWAY_PORT) {
90
+ try {
91
+ // Validate port to prevent command injection
92
+ const safePort = validatePort(port);
93
+ const { exec } = await import('../utils/exec.js');
94
+ if (platform.name === 'darwin') {
95
+ // Check our dedicated anchor for blocking rules
96
+ const anchor = 'com.nox.openclaw';
97
+ const { stdout } = await exec(`sudo pfctl -a ${anchor} -sr 2>/dev/null || true`);
98
+ return stdout.includes(`port ${safePort}`) && stdout.includes('block');
99
+ }
100
+ else if (platform.name === 'linux') {
101
+ const { stdout } = await exec(`sudo iptables -L OUTPUT -n 2>/dev/null | grep "${safePort}" || true`);
102
+ return stdout.includes(`${safePort}`) && stdout.includes('DROP');
103
+ }
104
+ else if (platform.name === 'windows') {
105
+ const { stdout } = await exec(`netsh advfirewall firewall show rule name="Nox Block OpenClaw" 2>nul || echo notfound`);
106
+ return !stdout.includes('notfound') && stdout.includes('Block');
107
+ }
108
+ }
109
+ catch {
110
+ // If we can't check, assume not blocked
111
+ }
112
+ return false;
113
+ }
114
+ //# sourceMappingURL=firewall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firewall.js","sourceRoot":"","sources":["../../src/isolator/firewall.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAOnC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,QAAkB,EAClB,UAA2B,EAAE;IAE7B,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAClB,MAAM,MAAM,GAAoB;YAC9B,IAAI,EAAE,YAAY;YAClB,MAAM,EAAE,mBAAmB;YAC3B,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,0GAA0G;SAClH,CAAC;QACF,MAAM,CAAC,KAAK,CAAC,gEAAgE,CAAC,CAAC;QAC/E,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1B,MAAM,MAAM,GAAoB;QAC9B,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,OAAO,IAAI,EAAE;QACrB,MAAM,EAAE,SAAS;KAClB,CAAC;IAEF,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,CAAC,IAAI,CAAC,2CAA2C,IAAI,EAAE,CAAC,CAAC;QAC/D,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC;QAC1B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAA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IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YACrC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,kDAAkD,QAAQ,WAAW,CAAC,CAAC;YACrG,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACnE,CAAC;aAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACvC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,uFAAuF,CAAC,CAAC;YACvH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,wCAAwC;IAC1C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Isolator module - orchestrates firewall, quarantine, and lockdown operations.
3
+ */
4
+ import type { DetectionResult } from '../types/detection.js';
5
+ import type { IsolationResult, IsolateOptions, QuarantineManifest } from '../types/isolation.js';
6
+ export * from './firewall.js';
7
+ export * from './quarantine.js';
8
+ export * from './lockdown.js';
9
+ export interface IsolatorOptions extends IsolateOptions {
10
+ dryRun?: boolean;
11
+ port?: number;
12
+ }
13
+ /**
14
+ * Apply isolation actions based on detection results and options.
15
+ */
16
+ export declare function isolate(detection: DetectionResult, options?: IsolatorOptions): Promise<IsolationResult>;
17
+ /**
18
+ * Remove all isolation measures.
19
+ */
20
+ export declare function unisolate(options?: IsolatorOptions): Promise<IsolationResult>;
21
+ /**
22
+ * Get current isolation status.
23
+ */
24
+ export interface IsolationStatusDetails {
25
+ portBlocked: boolean;
26
+ blockedPort?: number;
27
+ lockdownActive: boolean;
28
+ lockdownPaths?: string[];
29
+ quarantinedItems: number;
30
+ quarantineSummary?: {
31
+ id: string;
32
+ timestamp: string;
33
+ artifactCount: number;
34
+ model?: string;
35
+ channels?: string[];
36
+ }[];
37
+ }
38
+ export declare function getIsolationStatus(): Promise<IsolationStatusDetails>;
39
+ /**
40
+ * Quarantine management utilities.
41
+ */
42
+ export declare const quarantine: {
43
+ /**
44
+ * List all quarantined items.
45
+ */
46
+ list(): Promise<QuarantineManifest[]>;
47
+ /**
48
+ * Restore a quarantined item by ID.
49
+ */
50
+ restore(id: string): Promise<{
51
+ success: boolean;
52
+ restored: number;
53
+ errors: string[];
54
+ }>;
55
+ /**
56
+ * Permanently delete a quarantined item.
57
+ */
58
+ delete(id: string): Promise<{
59
+ success: boolean;
60
+ error?: string;
61
+ }>;
62
+ };
63
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/isolator/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAEV,eAAe,EACf,cAAc,EACd,kBAAkB,EAEnB,MAAM,uBAAuB,CAAC;AAa/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAI9B,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,wBAAsB,OAAO,CAC3B,SAAS,EAAE,eAAe,EAC1B,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,eAAe,CAAC,CA0E1B;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,eAAe,CAAC,CA4BvF;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE;QAClB,EAAE,EAAE,MAAM,CAAC;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,MAAM,CAAC;QACtB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACrB,EAAE,CAAC;CACL;AAED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAgC1E;AAsCD;;GAEG;AACH,eAAO,MAAM,UAAU;IACrB;;OAEG;YACW,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAK3C;;OAEG;gBAEG,MAAM,GACT,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAKpE;;OAEG;eACc,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAIxE,CAAC"}
@@ -0,0 +1,201 @@
1
+ /**
2
+ * Isolator module - orchestrates firewall, quarantine, and lockdown operations.
3
+ */
4
+ import { getPlatform } from '../platform/index.js';
5
+ import { logger } from '../utils/logger.js';
6
+ import { blockGatewayPort, unblockGatewayPort, isPortBlocked } from './firewall.js';
7
+ import { quarantineArtifacts, listQuarantined, restoreQuarantined, deleteQuarantined, } from './quarantine.js';
8
+ import { applyLockdown, removeLockdown, isLockdownActive } from './lockdown.js';
9
+ // Re-export sub-modules for direct access
10
+ export * from './firewall.js';
11
+ export * from './quarantine.js';
12
+ export * from './lockdown.js';
13
+ const DEFAULT_GATEWAY_PORT = 18789;
14
+ /**
15
+ * Apply isolation actions based on detection results and options.
16
+ */
17
+ export async function isolate(detection, options = {}) {
18
+ const platform = getPlatform();
19
+ const actions = [];
20
+ let quarantineResult;
21
+ const shouldBlockPort = options.blockPort || options.all;
22
+ const shouldQuarantine = options.quarantine || options.all;
23
+ const shouldLockdown = options.lockdown || options.all;
24
+ logger.info('Starting isolation procedures...');
25
+ // 1. Block gateway port
26
+ if (shouldBlockPort) {
27
+ // Only block if:
28
+ // 1. Explicit port provided (user knows what they're doing), OR
29
+ // 2. Gateway was actually detected AND we know the port
30
+ // NEVER fall back to default port - could block legitimate services!
31
+ if (options.port) {
32
+ // User explicitly specified a port - proceed
33
+ const action = await blockGatewayPort(platform, {
34
+ port: options.port,
35
+ dryRun: options.dryRun,
36
+ });
37
+ actions.push(action);
38
+ }
39
+ else if (detection.gateway.found && detection.gateway.port) {
40
+ // Gateway was detected - safe to block
41
+ const action = await blockGatewayPort(platform, {
42
+ port: detection.gateway.port,
43
+ dryRun: options.dryRun,
44
+ });
45
+ actions.push(action);
46
+ }
47
+ else {
48
+ // No gateway detected and no explicit port - skip blocking
49
+ logger.warn('Skipping port block: No OpenClaw gateway detected. Use --port <port> to block a specific port.');
50
+ actions.push({
51
+ type: 'block-port',
52
+ target: 'No gateway detected',
53
+ status: 'failed',
54
+ error: 'Gateway not detected - refusing to block default port to avoid blocking legitimate services',
55
+ });
56
+ }
57
+ }
58
+ // 2. Quarantine artifacts
59
+ if (shouldQuarantine) {
60
+ const { action, result } = await quarantineArtifacts(platform, detection, {
61
+ dryRun: options.dryRun,
62
+ });
63
+ actions.push(action);
64
+ quarantineResult = result;
65
+ }
66
+ // 3. Apply lockdown
67
+ if (shouldLockdown) {
68
+ const lockdownActions = await applyLockdown(platform, {
69
+ dryRun: options.dryRun,
70
+ });
71
+ actions.push(...lockdownActions);
72
+ }
73
+ // Log summary
74
+ const successful = actions.filter((a) => a.status === 'success').length;
75
+ const failed = actions.filter((a) => a.status === 'failed').length;
76
+ if (failed === 0) {
77
+ logger.success(`Isolation complete: ${successful} action(s) successful`);
78
+ }
79
+ else {
80
+ logger.warn(`Isolation complete: ${successful} successful, ${failed} failed`);
81
+ }
82
+ return {
83
+ actions,
84
+ quarantine: quarantineResult,
85
+ };
86
+ }
87
+ /**
88
+ * Remove all isolation measures.
89
+ */
90
+ export async function unisolate(options = {}) {
91
+ const platform = getPlatform();
92
+ const actions = [];
93
+ const shouldUnblockPort = options.blockPort || options.all;
94
+ const shouldRemoveLockdown = options.lockdown || options.all;
95
+ logger.info('Removing isolation measures...');
96
+ // 1. Unblock gateway port
97
+ if (shouldUnblockPort) {
98
+ // Note: unisolate doesn't have detection context, so use explicit port or default
99
+ const action = await unblockGatewayPort(platform, {
100
+ port: options.port ?? DEFAULT_GATEWAY_PORT,
101
+ dryRun: options.dryRun,
102
+ });
103
+ actions.push(action);
104
+ }
105
+ // 2. Remove lockdown
106
+ if (shouldRemoveLockdown) {
107
+ const lockdownActions = await removeLockdown(platform, {
108
+ dryRun: options.dryRun,
109
+ });
110
+ actions.push(...lockdownActions);
111
+ }
112
+ return { actions };
113
+ }
114
+ export async function getIsolationStatus() {
115
+ const platform = getPlatform();
116
+ const [portBlocked, lockdownActive, quarantined] = await Promise.all([
117
+ isPortBlocked(platform, DEFAULT_GATEWAY_PORT),
118
+ isLockdownActive(platform),
119
+ listQuarantined(platform),
120
+ ]);
121
+ // Get locked paths if lockdown is active
122
+ let lockdownPaths;
123
+ if (lockdownActive) {
124
+ lockdownPaths = await getLockedPaths(platform);
125
+ }
126
+ // Build quarantine summary
127
+ const quarantineSummary = quarantined.map(q => ({
128
+ id: q.id,
129
+ timestamp: q.timestamp,
130
+ artifactCount: q.artifacts.length,
131
+ model: q.detection?.model,
132
+ channels: q.detection?.channels,
133
+ }));
134
+ return {
135
+ portBlocked,
136
+ blockedPort: portBlocked ? DEFAULT_GATEWAY_PORT : undefined,
137
+ lockdownActive,
138
+ lockdownPaths,
139
+ quarantinedItems: quarantined.length,
140
+ quarantineSummary: quarantineSummary.length > 0 ? quarantineSummary : undefined,
141
+ };
142
+ }
143
+ /**
144
+ * Get list of paths that are currently locked down.
145
+ */
146
+ async function getLockedPaths(platform) {
147
+ const locked = [];
148
+ const { pathExists } = await import('../utils/fs.js');
149
+ const path = await import('node:path');
150
+ // Check CLI paths
151
+ for (const location of platform.getCliLocations()) {
152
+ if (await pathExists(location)) {
153
+ locked.push(location);
154
+ }
155
+ }
156
+ // Check app paths
157
+ for (const location of platform.getAppLocations()) {
158
+ if (await pathExists(location)) {
159
+ locked.push(location);
160
+ }
161
+ }
162
+ // Check for hosts file blocks
163
+ try {
164
+ const { readFile } = await import('node:fs/promises');
165
+ const hosts = await readFile('/etc/hosts', 'utf8');
166
+ if (hosts.includes('# NOX-OPENCLAW-BLOCK')) {
167
+ locked.push('/etc/hosts (domain blocks)');
168
+ }
169
+ }
170
+ catch {
171
+ // Ignore if can't read hosts
172
+ }
173
+ return locked;
174
+ }
175
+ /**
176
+ * Quarantine management utilities.
177
+ */
178
+ export const quarantine = {
179
+ /**
180
+ * List all quarantined items.
181
+ */
182
+ async list() {
183
+ const platform = getPlatform();
184
+ return listQuarantined(platform);
185
+ },
186
+ /**
187
+ * Restore a quarantined item by ID.
188
+ */
189
+ async restore(id) {
190
+ const platform = getPlatform();
191
+ return restoreQuarantined(platform, id);
192
+ },
193
+ /**
194
+ * Permanently delete a quarantined item.
195
+ */
196
+ async delete(id) {
197
+ const platform = getPlatform();
198
+ return deleteQuarantined(platform, id);
199
+ },
200
+ };
201
+ //# sourceMappingURL=index.js.map