Skip to content

Instantly share code, notes, and snippets.

@zatherz
Created August 12, 2017 00:27
Show Gist options
  • Save zatherz/a543ff739c8813052c3f3905095e3517 to your computer and use it in GitHub Desktop.
Save zatherz/a543ff739c8813052c3f3905095e3517 to your computer and use it in GitHub Desktop.
Discord - update-proof (as long as the core method isn't patched) Experiments menu enabler (for video chat and such)
/*
* Based on webcrack by no-boot-device
* https://gist.github.com/no-boot-device/4352a15eb7e13dea61d477ac706751de
*
* Un-minified version of the updated script
*
* Original webcrack made by @[email protected]
* licensed under the MIT license
*
*
* This will search all webpack objects for objects that
* include `isDeveloper`. It'll then pick the last object
* out of the results, get the resource ID, acquire it
* through webpackJsonp and declare a `isDeveloper`
* property on it that always returns true.
*/
// webcrack setup
webpackJsonp([1e3], {
webcrack_ver01_xyzzy: function(n, b, d) {
"use strict";
let mArr = d.m;
let mCac = d.c;
let mCar = [];
Object.keys(mCac).forEach(function(n) {
mCar[n] = mCac[n]
});
let findFunc = function(n) {
"use strict";
let results = [];
if (typeof n == "string") {
mArr.forEach(function(r, t) {
if (-1 !== r.toString().indexOf(n)) {
results.push(mCac[t]);
}
});
} else {
if (typeof n != "function") {
throw new TypeError("findFunc can only find via string and function, " + typeof n + " was passed");
}
modArray.forEach(function(r, e) {
if (n(r)) results.push(t.c[e]);
});
}
return results
}
let findCache = function(n) {
"use strict";
let results = [];
if (typeof n == "function") {
mCar.forEach(function(r, t) {
if (n(r)) results.push(r)
});
} else {
if (typeof n != "string") {
throw new TypeError("findCache can only find via function or string, " + typeof n + " was passed");
}
mCar.forEach(function(r, t) {
if (typeof r.exports == "object") {
for (p in r.exports) {
if (p != n) continue;
results.push(r);
if (p == "default" && typeof r.exports["default"] == "object") {
for (p in r.exports["default"]) {
if (p == n) results.push(r);
}
}
}
}
});
}
return results;
}
window.wc = {
get: d,
modArr: mArr,
modCache: mCac,
modCArr: mCar,
findFunc: findFunc,
findCache: findCache
}
}
});
webpackJsonp([1e3], '', ['webcrack_ver01_xyzzy']);
if (typeof window.wc != "object") {
throw "Webcrack didn't load o.o; was it patched?";
}
// Experiments menu setup
let results = wc.findFunc("isDeveloper");
if (results.length == 0) {
throw "No objects contain isDeveloper, looks like this method was patched :/";
}
let last_id = results[results.length - 1].i;
let target = wc.get(last_id);
// this is where the magic happens
Object.defineProperty(target, "isDeveloper", {
get: function() {
return "b1nzy is a meme";
}
})
// Based on webcrack by no-boot-device https://gist.github.com/no-boot-device/4352a15eb7e13dea61d477ac706751de
// Minified version of the above
webpackJsonp([1e3],{webcrack_ver01_xyzzy:function(n,b,d){"use strict";let mArr=d.m;let mCac=d.c;let mCar=[];Object.keys(mCac).forEach(function(n){mCar[n]=mCac[n]});let findFunc=function(n){"use strict";let results=[];if(typeof n=="string"){mArr.forEach(function(r,t){if(-1!==r.toString().indexOf(n)){results.push(mCac[t])}})}else{if(typeof n!="function"){throw new TypeError("findFunc can only find via string and function, "+typeof n+" was passed")}modArray.forEach(function(r,e){if(n(r)){results.push(t.c[e])}})}return results};let findCache=function(n){"use strict";let results=[];if(typeof n=="function"){mCar.forEach(function(r,t){if(n(r)){results.push(r)}})}else{if(typeof n!="string"){throw new TypeError("findCache can only find via function or string, "+typeof n+" was passed")}mCar.forEach(function(r,t){if(typeof r.exports=="object"){for(p in r.exports){if(p!=n){continue}results.push(r);if(p=="default"&&typeof r.exports["default"]=="object"){for(p in r.exports["default"]){if(p==n){results.push(r)}}}}}})}return results};window.wc={get:d,modArr:mArr,modCache:mCac,modCArr:mCar,findFunc:findFunc,findCache:findCache}}});webpackJsonp([1e3],'',['webcrack_ver01_xyzzy']);if(typeof window.wc!="object"){throw "Webcrack didn't load o.o; was it patched?"}let results=wc.findFunc("isDeveloper");if(results.length==0){throw "No objects contain isDeveloper, looks like this method was patched :/"}let last_id=results[results.length-1].i;let target=wc.get(last_id);Object.defineProperty(target,"isDeveloper",{get:function(){return "b1nzy is a meme"}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment