- Notifications
You must be signed in to change notification settings - Fork1
shidemuri/discord
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
a crappy overview on how to make discord webpack scripts (not betterdiscord scripts but rather actual reverse engineering stuff)
go to%appdata%\discord\settings.json
and add
"DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING":true
to the end of the object, it allows the developer console to be opened with ctrl+shift+i
Alright so:Discord runs mainly on Electron, React and webpack
almost every single discord feature is accessible from the
window.webpackChunkdiscord_app
array, which contains every single webpack functions and stuff that discord relies on
"but hey dude how in the world am i supposed to actually abuse it its jsut a gigantic bunch of [[1231313],{123123213:fafasfasdfsf},()=>{}]"
simple:
window.webpackChunkdiscord_app.push([[Math.random()],{},(req)=>{}])
when pushing this array into the webpackChunk, the(req)=>{}
function will instantly execute
thereq
thing is a function that you can pass a number to it, and it returns an object whose contents may vary a lot
however:
doingreq.c
returns an object with every single function-holding object loaded (which is where all the functions are)it looks something like:
{ NUMERIC_ID:{ exports:{//there may be other object with a random 1-3 letter name such as Z, Plq, ZP or whatever//thats where the functions actually are} id:NUMERIC_ID,//note: passing the id to the `req` function returns the `exports` object//personally, since discord updates a lot i dont rely on using this number because it can update//i just search though the object insteadloaded:true}}
so, for example:
window.webpackChunkdiscord_app.push([[Math.random()],{},(req)=>{for(constthingofreq.c){if(thing.exports.Z.getCurrentUser){returnthing.exports.Z}}}])/*{ commands: {...}, events: {...}, getCurrentUser: f(), //this one is interesting getJoi: f(), onConnect: f(e), onDisconnect: f(e,t), sockets: Set(0) {size: 0}, subscriptions: []}and getCurrentUser returns all the information for your currently logged in user (except for token)*/// and for the token:window.webpackChunkdiscord_app.push([[Math.random()],{},(req)=>{for(constthingofreq.c){if(thing.exports.Z.getToken){returnthing.exports.Z.getToken()}}}])//returns the token :)
There are many snippets out there, i will include some tomorrow, but for now, if you want to further analyze the webpack script source code easily (the discord app one is minified), useDiscord-Datamining
letamongus;window.webpackChunkdiscord_app.push([[Math.random()],{},(a)=>{amongus=a}])Object.values(amongus.c).find(x=>x.exports?.Z?.sendBotMessage).exports.Z.sendBotMessage(window.location.pathname.slice(10).split('/')[1],'mongus balls')
letamongus;window.webpackChunkdiscord_app.push([[Math.random()],{},(a)=>{amongus=a}]);constperms=Object.values(amongus.c).find(x=>x.exports?.Plq).exports.Plq;constchannel=Object.values(amongus.c).find(x=>x.exports?.Z?.getDMChannelFromUserId).exports.Z.getChannel(window.location.pathname.match(/\d+/g)[1])constpiss=Object.values(amongus.c).find(x=>x.exports?.Z?.canAccessGuildSettings).exports.Z.can(perms.EMBED_LINKS,channel)console.log(piss ?'you dont have embed failure big W' :'you have embed failure big LLLLLLLL')
constrepeat=20;constmessage='amongus'letamongus;window.webpackChunkdiscord_app.push([[Math.random()],{},(req)=>{amongus=Object.values(req.c)}])constsend=amongus.find(x=>x.exports?.Z?.sendMessage).exports.Z.sendMessageconstid=window.location.pathname.slice(10).split('/')[1]for(leti=0;i<repeat;i++)send(id,{content:message,invalidEmojis:[],tts:false,validNonShortcutEmojis:[]})
window.webpackChunkdiscord_app.push([[Math.random()],{},async(r)=>{DiscordNative.clipboard.copy(`https://discord.gg/${(awaitObject.values(r.c).find(x=>x.exports?.Z?.createFriendInvite).exports.Z.createFriendInvite()).code}`)}])
window.webpackChunkdiscord_app.push([[Math.random()],{},r=>{Object.values(r.c).find(x=>x.exports?.Z?.startTyping).exports.Z.startTyping=()=>{}}])