Compare commits

..

No commits in common. "4c742c521ea6c79de6778dd43f07e81b6d4ff26b" and "b5f33ede39fe3553a2b5f2c682ea6b0cdcc95ff5" have entirely different histories.

5 changed files with 35 additions and 213 deletions

View File

@ -36,53 +36,20 @@
}
window.fs = require("original-fs");
window.Buffer = require("buffer").Buffer;
var data = electron.app.getPath('userData');
// asarpwn
function asarinject(sig, inj) {
var dirlisting = fs.readdirSync(data);
var latestver = dirlisting.filter(d => d.indexOf("0.0.") > -1);
if (sig.length != inj.length) {
throw 'signature and injection not same size'
}
var bdata = new Buffer(fs.readFileSync(`${data}/${latestver[latestver.length - 1]}/modules/discord_desktop_core/core.asar`));
var index = bdata.indexOf(sig);
if (index == -1) {
return 0;
}
bdata.write(inj, index);
fs.writeFileSync(`${data}/${latestver[latestver.length - 1]}/modules/discord_desktop_core/core.asar`, bdata);
return 1;
}
// install endpwn
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_PATH'] = undefined; // clear old WEBAPP_PATH
var o = JSON.parse(fs.readFileSync(data + '/settings.json', 'utf8')); // load settings.json
o['WEBAPP_ENDPOINT'] = 'https://endpwn.github.io/endpwn3'; // aim the app at stage 0
o['WEBAPP_PATH'] = '/app?_=' + Date.now(); // cache busting
fs.writeFileSync(data + '/settings.json', JSON.stringify(o, null, 2)); // commit changes to disk
try {
// install asarpwn3 for crispr
if (!window.__crisprloaded)
if (asarinject(
"// App preload script, used to provide a replacement native API now that\n// we turned off node integration.\nvar electron = require('electron'",
"var electron=require('electron');var d=electron.remote.app.getPath('userData')+'/crispr.js';if(require('fs').existsSync(d))require(d).go();//"
)) {
electron.app.relaunch();
electron.app.exit();
}
} catch (ex) {
alert(ex, 'asarpwn3');
}
// make a window
window.__monitor = new electron.BrowserWindow({ show: false });
// load the monitor
__monitor.loadURL(location.href.substr(0, location.href.indexOf('/app/')) + '/monitor.html?_=' + Date.now());
__monitor.loadURL('https://endpwn.github.io/endpwn3/monitor.htm?_=' + Date.now());
}
catch (e) {

View File

@ -3,21 +3,15 @@
<head>
<title>EndPwn3</title>
<meta property="og:title" content="EndPwn3" />
<meta property="og:description" content="Instructions for installing EndPwn3" />
<meta property="og:description" content="Copy and paste the following string into your Discord console: DiscordNative.nativeModules.requireModule('discord_/../electron').remote.getCurrentWindow().loadURL('https://endpwn.github.io/endpwn3/app')" />
<meta property="og:image" content="https://endpwn.github.io/sigma.png" />
<script>
function updatePayload(){
document.querySelector('code').innerText=`DiscordNative.nativeModules.requireModule("discord_/../electron").remote.getCurrentWindow().loadURL('${location.href}app')`
}
</script>
</head>
<body style="position:absolute;top:50%;left:50%;transform:translateX(-50%) translateY(-50%);font-family:sans-serif;text-align:center;background-color:#2f3136;color:#ffffff" onload="updatePayload()">
<body style="position:absolute;top:50%;left:50%;transform:translateX(-50%) translateY(-50%);font-family:sans-serif;text-align:center;background-color:#2f3136;color:#ffffff">
<div style="background:linear-gradient(to bottom right,#0ff,#f0f);-webkit-background-clip:text;-webkit-text-fill-color:transparent;font-size:72px;">&Sigma;ndPwn&sup3;</div>
Copy and paste the following string into your Discord console:
<br>
<code>please wait...</code>
<code>DiscordNative.nativeModules.requireModule("discord_/../electron").remote.getCurrentWindow().loadURL('https://endpwn.github.io/endpwn3/app')</code>
<br>
<br> Credit to bootsy for developing the ASAR-less code injection method (bootsyhax)
</body>

View File

@ -40,34 +40,28 @@
win.webContents.executeJavaScript(stage2);
});
function load() {
win.loadURL('https://' + (
navigator.userAgent.indexOf('Discord PTB') > -1 ?
'ptb.' :
navigator.userAgent.indexOf('Discord Canary') > -1 ?
'canary.' :
''
) + 'discordapp.com/channels/@me');
}
// get the data path
var data = electron.app.getPath('userData');
function load() {
var branch = require('path').basename(data).substr(7);
//if (branch != 'canary')
win.loadURL('https://' + (branch && branch != 'development' ? branch + '.' : '') + 'discordapp.com/channels/@me');
//else
//win.loadURL('https://dr1ft.xyz/channels/@me?branch=canary&build=15523'); // emergency, ugly, temp fix
}
// dont update EPAPI/CRISPR if DONTUPDATE exists
// dont update EPAPI if DONTUPDATE exists
if (!fs.existsSync(data + '/DONTUPDATE')) {
// update EPAPI
// grab EPAPI from master
fetch('https://endpwn.github.io/epapi/epapi.js?_=' + Date.now())
.then(r => r.text())
.then(epapi => {
fs.writeFileSync(data + '/epapi.js', epapi);
// update CRISPR
fetch('https://endpwn.github.io/crispr/crispr.js?_=' + Date.now())
.then(r => r.text())
.then(epapi => {
fs.writeFileSync(data + '/crispr.js', epapi);
setTimeout(load, 1000);
});
setTimeout(load, 1000);
});
}

106
shared.js
View File

@ -14,10 +14,6 @@
*/
function __epprint(str) {
console.log(`%c[EndPwn]%c ` + str, 'font-weight:bold;color:#0cc', '');
}
(() => {
// define this with a default value as a fallback
@ -27,35 +23,15 @@ function __epprint(str) {
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 => __goodies = r);
}
// Fetch goodies now and every half hour
fetchGoodies();
setInterval(fetchGoodies, 1800000);
// fetch goodies.json
fetch('https://endpwn.cathoderay.tube/goodies.json?_=' + Date.now())
.then(x => x.json())
.then(r => __goodies = r);
// early init payload
document.addEventListener('ep-prepared', () => {
// disable that obnoxious warning about not pasting shit in the console
__epprint('disabling self xss warning...');
$api.util.findFuncExports('consoleWarning').consoleWarning = e => { };
// fuck sentry
__epprint('fucking sentry...');
var sentry = wc.findCache('_originalConsoleMethods')[0].exports;
window.console = Object.assign(window.console, sentry._originalConsoleMethods); // console
sentry._wrappedBuiltIns.forEach(x => x[0][x[1]] = x[2]); // other stuff
sentry._breadcrumbEventHandler = () => () => { }; // break most event logging
sentry.captureBreadcrumb = () => { }; // disable breadcrumb logging
// fetch the changelog
__epprint('injecting changelog...');
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
@ -91,27 +67,16 @@ function __epprint(str) {
// post-init payload
document.addEventListener('ep-ready', () => {
// disable analytics
__epprint('disabling analytics...');
$api.util.findFuncExports("AnalyticEventConfigs").default.track = () => { };
window.reload = () => { app.relaunch(); app.exit(); };
// enable experiments
__epprint('enabling experiments menu...');
$api.util.findFuncExports('isDeveloper').__defineGetter__('isDeveloper', () => true);
// apply custom discrims/bot tags/badges/server verif from EndPwn Customizer (endpwn.cathoderay.tube)
__epprint('initializing endpwn cutomizer...');
// disable that obnoxious warning about not pasting shit in the console
$api.util.findFuncExports('consoleWarning').consoleWarning = e => { };
// add the endpwn dev badge to the class obfuscation table
wc.findFunc('profileBadges:"profileBadges')[0].exports['profileBadgeEndpwn'] = 'profileBadgeEndPwn';
// apply the css for endpwn dev badges
var badgecss = document.createElement("style");
badgecss.type = "text/css";
badgecss.innerHTML = ".profileBadgeEndPwn{background-image:url(https://dr1ft.xyz/sigma_solid.svg);background-position:center;background-repeat:no-repeat;width:16px;height:16px}";
document.body.appendChild(badgecss);
// hook getUser() so we can apply custom discrims/bot tags/badges
// goodies for people directly associated with the endpwn project, and also kat bc shes my girlfriend
// may be expanded to anyone through a web ui later on
$api.util.wrapAfter(
"wc.findCache('getUser')[0].exports.getUser",
@ -119,15 +84,14 @@ function __epprint(str) {
if (x === undefined || x === null) return;
if (__goodies.bots.includes(x.id)) x.bot = true;
if (__goodies.bots.contains(x.id)) x.bot = true;
if (__goodies.users[x.id] !== undefined) x.discriminator = __goodies.users[x.id];
if (__goodies.devs.includes(x.id)) x.flags += x.flags & 4096 ? 0 : 4096;
return x;
}
);
// hook getGuild() so we can verify servers
// verify servers directly associated with the endpwn project
$api.util.wrapAfter(
"wc.findCache('getGuild')[0].exports.getGuild",
@ -135,56 +99,12 @@ function __epprint(str) {
if (x === undefined || x === null) return;
if (__goodies.guilds.includes(x.id)) x.features.add('VERIFIED');
if (__goodies.guilds.contains(x.id)) x.features.add('VERIFIED');
return x;
}
);
// check for epapi updates
if ($api.lite || !fs.existsSync($api.data + '/DONTUPDATE'))
(function () {
__epprint('checking for EPAPI updates...');
// fetch the latest build of epapi
fetch('https://endpwn.github.io/epapi/epapi.js?_=' + Date.now()).then(x => x.text()).then(x => {
// check the version
if (kparse(x).version > $api.version) {
// if the version on the server is newer, pester the user
$api.ui.showDialog({
title: 'EndPwn3: EPAPI Update Available',
body: 'An update to EPAPI has been released. It is recommended that you restart your client in order to gain access to new features and maintain compatibility.',
confirmText: 'Restart Now', cancelText: 'Later',
// user pressed "Restart Now"
onConfirm: () => {
// refresh the page if we're running in a browser, reboot the app if we're running outside of lite mode
reload();
},
// they pressed "Later", for some reason
onCancel: () => {
// bother them again in 6 hrs (* 60 min * 60 sec * 1000 ms)
setTimeout(arguments.callee, 6 * 60 * 60 * 1000);
}
});
}
else setTimeout(arguments.callee, 6 * 60 * 60 * 1000);
});
})();
});
})();
})();

View File

@ -17,75 +17,22 @@
(() => {
// abort if we're not currently in the discord app
if (location.hostname.indexOf('discordapp') == -1 && location.hostname.indexOf('dr1ft.xyz') == -1) return;
// use the discord native api to require electron and get electron.remote
var electron = DiscordNative.nativeModules.requireModule('discord_/../electron').remote;
var fs = electron.require('original-fs');
// get the data path (where epapi.js should be)
var ___data = electron.app.getPath('userData').replace(/\\\\/g, "/") + '/';
var data = electron.app.getPath('userData').replace(/\\\\/g, "/") + '/';
// shakily reimplemented of require() intended for loading plugins and EPAPI itself
function __krequire(path) {
return eval('(()=>{var exports={};' + fs.readFileSync(___data + path, 'utf8').toString() + ';return exports})()');
return eval('(()=>{var exports={};' + fs.readFileSync(data + path, 'utf8').toString() + ';return exports})()');
}
// load EPAPI
var epapi = __krequire('epapi.js');
// add window.reload()
window.reload = () => { electron.app.relaunch(); electron.app.exit(); };
// call the entrypoint
epapi.go('bootsyhax-dr1ft', 0, 1);
window.endpwn = {
uninstall: function () {
$api.ui.showDialog({
title: 'EndPwn: confirm uninstallation',
body: 'Are you sure you want to remove EndPwn from your client? You can reinstall it at any time.',
confirmText: 'Yes', cancelText: 'No',
onConfirm: () => {
var data = $api.data;
const Buffer = require('buffer').Buffer;
// asarpwn
function asarinject(sig, inj) {
var dirlisting = fs.readdirSync(data);
var latestver = dirlisting.filter(d => d.indexOf("0.0.") > -1);
if (sig.length != inj.length) {
throw 'signature and injection not same size'
}
var bdata = new Buffer(fs.readFileSync(`${data}/${latestver[latestver.length - 1]}/modules/discord_desktop_core/core.asar`));
var index = bdata.indexOf(sig);
if (index == -1) {
return 0;
}
bdata.write(inj, index);
fs.writeFileSync(`${data}/${latestver[latestver.length - 1]}/modules/discord_desktop_core/core.asar`, bdata);
return 1;
}
asarinject(
"var electron=require('electron');var d=electron.remote.app.getPath('userData')+'/crispr.js';if(require('fs').existsSync(d))require(d).go();//",
"// App preload script, used to provide a replacement native API now that\n// we turned off node integration.\nvar electron = require('electron'"
);
$api.settings.set('WEBAPP_ENDPOINT');
$api.settings.set('WEBAPP_PATH');
reload();
},
onCancel: () => console.log('<3')
});
}
};
})();