This repository has been archived by the owner on Sep 4, 2021. It is now read-only.
forked from Yuyuko-sama/Xigncode-bypass
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
88 lines (81 loc) · 3.87 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
const fs = require("fs");
const path = require("path");
const { execFileSync } = require('child_process');
const ProcessListener = require("./process-listener");
module.exports = function XigncodeBypass(mod) {
if (['eu', 'na', 'ru'].includes(mod.region)) {
mod.warn(`Not required for region ${mod.region.toUpperCase()}!`);
return;
}
let PatchedProcesses = {};
function HandleAddedProcess(process) {
try {
let XigncodeFolder = path.join(path.dirname(process.path), "XIGNCODE");
PatchedProcesses[process.pid] = XigncodeFolder;
// fs.copyFileSync(path.join(__dirname, "res/x3.xem"), path.join(XigncodeFolder, "x3.xem"));
// fs.copyFileSync(path.join(__dirname, "res/xcorona.xem"), path.join(XigncodeFolder, "xcorona.xem"));
// console.log(`[bypass] Game client (PID ${process.pid}) detected, bypass installed.`);
} catch(e) {
// Ignore errors...
}
}
function HandleRemovedProcess(pid) {
try {
let XigncodeFolder = PatchedProcesses[pid];
fs.copyFileSync(path.join(__dirname, "bak/x3.xem"), path.join(XigncodeFolder, "x3.xem"));
fs.copyFileSync(path.join(__dirname, "bak/xcorona.xem"), path.join(XigncodeFolder, "xcorona.xem"));
delete PatchedProcesses[pid];
console.log(`[bypass] Game client (PID ${pid}) closed, bypass reverted.`);
} catch(e) {
// Ignore errors...
}
}
// Remove vulnerable driver from system
try {
fs.unlinkSync('C:\\Windows\\xhunter1.sys');
mod.log('Traces of a previous xigncode installation have been located and removed from your system!');
mod.log('Note that some registry keys might still remain on your system.');
mod.log(`Check out ${global.TeraProxy.SupportUrl} for instructions on manual removal.`);
} catch(e) {
// Ignore errors...
}
// Inject bypass DLL
try {
execFileSync(path.join(__dirname, 'injector.exe'), [mod.clientInterface.info.pid, path.join(__dirname, 'xigncode-bypass.dll')]);
ProcessListener("TERA.exe", HandleAddedProcess, HandleRemovedProcess, 500);
// console.log("[bypass] Ready, waiting for game client to be started!");
} catch(e) {
mod.error(`Unable to install bypass (PID ${mod.clientInterface.info.pid})!`);
switch (e.code) {
case 'ENOENT': {
mod.error('injector.exe does not exist. It has likely been deleted by your anti-virus.');
mod.error('Disable/uninstall your anti-virus or whitelist TERA Toolbox and injector.exe!');
break;
}
case 'EPERM': {
mod.error('Permission to launch injector.exe denied. It has likely been blocked by your anti-virus.');
mod.error('Disable/uninstall your anti-virus or whitelist TERA Toolbox and injector.exe!');
break;
}
default: {
switch (e.status) {
case 1:
{
mod.error('Bypass DLL injection unsuccessful. It has likely been blocked by your anti-virus.');
mod.error('> Make sure that TERA Toolbox is running with Administrator privileges!');
mod.error('> Disable/uninstall your anti-virus or whitelist TERA Toolbox and injector.exe!');
break;
}
default:
{
mod.error('This is likely caused by your anti-virus interfering. Disable/uninstall it or whitelist TERA Toolbox.');
mod.error('Full error message:');
mod.error(e);
break;
}
}
break;
}
}
}
}