endpwn3/app/index.html

102 lines
4.9 KiB
HTML
Raw Normal View History

2018-04-18 02:14:17 +00:00
<!--
EndPwn3 Stage 0 Payload
2018-04-19 11:20:17 +00:00
Copyright 2018 EndPwn Project
2018-04-18 02:14:17 +00:00
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.
2018-04-19 04:07:13 +00:00
https://github.com/endpwn/
2018-04-18 02:14:17 +00:00
-->
<html>
<head>
<script>
// wait until DOM is ready so that error messages can display properly
window.onload = () => {
// dont try doing anything if running in a browser
if (navigator.userAgent.indexOf('discord') == -1) return;
try {
// fix for recent canary update
if (typeof (require) == "undefined") {
window.electron = DiscordNative.nativeModules.requireModule("discord_/../electron").remote;
window.require = electron.require;
} else {
window.electron = require('electron').remote;
}
window.fs = require("original-fs");
window.Buffer = require("buffer").Buffer;
2018-04-18 02:14:17 +00:00
2018-04-18 03:01:06 +00:00
var data = electron.app.getPath('userData');
// asarpwn
function asarinject(sig, inj) {
2018-05-03 21:22:38 +00:00
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;
}
2018-04-18 02:57:48 +00:00
// install endpwn
2018-05-05 20:37:39 +00:00
var o = fs.existsSync(data + '/settings.json') ? JSON.parse(fs.readFileSync(data + '/settings.json', 'utf8')) : {}; // load settings.json
2018-05-08 05:28:45 +00:00
o['WEBAPP_ENDPOINT'] = location.href.split('?')[0] + '?'; // aim the app at stage 0
2018-05-08 02:17:42 +00:00
o['WEBAPP_PATH'] = undefined; // clear old WEBAPP_PATH
2018-04-18 03:01:06 +00:00
fs.writeFileSync(data + '/settings.json', JSON.stringify(o, null, 2)); // commit changes to disk
2018-04-18 02:57:48 +00:00
2018-05-03 21:16:30 +00:00
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();
}
2018-05-03 21:21:12 +00:00
} catch (ex) {
alert(ex, 'asarpwn3');
}
2018-04-18 02:14:17 +00:00
// make a window
2018-04-18 02:53:52 +00:00
window.__monitor = new electron.BrowserWindow({ show: false });
2018-04-18 02:14:17 +00:00
// load the monitor
2018-05-08 02:39:26 +00:00
__monitor.loadURL(location.href.substr(0, location.href.indexOf('/app/')) + '/monitor.html?_=' + Date.now());
2018-04-18 02:14:17 +00:00
}
catch (e) {
console.error(e);
document.querySelector('div').parentNode.innerHTML += '<div style="color:#f00">Inititialization failure.</div>';
}
};
</script>
</head>
2018-04-19 04:07:13 +00:00
<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">
2018-04-18 02:14:17 +00:00
<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>
</html>