whitzard-claw 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 (91) hide show
  1. package/README.md +89 -0
  2. package/bin/whitzard-tui.js +73 -0
  3. package/bin/whitzard-webui.js +67 -0
  4. package/dist/tui/tui.js +38733 -0
  5. package/dist/webui/index.html +1235 -0
  6. package/dist/webui/server.js +876 -0
  7. package/ioc/c2-ips.txt +25 -0
  8. package/ioc/file-hashes.txt +13 -0
  9. package/ioc/malicious-domains.txt +46 -0
  10. package/ioc/malicious-hashes.txt +5 -0
  11. package/ioc/malicious-publishers.txt +34 -0
  12. package/ioc/malicious-skill-patterns.txt +87 -0
  13. package/package.json +50 -0
  14. package/scripts/check/access_control.sh +183 -0
  15. package/scripts/check/credential_storage.sh +222 -0
  16. package/scripts/check/execution_sandbox.sh +502 -0
  17. package/scripts/check/memory_poisoning.sh +334 -0
  18. package/scripts/check/network_exposure.sh +479 -0
  19. package/scripts/check/resource_cost.sh +182 -0
  20. package/scripts/check/supply_chain.sh +553 -0
  21. package/scripts/repair/access_control/_common.sh +249 -0
  22. package/scripts/repair/access_control/check_1.sh +28 -0
  23. package/scripts/repair/access_control/check_2.sh +27 -0
  24. package/scripts/repair/access_control/check_3.sh +23 -0
  25. package/scripts/repair/access_control/check_4.sh +23 -0
  26. package/scripts/repair/access_control/check_5.sh +20 -0
  27. package/scripts/repair/credential_storage/_common.sh +277 -0
  28. package/scripts/repair/credential_storage/check_1.sh +47 -0
  29. package/scripts/repair/credential_storage/check_2.sh +35 -0
  30. package/scripts/repair/credential_storage/check_3.sh +53 -0
  31. package/scripts/repair/credential_storage/logs/security-scan.log +15 -0
  32. package/scripts/repair/execution_sandbox/_common.sh +302 -0
  33. package/scripts/repair/execution_sandbox/check_1.sh +67 -0
  34. package/scripts/repair/execution_sandbox/check_10.sh +23 -0
  35. package/scripts/repair/execution_sandbox/check_11.sh +34 -0
  36. package/scripts/repair/execution_sandbox/check_12.sh +38 -0
  37. package/scripts/repair/execution_sandbox/check_13.sh +29 -0
  38. package/scripts/repair/execution_sandbox/check_2.sh +46 -0
  39. package/scripts/repair/execution_sandbox/check_3.sh +37 -0
  40. package/scripts/repair/execution_sandbox/check_4.sh +23 -0
  41. package/scripts/repair/execution_sandbox/check_5.sh +28 -0
  42. package/scripts/repair/execution_sandbox/check_6.sh +17 -0
  43. package/scripts/repair/execution_sandbox/check_7.sh +17 -0
  44. package/scripts/repair/execution_sandbox/check_8.sh +17 -0
  45. package/scripts/repair/execution_sandbox/check_9.sh +17 -0
  46. package/scripts/repair/execution_sandbox/logs/security-scan.log +10 -0
  47. package/scripts/repair/memory_poisoning/_common.sh +336 -0
  48. package/scripts/repair/memory_poisoning/check_1.sh +51 -0
  49. package/scripts/repair/memory_poisoning/check_2.sh +26 -0
  50. package/scripts/repair/memory_poisoning/check_3.sh +24 -0
  51. package/scripts/repair/memory_poisoning/check_4.sh +27 -0
  52. package/scripts/repair/memory_poisoning/check_5.sh +20 -0
  53. package/scripts/repair/network_exposure/_common.sh +330 -0
  54. package/scripts/repair/network_exposure/check_1.sh +86 -0
  55. package/scripts/repair/network_exposure/check_10.sh +16 -0
  56. package/scripts/repair/network_exposure/check_11.sh +31 -0
  57. package/scripts/repair/network_exposure/check_12.sh +24 -0
  58. package/scripts/repair/network_exposure/check_2.sh +26 -0
  59. package/scripts/repair/network_exposure/check_3.sh +43 -0
  60. package/scripts/repair/network_exposure/check_4.sh +23 -0
  61. package/scripts/repair/network_exposure/check_5.sh +16 -0
  62. package/scripts/repair/network_exposure/check_6.sh +98 -0
  63. package/scripts/repair/network_exposure/check_7.sh +35 -0
  64. package/scripts/repair/network_exposure/check_8.sh +19 -0
  65. package/scripts/repair/network_exposure/check_9.sh +19 -0
  66. package/scripts/repair/resource_cost/_common.sh +303 -0
  67. package/scripts/repair/resource_cost/check_1.sh +16 -0
  68. package/scripts/repair/resource_cost/check_2.sh +16 -0
  69. package/scripts/repair/resource_cost/check_3.sh +23 -0
  70. package/scripts/repair/supply_chain/_common.sh +222 -0
  71. package/scripts/repair/supply_chain/check_1.sh +95 -0
  72. package/scripts/repair/supply_chain/check_10.sh +60 -0
  73. package/scripts/repair/supply_chain/check_11.sh +63 -0
  74. package/scripts/repair/supply_chain/check_12.sh +36 -0
  75. package/scripts/repair/supply_chain/check_13.sh +44 -0
  76. package/scripts/repair/supply_chain/check_14.sh +33 -0
  77. package/scripts/repair/supply_chain/check_15.sh +33 -0
  78. package/scripts/repair/supply_chain/check_16.sh +34 -0
  79. package/scripts/repair/supply_chain/check_17.sh +61 -0
  80. package/scripts/repair/supply_chain/check_18.sh +62 -0
  81. package/scripts/repair/supply_chain/check_2.sh +93 -0
  82. package/scripts/repair/supply_chain/check_3.sh +78 -0
  83. package/scripts/repair/supply_chain/check_4.sh +72 -0
  84. package/scripts/repair/supply_chain/check_5.sh +73 -0
  85. package/scripts/repair/supply_chain/check_6.sh +81 -0
  86. package/scripts/repair/supply_chain/check_7.sh +52 -0
  87. package/scripts/repair/supply_chain/check_8.sh +71 -0
  88. package/scripts/repair/supply_chain/check_9.sh +78 -0
  89. package/scripts/repair/supply_chain/logs/security-scan.log +77 -0
  90. package/scripts/scan.sh +228 -0
  91. package/webui/index.html +1235 -0
package/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # Whitzard-Claw Security Scanner
2
+
3
+ Whitzard-Claw 是一个基于 OpenClaw 的安全扫描工具,提供 TUI(终端用户界面)和 WebUI(Web 用户界面)两种交互方式。
4
+
5
+ ## 安装
6
+
7
+ ### 从 npm 安装(推荐)
8
+
9
+ ```bash
10
+ npm install -g whitzard-claw
11
+ ```
12
+
13
+ ### 从源码安装
14
+
15
+ ```bash
16
+ # 克隆或下载源码后
17
+ cd whitzard-claw
18
+ npm install
19
+ npm run build
20
+ npm link
21
+ ```
22
+
23
+ ## 使用方法
24
+
25
+ 安装完成后,可以使用以下两个命令:
26
+
27
+ ### 1. TUI 模式(终端界面)
28
+
29
+ ```bash
30
+ claw-tui
31
+ ```
32
+
33
+ **快捷键:**
34
+ - `check` + Enter: 开始安全扫描
35
+ - `Up/Down`: 滚动查看漏洞列表
36
+ - `c`: 进入选择模式(可用空格键切换自动修复选项)
37
+ - `f`: 执行选中的自动修复
38
+ - `Esc`: 退出选择模式
39
+
40
+ ### 2. WebUI 模式(Web 界面)
41
+
42
+ ```bash
43
+ claw-webui
44
+ ```
45
+
46
+ 然后在浏览器中访问:http://localhost:12340
47
+
48
+ ## 配置
49
+
50
+ ### OPENCLAW_HOME 环境变量
51
+
52
+ 设置 OpenClaw 工作目录的路径:
53
+
54
+ ```bash
55
+ export OPENCLAW_HOME=/path/to/your/openclaw
56
+ ```
57
+
58
+ 或在 WebUI 的设置页面中配置。
59
+
60
+ 默认路径为:`~/.openclaw`
61
+
62
+ ## 系统要求
63
+
64
+ - Node.js >= 18.0.0
65
+ - Linux 操作系统(推荐 Ubuntu/Debian)
66
+ - Bash shell
67
+
68
+ ## 功能特性
69
+
70
+ - **7 大类安全检查**:网络暴露、访问控制、执行沙箱、凭证存储、记忆毒化、供应链、资源成本
71
+ - **实时进度显示**:在 TUI 和 WebUI 中实时查看扫描进度
72
+ - **自动修复建议**:对检测到的问题提供修复指导和自动化脚本
73
+ - **IOC 数据支持**:支持自定义 IOC(威胁情报)数据文件
74
+
75
+ ## 目录结构
76
+
77
+ ```
78
+ whitzard-claw/
79
+ ├── bin/ # CLI 命令入口
80
+ ├── dist/ # 编译后的代码
81
+ ├── scripts/ # 扫描和修复脚本
82
+ ├── ioc/ # IOC 威胁情报数据
83
+ ├── webui/ # Web 界面文件
84
+ └── tui/ # TUI 源代码
85
+ ```
86
+
87
+ ## 许可证
88
+
89
+ MIT License
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Whitzard-Claw TUI CLI Entry Point
5
+ * This script dynamically locates the compiled TUI bundle
6
+ */
7
+
8
+ import { fileURLToPath } from 'url';
9
+ import path from 'path';
10
+ import { spawn } from 'child_process';
11
+ import fs from 'fs';
12
+
13
+ if (typeof global.self === 'undefined') {
14
+ global.self = global;
15
+ }
16
+
17
+ const __filename = fileURLToPath(import.meta.url);
18
+ const __dirname = path.dirname(__filename);
19
+
20
+ // Get the package installation directory
21
+ const PACKAGE_DIR = path.resolve(__dirname, '..');
22
+
23
+ // Try to find the compiled TUI in dist/tui/tui.js
24
+ const TUI_PATH = path.join(PACKAGE_DIR, 'dist', 'tui', 'tui.js');
25
+
26
+ // Check if TUI exists
27
+ if (!fs.existsSync(TUI_PATH)) {
28
+ console.error('❌ Error: TUI bundle not found at:', TUI_PATH);
29
+ console.error('');
30
+ console.error('Please run the build process first:');
31
+ console.error(' npm run build');
32
+ console.error('');
33
+ console.error('Or if you installed from npm, please reinstall:');
34
+ console.error(' npm install -g whitzard-claw');
35
+ process.exit(1);
36
+ }
37
+
38
+ // Get scripts directory for reference
39
+ const SCRIPTS_DIR = path.join(PACKAGE_DIR, 'scripts');
40
+
41
+ if (!fs.existsSync(SCRIPTS_DIR)) {
42
+ console.error('❌ Error: Scripts directory not found at:', SCRIPTS_DIR);
43
+ process.exit(1);
44
+ }
45
+
46
+ // Set environment variables for Linux
47
+ const env = {
48
+ ...process.env,
49
+ // Ensure we're using bash
50
+ SHELL: '/bin/bash',
51
+ };
52
+
53
+ // Execute the TUI with tsx or node
54
+ import { createRequire } from 'module';
55
+ const require = createRequire(import.meta.url);
56
+
57
+ // Try to find tsx or use node directly
58
+ let executor = 'node';
59
+ try {
60
+ // Check if tsx is available
61
+ const tsxPath = require.resolve('tsx', { paths: [PACKAGE_DIR] });
62
+ executor = 'node';
63
+ process.argv = ['node', tsxPath, TUI_PATH, ...process.argv.slice(2)];
64
+ } catch (e) {
65
+ // tsx not available, use node directly
66
+ process.argv = ['node', TUI_PATH, ...process.argv.slice(2)];
67
+ }
68
+
69
+ // Import and run the TUI
70
+ import(TUI_PATH).catch(err => {
71
+ console.error('❌ Error running TUI:', err.message);
72
+ process.exit(1);
73
+ });
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Whitzard-Claw WebUI CLI Entry Point
5
+ * This script dynamically locates the server.js and starts the web server
6
+ */
7
+
8
+ import { fileURLToPath } from 'url';
9
+ import path from 'path';
10
+ import fs from 'fs';
11
+
12
+ const __filename = fileURLToPath(import.meta.url);
13
+ const __dirname = path.dirname(__filename);
14
+
15
+ // Get the package installation directory
16
+ const PACKAGE_DIR = path.resolve(__dirname, '..');
17
+
18
+ // Try to find the server in dist/webui/server.js
19
+ const SERVER_PATH = path.join(PACKAGE_DIR, 'dist', 'webui', 'server.js');
20
+ const INDEX_HTML_PATH = path.join(PACKAGE_DIR, 'dist', 'webui', 'index.html');
21
+
22
+ // Check if server exists
23
+ if (!fs.existsSync(SERVER_PATH)) {
24
+ console.error('❌ Error: WebUI server not found at:', SERVER_PATH);
25
+ console.error('');
26
+ console.error('Please run the build process first:');
27
+ console.error(' npm run build');
28
+ console.error('');
29
+ console.error('Or if you installed from npm, please reinstall:');
30
+ console.error(' npm install -g whitzard-claw');
31
+ process.exit(1);
32
+ }
33
+
34
+ if (!fs.existsSync(INDEX_HTML_PATH)) {
35
+ console.error('❌ Error: index.html not found at:', INDEX_HTML_PATH);
36
+ process.exit(1);
37
+ }
38
+
39
+ // Get scripts directory for reference
40
+ const SCRIPTS_DIR = path.join(PACKAGE_DIR, 'scripts');
41
+ const IOC_DIR = path.join(PACKAGE_DIR, 'ioc');
42
+
43
+ if (!fs.existsSync(SCRIPTS_DIR)) {
44
+ console.error('❌ Error: Scripts directory not found at:', SCRIPTS_DIR);
45
+ process.exit(1);
46
+ }
47
+
48
+ // Set environment variables
49
+ const env = {
50
+ ...process.env,
51
+ // Set package directory as environment variable for server to use
52
+ WHITZARD_CLAW_PACKAGE_DIR: PACKAGE_DIR,
53
+ WHITZARD_CLAW_SCRIPTS_DIR: SCRIPTS_DIR,
54
+ WHITZARD_CLAW_IOC_DIR: IOC_DIR,
55
+ };
56
+
57
+ console.log('🛡️ Starting Whitzard-Claw WebUI...');
58
+ console.log(' Package Directory:', PACKAGE_DIR);
59
+ console.log(' Scripts Directory:', SCRIPTS_DIR);
60
+ console.log('');
61
+
62
+ // Import and run the server
63
+ import(SERVER_PATH).catch(err => {
64
+ console.error('❌ Error starting WebUI server:', err.message);
65
+ console.error(err.stack);
66
+ process.exit(1);
67
+ });