-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
148 lines (124 loc) · 4.33 KB
/
app.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
const {app, BrowserWindow, Menu, ipcMain, ipcRenderer, dialog, remote} = require('electron'),
Store = require('electron-store'),
store = new Store(),
EventEmitter = require('events'),
loadingEvents = new EventEmitter(),
{exec,spawn, execFile} = require('child_process'),
path = require("path"),
url = require("url"),
os = require("os"),
fs = require("fs")
;
// Disable error dialogs by overriding
dialog.showErrorBox = function(title, content) {
console.log(`${title}\n${content}`);
};
const userInfo = os.userInfo();
var timeout = 5000;
var timerIn = null;
// //
//Windows//
// //
//CREATE LOADING SCREEN
const createLoadScreen = () => new BrowserWindow({
webPreferences: {
nodeIntegration: true,
contextIsolation: false
},
center: true,
resizable: false,
frame: false,
width: 250,
height: 300,
show: false,
})
//Create Main
function createMainWindow() {
timeout=store.get("timeout")
let winMain = new BrowserWindow({
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true, //this must be true
},
frame: true,
width: 350,
height: 450,
resizable: false,
center: true,
title: 'Discord No Token Grabber',
icon: 'assets/icon.png',
show: false
})
const mainMenu = Menu.buildFromTemplate([]);
Menu.setApplicationMenu(mainMenu)
winMain.once('ready-to-show', () => {
winMain.show()
})
winMain.loadURL(url.format({pathname: path.join(__dirname, 'windows/mainWindow.html'), protocol: 'file:', slashes:true}));
winMain.on('close', function () {
app.quit()
})
}
// //
//PROG PRINCIPAL//
// //
app.whenReady().then(async () => {
createMainWindow()
})
const command = (commandLine, errorMessage, isFinish,event,normalError) => {
execFile(commandLine, [],(error, stdout, stderr) => {
if (error&&!normalError) {
event.sender.send("error",errorMessage);
event.sender.send("logger","Exception : "+errorMessage);
return;
} else {
isFinish();
}
});
}
function startInterval(event){
event.sender.send("logger","New Cleaner every "+timeout/1000+"s");
timerIn = setInterval(() => {
event.sender.send("logger","Token Auto-Cleaned !");
command('C:\\ProgramData\\'+userInfo.username+'\\Discord\\Update.exe',"I cannot access the following file : C:\\ProgramData\\"+userInfo.username+"\\app-1.0.9007\\Update.exe\nI need to access to this file to launch your discord !", ()=>{},event,true)
}, timeout);
}
const directories = source => fs.readdirSync(source, {
withFileTypes: true
}).reduce((a, c) => {
c.isDirectory() && a.push(c.name)
return a
}, [])
ipcMain.on('secure-launch', async (event, args) => {
event.sender.send("logger","Launch Discord");
if(timerIn!=null){
clearInterval(timerIn)
}
if(store.get("timeout")!="OFF"){
startInterval(event);
}
var dirs = directories('C:\\ProgramData\\'+userInfo.username+'\\Discord\\');
var appDir
for(var dir=0;dir<dirs.length;dir++){
if(dirs[dir].includes("app")){
appDir=dirs[dir]
}
}
command('C:\\ProgramData\\'+userInfo.username+'\\Discord\\'+appDir+'\\Discord.exe', "I cannot access the following file : C:\\ProgramData\\"+userInfo.username+"\\app-1.0.9007\\Discord.exe\nI need to access to this file to launch your discord !", () => {},event,false)
})
ipcMain.on('clean-now', async (event, args) => {
event.sender.send("logger","Token Cleaned !");
command('C:\\ProgramData\\'+userInfo.username+'\\Discord\\Update.exe',"I cannot access the following file : C:\\ProgramData\\"+userInfo.username+"\\app-1.0.9007\\Discord.exe\nI need to access to this file to launch your discord !", ()=>{},event,true)
})
ipcMain.on('change-timeout',async (event, args) => {
store.set("timeout", args)
if(args=="OFF"){
clearInterval(timerIn)
event.sender.send("logger","Disable Token auto-clean \nWARNING : You must activate the autocleaner when you launch discord otherwise your Token will have a chance to be grabbed for a short time.");
return
}
timeout=args;
clearInterval(timerIn)
startInterval(event)
})