Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better discord plugin #357

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft

Better discord plugin #357

wants to merge 9 commits into from

Conversation

victornpb
Copy link
Owner

WIP

@victornpb
Copy link
Owner Author

Work has been paused, I haven't found a way to automatically get the token in the electron app. Might be impossible, so the only resort in that case would be to add the token text field back, and the user have to manually find it and put it there, But it's so much more work to explain that is easier to just tell people to use the web version.

@Flo4604
Copy link
Contributor

Flo4604 commented Mar 7, 2023

so I did some google searching, and found something that works for better discord.

let gg;
let token;

for (let a in window.webpackJsonp ? (gg = window.webpackJsonp.push([
        [], {
            get_require: (a, b, c) => a.exports = c
        },
        [
            ['get_require']
        ]
    ]), delete gg.m.get_require, delete gg.c.get_require) : window.webpackChunkdiscord_app && window.webpackChunkdiscord_app.push([
        [Math.random()], {},
        a => {
            gg = a
        }
    ]), gg.c)
    if (gg.c.hasOwnProperty(a)) {
        let b = gg.c[a].exports;
        if (b && b.__esModule && b.default)
            for (let a in b.default) 'getToken' == a && (token = b.default.getToken())
};

console.log(token);

I can upload the whole plugin code as well if needed, I got the code for getting the token of:
https://github.com/AlexClient/PirateStealer/blob/fef776ed343aa8f1a7c15d01de3f39df72a381b7/src/injection/injection.js#LL757C6-L757C6

@Flo4604
Copy link
Contributor

Flo4604 commented Mar 11, 2023

@victornpb Can I commit the change here, I would use that method to fetch the token for the browser as well.
since the method works in the browser too

Rewritten to

export function getToken() {
  let webpack, token;

  if (window.webpackJsonp) {
    const webpackJsonpArray = window.webpackJsonp.push([
      [],
      {
        get_require: (module, exports, getter) => {
          module.exports = getter;
        },
      },
      [['get_require']],
    ]);
    delete webpackJsonpArray.m.get_require;
    delete webpackJsonpArray.c.get_require;
  } else if (window.webpackChunkdiscord_app) {
    window.webpackChunkdiscord_app.push([
      [Math.random()],
      {},
      (module) => {
        webpack = module;
      },
    ]);
  }

  for (let moduleId in webpack.c) {
    if (Object.prototype.hasOwnProperty.call(webpack.c, moduleId)) {
      const moduleExports = webpack.c[moduleId].exports;
      if (moduleExports && moduleExports.__esModule && moduleExports.default) {
        const defaultExport = moduleExports.default;
        for (let prop in defaultExport) {
          if (prop === 'getToken') {
            token = defaultExport.getToken();
          }
        }
      }
    }
  }

  return token;
}

This should make it more readable, not sure if its 100% correct, but it works in both better discord and the browser.

Seems to be the same like #439

@Flo4604
Copy link
Contributor

Flo4604 commented May 2, 2023

@victornpb any update?

@B1ack3ye
Copy link

Is it working?

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

Successfully merging this pull request may close these issues.

None yet

3 participants