Skip to content

Instantly share code, notes, and snippets.

@twilight-sparkle-irl
Last active February 10, 2019 17:18
Show Gist options
  • Save twilight-sparkle-irl/4352a15eb7e13dea61d477ac706751de to your computer and use it in GitHub Desktop.
Save twilight-sparkle-irl/4352a15eb7e13dea61d477ac706751de to your computer and use it in GitHub Desktop.
Updated version of webcrack.js for Discord
// webcrack, a script that allows you to break webpack.js's sandbox and randomization easily
// now updated for discord! (again)
// made by @b@icosahedron.website
// licensed under the MIT license
// window.wc is the webcrack object
// wc.get gives you the module attached to the id you give it.
// literally just what webpack functions use. not much to it
// this is the basic part of all this, everything else is just to allow you to updateproof your code
// both find functions return modules in this format:
// {exports: [can be any type, whatever exports is set to in module],
// id: [number, id of module like those passed to wc.get],
// loaded: [boolean, if false, either try to load or just ignore this module]}
// wc.findFunc allows you to search modules by their constructor source (what you see in the script using webpackJsonp)
// pass a string to search for that string
// (for example, if you know the module you want has "api.example.com/echo" in it, you can pass that string to it to find it)
// pass a function and it will return modules where function(modulefunction) is truthy
// wc.findCache allows you to search modules as loaded in memory.
// pass a function, it will return modules where function(module) is truthy
// pass a string and it will return modules if their exports is an object and has the string as a key
// wc.modArr is the list of module constructors
// wc.modCache is the list of modules as loaded as an object
// wc.modCArr is modCache but as an array
webpackJsonp([1e3],{webcrack_ver01_xyzzy:function(n,b,d){mArr=d.m,mCac=d.c,mCar=[],Object.keys(mCac).forEach(function(n){mCar[n]=mCac[n]}),findFunc=function(n){if(results=[],"string"==typeof n)mArr.forEach(function(r,t){-1!==r.toString().indexOf(n)&&results.push(mCac[t])});else{if("function"!=typeof n)throw new TypeError("findFunc can only find via string and function, "+typeof n+" was passed");modArray.forEach(function(r,e){n(r)&&results.push(t.c[e])})}return results},findCache=function(n){if(results=[],"function"==typeof n)mCar.forEach(function(r,t){n(r)&&results.push(r)});else{if("string"!=typeof n)throw new TypeError("findCache can only find via function or string, "+typeof n+" was passed");mCar.forEach(function(r,t){if("object"==typeof r.exports)for(p in r.exports)if(p==n&&results.push(r),"default"==p&&"object"==typeof r.exports["default"])for(p in r.exports["default"])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'])
@zatherz
Copy link

zatherz commented Aug 12, 2017

Hey, just felt like telling you that I used webcrack here: https://gist.github.com/zatherz/a543ff739c8813052c3f3905095e3517

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment