this might actually successfully load epapi

but who knows really
This commit is contained in:
Astra 2018-05-07 23:37:39 -04:00
parent a215681ad8
commit 3e3ca12e10
3 changed files with 101 additions and 10 deletions

View File

@ -20,7 +20,7 @@
<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;
@ -30,7 +30,7 @@
try {
// fix for recent canary update
if (typeof (require) == "undefined") {
if (require === undefined) {
window.electron = DiscordNative.nativeModules.requireModule("discord_/../electron").remote;
window.require = electron.require;
} else {
@ -42,7 +42,7 @@
var data = electron.app.getPath('userData');
// asarpwn
/*// asarpwn
function asarinject(sig, inj) {
var dirlisting = fs.readdirSync(data);
var latestver = dirlisting.filter(d => d.indexOf("0.0.") > -1);
@ -58,7 +58,7 @@
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
@ -87,10 +87,10 @@
//__monitor.loadURL(location.href.substr(0, location.href.indexOf('/app/')) + '/monitor.html?_=' + Date.now());
// grab stage 2
fetch(approot + '/stage2.js?_=' + Date.now()).then(x => x.text()).then(stage2 =>
//fetch(approot + '/stage2.js?_=' + Date.now()).then(x => x.text()).then(stage2 =>
// grab shared
fetch(approot + '/shared.js?_=' + Date.now()).then(x => x.text()).then(shared => {
//fetch(approot + '/shared.js?_=' + Date.now()).then(x => x.text()).then(shared => {
// find the main window
//var win = electron.BrowserWindow.getAllWindows().filter(x => x.getURL().indexOf('monitor') == -1)[0];
@ -148,9 +148,9 @@
setTimeout(load, 1000);
}
})
//})
);
//);
}
catch (e) {

View File

@ -1,2 +1,44 @@
// placeholder payload
console.log('it works');
/*
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 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 EPAPI
var epapi = __krequire('epapi.js');
// call the entrypoint
epapi.go('crxpwn', 0, 1);
})();

49
plugin.js Normal file
View File

@ -0,0 +1,49 @@
/*
EndPwn3 System Plugin
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/
*/
exports = {
start: function () {
window.reload = () => { app.relaunch(); app.exit(); };
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;
$api.settings.set('WEBAPP_ENDPOINT');
$api.settings.set('WEBAPP_PATH');
reload();
},
onCancel: () => console.log('<3')
});
}
};
}
}