aiko-chan-ai / discord.js-selfbot-v13

An unofficial discord.js fork for creating selfbots
https://discordjs-self-v13.netlify.app
GNU General Public License v3.0
697 stars 143 forks source link

Unknown Message #1003

Open jikesgonzalez opened 5 months ago

jikesgonzalez commented 5 months ago

Which package has the bugs?

The core library

Issue description

I have tried with various bots in various guilds, but... it does not work. And the worse is that after this, all the tokens became invalid.

Code sample

import Discord from 'discord.js-selfbot-v13';
import Captcha from '2captcha';
const solver = new Captcha.Solver('<removed api key>');
import 'dotenv/config';

const client = new Discord.Client({
    captchaSolver: function (captcha, UA) {
        return solver
            .hcaptcha(captcha.captcha_sitekey, 'discord.com', {
                invisible: 1,
                userAgent: UA,
                data: captcha.captcha_rqdata,
            })
            .then(res => res.data);
    },
    captchaRetryLimit: 3,
    proxy: process.env.PROXY_URL,
});

client.on('debug', console.log)

client.on('ready', async () => {
    console.log('Ready!', client.user.tag);
    await client.acceptInvite('mdmc');
});

client.login('');

Package version

3.0.2

Node.js version

v20.10.0

Operating system

Linux

Priority this issue should have

Medium (should be fixed soon)

Checklist

Additional Information

  Logging on with a user token is unfortunately against the Discord
  `Terms of Service` <https://support.discord.com/hc/en-us/articles/115002192352>
  and doing so might potentially get your account banned.
  Use this at your own risk.

Provided token: MTE3MzIyMDI2Njk2NTQ3OTUzNg.GSsPuv.** Preparing to connect to the gateway... [WS => Manager] Fetched Gateway Information URL: wss://gateway.discord.gg Recommended Shards: 1 [WS => Manager] Session Limit Information Total: Infinity Remaining: Infinity [WS => Manager] Spawning shards: 0 [WS => Shard 0] [CONNECT] Gateway : wss://gateway.discord.gg/ Version : 9 Encoding : json Compression: none Agent : false [WS => Shard 0] Setting a HELLO timeout for 20s. [WS => Shard 0] [CONNECTED] Took 141ms [WS => Shard 0] Clearing the HELLO timeout. [WS => Shard 0] Setting a heartbeat interval for 41250ms. [WS => Shard 0] [IDENTIFY] Shard 0/1 with intents: undefined [WS => Shard 0] [READY] Session 636e7a6f451ca40e10392f8a92988cd0 | Resume url wss://gateway-us-east1-d.discord.gg. [WS => Shard 0] [ReadyHeartbeat] Sending a heartbeat. [USER_REQUIRED_ACTION] All required actions have been completed. [READY] Received 0 guilds, 0 large guilds [WS => Shard 0] Shard received all its guilds. Marking as fully ready. Ready! dreadael [WS => Shard 0] Heartbeat acknowledged, latency of 112ms. /root/joiner/node_modules/discord.js-selfbot-v13/src/rest/RequestHandler.js:390 throw new DiscordAPIError(data, res.status, request); ^

DiscordAPIError: Unknown Message at RequestHandler.execute (/root/joiner/node_modules/discord.js-selfbot-v13/src/rest/RequestHandler.js:390:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async RequestHandler.push (/root/joiner/node_modules/discord.js-selfbot-v13/src/rest/RequestHandler.js:62:14) at async Client.acceptInvite (/root/joiner/node_modules/discord.js-selfbot-v13/src/client/Client.js:557:5) at async Client. (file:///root/joiner/test.mjs:25:2) { method: 'post', path: '/invites/mdmc', code: 10008, httpStatus: 403, requestData: { json: { session_id: '636e7a6f451ca40e10392f8a92988cd0' }, files: [], headers: undefined }, retries: 0, captcha: null }

Node.js v20.10.0

aiko-chan-ai commented 5 months ago

image image

jikesgonzalez commented 5 months ago

but it does not work for me. Mabye the tokens quality?

aiko-chan-ai commented 5 months ago

I think so too, because my tokens are from 2021

jikesgonzalez commented 5 months ago

oh, ill try

VillainsRule commented 5 months ago

i get this error on newer tokens too

aiko-chan-ai commented 5 months ago

try v3.1.3 ;-;

jikesgonzalez commented 5 months ago

yea, it works. manny thanks aiko

marioparaschiv commented 3 months ago

This seems to be happening again on v3.1.4.

(Not my screenshots) image image

marioparaschiv commented 3 months ago

Hey, I've found the cause.

JA3 fingerprinting is causing this. I've collected some documentation which might help. I will keep this comment updated if I find more.

https://medium.com/cu-cyber/impersonating-ja3-fingerprints-b9f555880e42 https://github.com/Danny-Dasilva/CycleTLS

TheDevYellowy commented 3 months ago

I might see if I can add this under a client option and people can see if it works better or worse

marioparaschiv commented 3 months ago

I might see if I can add this under a client option and people can see if it works better or worse

Node.js adds its own ciphers and it's almost impossible to modify the EDCH curve points.

These are the properties we need to modify in order to spoof the JA3 hash. The first one is not a problem, but then we run into issues with ciphers as Node.js adds "TLS_EMPTY_RENEGOTIATION_INFO_SCSV" to the ciphers no matter the override.

image

The only viable option I can think of is to host a TLS server internally and use it through an https agent (example: https://github.com/Arteha/tcp-tls-tunnel)

aiko-chan-ai commented 3 months ago

maybe nodejs will implement it

marioparaschiv commented 3 months ago

Node.js needs OpenSSL to implement it: https://github.com/openssl/openssl/issues/19220#issuecomment-2034562468

marioparaschiv commented 3 months ago

@TheDevYellowy what if we implement cycle-tls only for the invites url path? This could be a solution although it is rather hacky as the API for cycle-tls is different.

marioparaschiv commented 3 months ago

Nevermind, it seems like we have been overcomplicating this.

@aiko-chan-ai Please implement these changes to fix this issue:

    {
        "os": "Windows",
        "browser": "Discord Client",
        "release_channel": "canary",
        "client_version": "1.0.310",
        "os_version": "10.0.22635",
        "os_arch": "x64",
        "app_arch": "x64",
        "system_locale": "en-GB",
        "browser_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) discord/1.0.310 Chrome/120.0.6099.291 Electron/28.2.7 Safari/537.36",
        "browser_version": "28.2.7",
        "client_build_number": 282037,
        "native_build_number": 46216,
        "client_event_source": null
    }

This can be adapted for the stable client. But do keep in mind for future issues opened in this repository from users: If the X-Super-Properties header or websocket properties are overridden to something non-compatible, this issue will come up.

aiko-chan-ai commented 3 months ago

Can u make a pr ?

TheDevYellowy commented 2 months ago

I'll make a function like how discum does where it programmatically makes the X-Super-Properties header in case people want to change the ws.properties option

TheDevYellowy commented 2 months ago

Screenshot 2024-04-06 015437 I lied, we already do it in the APIRequest.js file