minor refactor of system plugin
This commit is contained in:
parent
ae3b4e75f1
commit
ff46ffd5d1
|
@ -61,10 +61,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// install endpwn
|
// install endpwn
|
||||||
var o = fs.existsSync(data + '/settings.json') ? JSON.parse(fs.readFileSync(data + '/settings.json', 'utf8')) : {}; // load settings.json
|
var o = fs.existsSync(data + '/settings.json') ? JSON.parse(fs.readFileSync(data + '/settings.json', 'utf8')) : {}; // load settings.json
|
||||||
o['WEBAPP_ENDPOINT'] = location.href.split('?')[0] + '?'; // aim the app at stage 0
|
o['WEBAPP_ENDPOINT'] = location.href.split('?')[0] + '?'; // aim the app at stage 0
|
||||||
o['WEBAPP_PATH'] = undefined; // clear old WEBAPP_PATH
|
o['WEBAPP_PATH'] = undefined; // clear old WEBAPP_PATH
|
||||||
fs.writeFileSync(data + '/settings.json', JSON.stringify(o, null, 2)); // commit changes to disk
|
fs.writeFileSync(data + '/settings.json', JSON.stringify(o, null, 2)); // commit changes to disk
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// reverse asarpwn3
|
// reverse asarpwn3
|
||||||
|
@ -85,7 +85,6 @@
|
||||||
|
|
||||||
function load() {
|
function load() {
|
||||||
var branch = require('path').basename(data).substr(7);
|
var branch = require('path').basename(data).substr(7);
|
||||||
//win.loadURL('https://' + (branch && branch != 'development' ? branch + '.' : '') + 'discordapp.com/channels/@me');
|
|
||||||
electron.BrowserWindow.addExtension(data + '/crxpwn');
|
electron.BrowserWindow.addExtension(data + '/crxpwn');
|
||||||
electron.getCurrentWindow().loadURL('https://' + (branch && branch != 'development' ? branch + '.' : '') + 'discordapp.com/channels/@me');
|
electron.getCurrentWindow().loadURL('https://' + (branch && branch != 'development' ? branch + '.' : '') + 'discordapp.com/channels/@me');
|
||||||
}
|
}
|
||||||
|
@ -97,13 +96,12 @@
|
||||||
if (!fs.existsSync(data + '/plugins')) fs.mkdirSync(data + '/plugins');
|
if (!fs.existsSync(data + '/plugins')) fs.mkdirSync(data + '/plugins');
|
||||||
|
|
||||||
// dont update EPAPI/CRISPR if DONTUPDATE exists
|
// dont update EPAPI/CRISPR if DONTUPDATE exists
|
||||||
// TODO: make this mess into an async function so we can use await
|
|
||||||
if (!fs.existsSync(data + '/DONTUPDATE')) {
|
if (!fs.existsSync(data + '/DONTUPDATE')) {
|
||||||
|
|
||||||
var crxpwn = await (await fetch(approot + '/crxpwn.js?_=' + Date.now())).text();
|
var crxpwn = await (await fetch(approot + '/crxpwn.js?_=' + Date.now())).text();
|
||||||
fs.writeFileSync(data + '/crxpwn/payload.js', crxpwn);
|
fs.writeFileSync(data + '/crxpwn/payload.js', crxpwn);
|
||||||
|
|
||||||
var epapi = await (await fetch('https://endpwn.github.io/epapi/epapi.js?_=' + Date.now())).text();
|
var epapi = await (await fetch('https://endpwn.github.io/epapi-staging/epapi.js?_=' + Date.now())).text();
|
||||||
fs.writeFileSync(data + '/epapi.js', epapi);
|
fs.writeFileSync(data + '/epapi.js', epapi);
|
||||||
|
|
||||||
var crispr = await (await fetch('https://endpwn.github.io/crispr/crispr.js?_=' + Date.now())).text();
|
var crispr = await (await fetch('https://endpwn.github.io/crispr/crispr.js?_=' + Date.now())).text();
|
||||||
|
|
82
plugin.js
82
plugin.js
|
@ -14,39 +14,21 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __epprint(str) {
|
var internal = {
|
||||||
console.log(`%c[EndPwn3]%c ` + str, 'font-weight:bold;color:#0cc', '');
|
|
||||||
|
print: function (str) {
|
||||||
|
console.log(`%c[EndPwn3]%c ` + str, 'font-weight:bold;color:#0cc', '');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exports = {
|
exports = {
|
||||||
|
|
||||||
preload: function () {
|
preload: function () {
|
||||||
|
|
||||||
// define this with a default value as a fallback
|
|
||||||
window.__goodies = {
|
|
||||||
guilds: [],
|
|
||||||
devs: [],
|
|
||||||
bots: [],
|
|
||||||
users: {}
|
|
||||||
};
|
|
||||||
|
|
||||||
function fetchGoodies() {
|
|
||||||
// fetch goodies.json
|
|
||||||
__epprint('fetching EndPwn Cutomizer data from server...');
|
|
||||||
fetch('https://endpwn.cathoderay.tube/goodies.json?_=' + Date.now())
|
|
||||||
.then(x => x.json())
|
|
||||||
.then(r => window.__goodies = r);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch goodies now and every half hour
|
|
||||||
fetchGoodies();
|
|
||||||
setInterval(fetchGoodies, 1800000);
|
|
||||||
|
|
||||||
window.reload = () => { app.relaunch(); app.exit(); };
|
window.reload = () => { app.relaunch(); app.exit(); };
|
||||||
window.endpwn = {
|
window.endpwn = {
|
||||||
|
|
||||||
__eval: e => eval(e),
|
|
||||||
|
|
||||||
uninstall: function () {
|
uninstall: function () {
|
||||||
$api.ui.showDialog({
|
$api.ui.showDialog({
|
||||||
title: 'EndPwn: confirm uninstallation',
|
title: 'EndPwn: confirm uninstallation',
|
||||||
|
@ -64,21 +46,47 @@ exports = {
|
||||||
|
|
||||||
},
|
},
|
||||||
onCancel: () => console.log('<3')
|
onCancel: () => console.log('<3')
|
||||||
|
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// define this with a default value as a fallback
|
||||||
|
customizer: {
|
||||||
|
|
||||||
|
data: {
|
||||||
|
guilds: [],
|
||||||
|
devs: [],
|
||||||
|
bots: [],
|
||||||
|
users: {}
|
||||||
|
},
|
||||||
|
|
||||||
|
update: function () {
|
||||||
|
// fetch goodies.json
|
||||||
|
internal.print('fetching EndPwn Cutomizer data from server...');
|
||||||
|
fetch('https://endpwn.cathoderay.tube/goodies.json?_=' + Date.now())
|
||||||
|
.then(x => x.json())
|
||||||
|
.then(r => endpwn.customizer.data = r);
|
||||||
|
},
|
||||||
|
|
||||||
|
hook: function () {
|
||||||
|
endpwn.customizer.hook = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// refetch customizer stuff every half hour
|
||||||
|
setInterval(endpwn.customizer.update, 1800000);
|
||||||
|
|
||||||
// early init payload
|
// early init payload
|
||||||
document.addEventListener('ep-prepared', () => {
|
document.addEventListener('ep-prepared', () => {
|
||||||
|
|
||||||
// disable that obnoxious warning about not pasting shit in the console
|
// disable that obnoxious warning about not pasting shit in the console
|
||||||
__epprint('disabling self xss warning...');
|
internal.print('disabling self xss warning...');
|
||||||
$api.util.findFuncExports('consoleWarning').consoleWarning = e => { };
|
$api.util.findFuncExports('consoleWarning').consoleWarning = e => { };
|
||||||
|
|
||||||
// fuck sentry
|
// fuck sentry
|
||||||
__epprint('fucking sentry...');
|
internal.print('fucking sentry...');
|
||||||
var sentry = wc.findCache('_originalConsoleMethods')[0].exports;
|
var sentry = wc.findCache('_originalConsoleMethods')[0].exports;
|
||||||
window.console = Object.assign(window.console, sentry._originalConsoleMethods); // console
|
window.console = Object.assign(window.console, sentry._originalConsoleMethods); // console
|
||||||
sentry._wrappedBuiltIns.forEach(x => x[0][x[1]] = x[2]); // other stuff
|
sentry._wrappedBuiltIns.forEach(x => x[0][x[1]] = x[2]); // other stuff
|
||||||
|
@ -86,7 +94,7 @@ exports = {
|
||||||
sentry.captureBreadcrumb = () => { }; // disable breadcrumb logging
|
sentry.captureBreadcrumb = () => { }; // disable breadcrumb logging
|
||||||
|
|
||||||
// fetch the changelog
|
// fetch the changelog
|
||||||
__epprint('injecting changelog...');
|
internal.print('injecting changelog...');
|
||||||
fetch('https://endpwn.github.io/changelog.md?_=' + Date.now()).then(r => r.text()).then(l => {
|
fetch('https://endpwn.github.io/changelog.md?_=' + Date.now()).then(r => r.text()).then(l => {
|
||||||
|
|
||||||
// we're racing discord's initialization procedures; try and hit a timing sweetspot
|
// we're racing discord's initialization procedures; try and hit a timing sweetspot
|
||||||
|
@ -129,15 +137,15 @@ exports = {
|
||||||
start: function () {
|
start: function () {
|
||||||
|
|
||||||
// disable analytics
|
// disable analytics
|
||||||
__epprint('disabling analytics...');
|
internal.print('disabling analytics...');
|
||||||
$api.util.findFuncExports("AnalyticEventConfigs").default.track = () => { };
|
$api.util.findFuncExports("AnalyticEventConfigs").default.track = () => { };
|
||||||
|
|
||||||
// enable experiments
|
// enable experiments
|
||||||
__epprint('enabling experiments menu...');
|
internal.print('enabling experiments menu...');
|
||||||
$api.util.findFuncExports('isDeveloper').__defineGetter__('isDeveloper', () => true);
|
$api.util.findFuncExports('isDeveloper').__defineGetter__('isDeveloper', () => true);
|
||||||
|
|
||||||
// apply custom discrims/bot tags/badges/server verif from EndPwn Customizer (endpwn.cathoderay.tube)
|
// apply custom discrims/bot tags/badges/server verif from EndPwn Customizer (endpwn.cathoderay.tube)
|
||||||
__epprint('initializing EndPwn Cutomizer...');
|
internal.print('initializing EndPwn Cutomizer...');
|
||||||
|
|
||||||
// add the endpwn dev badge to the class obfuscation table
|
// add the endpwn dev badge to the class obfuscation table
|
||||||
wc.findFunc('profileBadges:"profileBadges')[0].exports['profileBadgeEndpwn'] = 'profileBadgeEndPwn';
|
wc.findFunc('profileBadges:"profileBadges')[0].exports['profileBadgeEndpwn'] = 'profileBadgeEndPwn';
|
||||||
|
@ -156,16 +164,16 @@ exports = {
|
||||||
|
|
||||||
if (x === undefined || x === null) return;
|
if (x === undefined || x === null) return;
|
||||||
|
|
||||||
if (__goodies.bots.contains(x.id)) x.bot = true;
|
if (endpwn.customizer.data.bots.contains(x.id)) x.bot = true;
|
||||||
if (__goodies.users[x.id] !== undefined) x.discriminator = __goodies.users[x.id];
|
if (endpwn.customizer.data.users[x.id] !== undefined) x.discriminator = endpwn.customizer.data.users[x.id];
|
||||||
if (__goodies.devs.contains(x.id)) x.flags += x.flags & 4096 ? 0 : 4096;
|
if (endpwn.customizer.data.devs.contains(x.id)) x.flags += x.flags & 4096 ? 0 : 4096;
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// make sure devs' badges actually render
|
// make sure devs' badges actually render
|
||||||
$api.events.hook('USER_PROFILE_MODAL_FETCH_SUCCESS', x => { if (__goodies.devs.contains(x.user.id)) x.user.flags += x.user.flags & 4096 ? 0 : 4096; })
|
$api.events.hook('USER_PROFILE_MODAL_FETCH_SUCCESS', x => { if (endpwn.customizer.data.devs.contains(x.user.id)) x.user.flags += x.user.flags & 4096 ? 0 : 4096; })
|
||||||
|
|
||||||
// hook getGuild() so we can verify servers
|
// hook getGuild() so we can verify servers
|
||||||
$api.util.wrapAfter(
|
$api.util.wrapAfter(
|
||||||
|
@ -175,7 +183,7 @@ exports = {
|
||||||
|
|
||||||
if (x === undefined || x === null) return;
|
if (x === undefined || x === null) return;
|
||||||
|
|
||||||
if (__goodies.guilds.contains(x.id)) x.features.add('VERIFIED');
|
if (endpwn.customizer.data.guilds.contains(x.id)) x.features.add('VERIFIED');
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +193,7 @@ exports = {
|
||||||
if ($api.lite || !fs.existsSync($api.data + '/DONTUPDATE'))
|
if ($api.lite || !fs.existsSync($api.data + '/DONTUPDATE'))
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
__epprint('checking for EPAPI updates...');
|
internal.print('checking for EPAPI updates...');
|
||||||
|
|
||||||
// fetch the latest build of epapi
|
// fetch the latest build of epapi
|
||||||
fetch('https://endpwn.github.io/epapi/epapi.js?_=' + Date.now()).then(x => x.text()).then(x => {
|
fetch('https://endpwn.github.io/epapi/epapi.js?_=' + Date.now()).then(x => x.text()).then(x => {
|
||||||
|
|
Loading…
Reference in New Issue