move staging to a local branch

git is hard
This commit is contained in:
dr1ft 2018-05-09 19:19:43 -04:00 committed by GitHub
commit a61232697d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 412 additions and 403 deletions

View File

@ -20,15 +20,17 @@
<script>
// wait until DOM is ready so that error messages can display properly
window.onload = () => {
window.onload = async () => {
// dont try doing anything if running in a browser
if (navigator.userAgent.indexOf('discord') == -1) return;
var approot = location.href.split('/app/')[0];
try {
// fix for recent canary update
if (typeof (require) == "undefined") {
if (window.require === undefined) {
window.electron = DiscordNative.nativeModules.requireModule("discord_/../electron").remote;
window.require = electron.require;
} else {
@ -40,7 +42,7 @@
var data = electron.app.getPath('userData');
// asarpwn
// asarpwn (as a removal tool)
function asarinject(sig, inj) {
var dirlisting = fs.readdirSync(data);
var latestver = dirlisting.filter(d => d.indexOf("0.0.") > -1);
@ -59,35 +61,71 @@
}
// 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
fs.writeFileSync(data + '/settings.json', JSON.stringify(o, null, 2)); // commit changes to disk
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
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();
}
// reverse asarpwn3
if (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'"
)) {
electron.app.relaunch();
electron.app.exit();
}
} catch (ex) {
alert(ex, 'asarpwn3');
}
// make a window
window.__monitor = new electron.BrowserWindow({ show: false });
// get the data path
var data = electron.app.getPath('userData');
// load the monitor
__monitor.loadURL(location.href.substr(0, location.href.indexOf('/app/')) + '/monitor.html?_=' + Date.now());
function load() {
var branch = require('path').basename(data).substr(7);
electron.BrowserWindow.addExtension(data + '/crxpwn');
electron.getCurrentWindow().loadURL('https://' + (branch && branch != 'development' ? branch + '.' : '') + 'discordapp.com/channels/@me');
}
if (!fs.existsSync(data + '/crxpwn')) {
fs.mkdirSync(data + '/crxpwn');
fs.writeFileSync(data + '/crxpwn/manifest.json', '{"manifest_version":2,"name":"crxpwn","description":"asarpwn-less preload scripts for the masses ;)","version":"1.0","content_scripts":[{"js":["payload.js"],"matches":["*://*/*"],"run_at":"document_start","all_frames":true}]}');
}
if (!fs.existsSync(data + '/plugins')) fs.mkdirSync(data + '/plugins');
if (!fs.existsSync(data + '/styles')) fs.mkdirSync(data + '/styles');
// dont update EPAPI/CRISPR if DONTUPDATE exists
if (!fs.existsSync(data + '/DONTUPDATE')) {
var crxpwn = await (await fetch(approot + '/crxpwn.js?_=' + Date.now())).text();
fs.writeFileSync(data + '/crxpwn/payload.js', crxpwn);
var epapi = await (await fetch('https://endpwn.github.io/epapi/epapi.js?_=' + Date.now())).text();
fs.writeFileSync(data + '/epapi.js', epapi);
var crispr = await (await fetch('https://endpwn.github.io/crispr/crispr.js?_=' + Date.now())).text();
fs.writeFileSync(data + '/crispr.js', crispr);
var plugin = await (await fetch(approot + '/plugin.js?_=' + Date.now())).text();
fs.writeFileSync(data + '/plugins/system.js', plugin);
var style = await (await fetch(approot + '/helper.css?_=' + Date.now())).text();
fs.writeFileSync(data + '/styles/system.css', style);
setTimeout(load, 1000);
}
else {
setTimeout(load, 1000);
}
}
catch (e) {
console.error(e);
document.querySelector('div').parentNode.innerHTML += '<div style="color:#f00">Inititialization failure.</div>';
document.querySelector('div').parentNode.innerHTML += '<div style="color:#f00">Inititialization failure. Check the console for details.</div>';
}
};

58
crxpwn.js Normal file
View File

@ -0,0 +1,58 @@
/*
EndPwn3 Stage 2 Payload (crxpwn)
Copyright 2018 EndPwn Project
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
https://github.com/endpwn/
*/
(() => {
function __crxprint(str) {
console.log(`%c[crxpwn]%c ` + str, 'font-weight:bold;color:#0cc', '');
}
if (location.hostname.indexOf('discordapp') == -1) return;
__crxprint('extension loaded successfully, loading CRISPR and EPAPI...');
// 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, "/") + '/';
// 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})()');
}
// load CRISPR and EPAPI
var crispr = __krequire('crispr.js');
var epapi = __krequire('epapi.js');
// call their entrypoints
crispr.go();
electron.getCurrentWindow().webContents.on('dom-ready', () => epapi.go({
name: 'EndPwn3',
version: {
major: 3,
minor: 1,
toString: function () {
return `v${this.major}.${this.minor}`;
}
},
method: 'crxpwn',
brand: true
}));
})();

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

31
helper.css Normal file
View File

@ -0,0 +1,31 @@
/*
EndPwn3 System (style component)
Copyright 2018 EndPwn Project
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
https://github.com/endpwn/
*/
/* style declaration for EndPwn developer badge */
.profileBadgeEndPwn {
background-image: url(https://dr1ft.xyz/sigma_solid.svg);
background-position: center;
background-repeat: no-repeat;
width: 16px;
height: 16px;
cursor: pointer
}
/* fix for poor formatting on modified crash screen */
[class*="text-"] [class*="note"] {
line-height: normal !important;
text-align: left !important
}

View File

@ -7,19 +7,45 @@
<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')`
function updatePayload() {
document.querySelector('code').innerText = `DiscordNative.nativeModules.requireModule("discord_/../electron").remote.getCurrentWindow().loadURL('${location.href}app')`
}
</script>
<style>
body {
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
font-family: sans-serif;
text-align: center;
background-color: #2f3136;
color: #ffffff
}
a {
color: #0ff;
}
div {
background: linear-gradient(to bottom right, #0ff, #f0f);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-size: 72px;
}
</style>
</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()">
<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>
<body onload="updatePayload()">
<div>&Sigma;ndPwn&sup3;</div>
Copy and paste the following string into your Discord console:
<br>
<code>please wait...</code>
<br>
<br> Credit to bootsy for developing the ASAR-less code injection method (bootsyhax)
<br>
<b>This is the unstable, staging branch of EndPwn3. Use at your own risk or use the
<a href="https://endpwn.github.io/endpwn3/">stable branch</a> instead.</b>
</body>
</html>

View File

@ -1,96 +0,0 @@
<!--
EndPwn3 Stage 1 Payload
Copyright 2018 EndPwn Project
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
https://github.com/endpwn/
-->
<html>
<head>
<script>
try {
// grab stage 2
fetch('https://endpwn.github.io/endpwn3/stage2.js?_=' + Date.now()).then(x => x.text()).then(stage2 =>
// grab shared
fetch('https://endpwn.github.io/endpwn3/shared.js?_=' + Date.now()).then(x => x.text()).then(shared => {
// the monitor gets node integration; no silly DiscordNative bullshit
var fs = require('original-fs');
var electron = require('electron').remote;
// find the main window
var win = electron.BrowserWindow.getAllWindows().filter(x => x.getURL().indexOf('monitor') == -1)[0];
// inject stage 2 once Discord is done loading
win.webContents.on('dom-ready', () => {
win.webContents.executeJavaScript(shared);
win.webContents.executeJavaScript(stage2);
});
// get the data path
var data = electron.app.getPath('userData');
function load() {
var branch = require('path').basename(data).substr(7);
win.loadURL('https://' + (branch && branch != 'development' ? branch + '.' : '') + 'discordapp.com/channels/@me');
}
// dont update EPAPI/CRISPR if DONTUPDATE exists
if (!fs.existsSync(data + '/DONTUPDATE')) {
// update EPAPI
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);
});
});
}
else {
setTimeout(load, 1000);
}
})
);
}
catch (e) {
console.error(e);
alert(`The monitor encountered an error:\n\n${e}\n\nDiscord may stall here.`, 'EndPwn3: Monitor failure');
load();
}
</script>
</head>
<body>
<!-- i wrote this haiku as an easteregg, but since the source is getting pushed to GitHub it won't be as much of a secret anymore -->
quietly i watch
<br> waiting for the right moment
<br> i ignite the flame
</body>
</html>

233
plugin.js Normal file
View File

@ -0,0 +1,233 @@
/*
EndPwn3 System (script component)
Copyright 2018 EndPwn Project
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
https://github.com/endpwn/
*/
var internal = {
print: function (str) {
console.log(`%c[EndPwn3]%c ` + str, 'font-weight:bold;color:#0cc', '');
}
}
exports = {
preload: function () {
window.reload = () => { app.relaunch(); app.exit(); };
window.endpwn = {
// uninstaller
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;
$api.settings.set('WEBAPP_ENDPOINT');
$api.settings.set('WEBAPP_PATH');
reload();
},
onCancel: () => console.log('<3')
});
},
// endpwn customizer supporting code
customizer: {
// fallback data
data: {
guilds: [],
devs: [],
bots: [],
users: {}
},
update: function () {
// fetch goodies.json
internal.print('fetching EndPwn Customizer data from server...');
fetch('https://endpwn.cathoderay.tube/goodies.json?_=' + Date.now())
.then(x => x.json())
.then(r => endpwn.customizer.data = r);
},
init: function () {
// prevent doublecalling
endpwn.customizer.init = undefined;
// apply custom discrims/bot tags/badges/server verif from EndPwn Customizer (endpwn.cathoderay.tube)
internal.print('initializing EndPwn Customizer...');
// refetch customizer stuff every half hour
setInterval(endpwn.customizer.update, 1800000);
endpwn.customizer.update();
// add the endpwn dev badge to the class obfuscation table
wc.findFunc('profileBadges:"profileBadges')[0].exports['profileBadgeEndpwn'] = 'profileBadgeEndPwn';
// hook getUser() so we can apply custom discrims/bot tags/badges
$api.util.wrapAfter(
"wc.findCache('getUser')[0].exports.getUser",
x => {
if (x === undefined || x === null) return;
if (endpwn.customizer.data.bots.contains(x.id)) x.bot = true;
if (endpwn.customizer.data.users[x.id] !== undefined) x.discriminator = endpwn.customizer.data.users[x.id];
if (endpwn.customizer.data.devs.contains(x.id)) x.flags += x.flags & 4096 ? 0 : 4096;
return x;
}
);
// make sure devs' badges actually render
$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
$api.util.wrapAfter(
"wc.findCache('getGuild')[0].exports.getGuild",
x => {
if (x === undefined || x === null) return;
if (endpwn.customizer.data.guilds.contains(x.id)) x.features.add('VERIFIED');
return x;
}
);
}
}
};
// fetch the changelog
internal.print('retrieving changelog...');
fetch('https://endpwn.github.io/changelog.md?_=' + Date.now()).then(r => r.text()).then(l => {
var data = l.split(';;');
window.endpwn.changelog = {
date: data[0],
body: data[1]
};
});
// early init payload
document.addEventListener('ep-prepared', () => {
// disable that obnoxious warning about not pasting shit in the console
internal.print('disabling self xss warning...');
$api.util.findFuncExports('consoleWarning').consoleWarning = e => { };
// fuck sentry
internal.print('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
});
},
replacements: {
// fix for custom discrims breaking search
//'#([0-9]{4})':
//'#(.{1,4})',
// endpwn dev badges
//'return t.hasFlag(H.UserFlags.STAFF)':
//'return t.hasFlag(4096)&&r.push({tooltip:"EndPwn Developer",onClick:function(){return window.open("https://endpwn.github.io/","_blank")},class:"endpwn"}),t.hasFlag(H.UserFlags.STAFF)'
// changelog injection
'key:"changeLog",get:function(){return E}':
'key:"changeLog",get:function(){if(!E.injected){E.injected=1;E.date=E.date<=window.endpwn.changelog.date?window.endpwn.changelog.date:E.date;E.body=window.endpwn.changelog.body+"\\n\\n"+E.body}return E}',
// crash screen hijack
'var e=o("div",{},void 0,o("p",{},void 0,a.default.Messages.ERRORS_UNEXPECTED_CRASH),o("p",{},void 0,a.default.Messages.ERRORS_ACTION_TO_TAKE)),t=o(c.default,{size:l.ButtonSizes.LARGE,onClick:this._handleSubmitReport},void 0,a.default.Messages.ERRORS_RELOAD);return o(u.default,{theme:this.props.theme,title:a.default.Messages.UNSUPPORTED_BROWSER_TITLE,':
`var e=o("div",{},void 0,o("p",{},void 0,"Something has gone very, very wrong, and Discord has crashed."),o("p",{},void 0,"If this is the first time you've seen this error screen, reload and hope for the best. If this screen appears again, follow these steps:"),o("p",{},void 0,"Try removing any new plugins and restarting again. If this solves the problem there may be a bug in a plugin or a conflict."),o("p",{},void 0,"If problems continue, it's likely that there is a bug in EndPwn or Discord."),o("p",{},void 0,"If you need help, join the EndPwn Discord server (https://discord.gg/wXdPNf2)"),o("p",{},void 0,"Details may be available in the console (Ctrl+Shift+I), but at this level of crash we can't be certain.")),t=o("div",{},void 0,o(c.default,{size:l.ButtonSizes.LARGE,onClick:()=>window.electron.getCurrentWindow().reload()},void 0,"Reload"),o(c.default,{size:l.ButtonSizes.LARGE,onClick:()=>{window.$api.localStorage.set('safemode',1);window.electron.getCurrentWindow().reload()}},void 0,"Reload in safe mode"));return o(u.default,{theme:this.props.theme,title:"Discord: Fatal Error",`
},
start: function () {
// disable analytics
internal.print('disabling analytics...');
$api.util.findFuncExports("AnalyticEventConfigs").default.track = () => { };
// enable experiments
internal.print('enabling experiments menu...');
$api.util.findFuncExports('isDeveloper').__defineGetter__('isDeveloper', () => true);
endpwn.customizer.init();
// check for epapi updates
if ($api.lite || !fs.existsSync($api.data + '/DONTUPDATE'))
(function () {
internal.print('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);
});
})();
}
}

190
shared.js
View File

@ -1,190 +0,0 @@
/*
EndPwn Stage 2 Shared
Copyright 2018 EndPwn Project
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
https://github.com/endpwn/
*/
function __epprint(str) {
console.log(`%c[EndPwn]%c ` + str, 'font-weight:bold;color:#0cc', '');
}
(() => {
// define this with a default value as a fallback
var __goodies = {
guilds: [],
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 => __goodies = r);
}
// Fetch goodies now and every half hour
fetchGoodies();
setInterval(fetchGoodies, 1800000);
// 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
setTimeout(function () {
try {
// get the changelog object
var log = $api.util.findFuncExports('changeLog');
var data = l.split(';;');
// set the date
if (log.changeLog.date <= data[0])
log.changeLog.date = data[0];
// prepend to the changelog body
log.changeLog.body = data[1] + '\n\n' + log.changeLog.body;
}
catch (e) {
// it failed, try again in 10 ms
setTimeout(arguments.callee, 100);
}
}, 100);
});
});
// post-init payload
document.addEventListener('ep-ready', () => {
// disable analytics
__epprint('disabling analytics...');
$api.util.findFuncExports("AnalyticEventConfigs").default.track = () => { };
// 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...');
// 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
$api.util.wrapAfter(
"wc.findCache('getUser')[0].exports.getUser",
x => {
if (x === undefined || x === null) return;
if (__goodies.bots.contains(x.id)) x.bot = true;
if (__goodies.users[x.id] !== undefined) x.discriminator = __goodies.users[x.id];
if (__goodies.devs.contains(x.id)) x.flags += x.flags & 4096 ? 0 : 4096;
return x;
}
);
// hook getGuild() so we can verify servers
$api.util.wrapAfter(
"wc.findCache('getGuild')[0].exports.getGuild",
x => {
if (x === undefined || x === null) return;
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

@ -1,91 +0,0 @@
/*
EndPwn3 Stage 2 Payload
Based on the EndPwn Reference Bootstrap
Copyright 2018 EndPwn Project
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
https://github.com/endpwn/
*/
(() => {
// abort if we're not currently in the discord app
if (location.hostname.indexOf('discordapp') == -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, "/") + '/';
// 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})()');
}
// load EPAPI
var epapi = __krequire('epapi.js');
// add window.reload()
window.reload = () => { app.relaunch(); 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')
});
}
};
})();