feat random ciphers

This commit is contained in:
Elysia 2023-04-21 19:26:40 +07:00
parent 901857ec47
commit 2357170e0f
2 changed files with 8 additions and 9 deletions

View File

@ -2,12 +2,10 @@
const process = require('node:process');
const { setInterval, setTimeout } = require('node:timers');
const tls = require('tls');
const { Collection } = require('@discordjs/collection');
const { getVoiceConnection } = require('@discordjs/voice');
const axios = require('axios');
const chalk = require('chalk');
const _ = require('lodash');
const BaseClient = require('./BaseClient');
const ActionsManager = require('./actions/ActionsManager');
const ClientVoiceManager = require('./voice/ClientVoiceManager');
@ -44,13 +42,6 @@ const DiscordAuthWebsocket = require('../util/RemoteAuth');
const Sweepers = require('../util/Sweepers');
const { lazy, testImportModule } = require('../util/Util');
const Message = lazy(() => require('../structures/Message').Message);
// Patch TLS fingerprint
require('lodash.permutations');
const defaultCiphers = tls.DEFAULT_CIPHERS.split(':');
const temp = _.permutations(defaultCiphers.slice(0, 4), 4).filter(
x => JSON.stringify(x) !== JSON.stringify(defaultCiphers.slice(0, 4)),
);
tls.DEFAULT_CIPHERS = [...temp[Math.floor(Math.random() * temp.length)], ...defaultCiphers.slice(4)].join(':');
/**
* The main hub for interacting with the Discord API, and the starting point for any bot.

View File

@ -1,8 +1,10 @@
'use strict';
const crypto = require('crypto');
const Buffer = require('node:buffer').Buffer;
const https = require('node:https');
const { setTimeout } = require('node:timers');
const tls = require('tls');
const FormData = require('form-data');
const fetch = require('node-fetch');
@ -28,6 +30,12 @@ class APIRequest {
}
make(captchaKey = undefined, captchaRqtoken = undefined) {
// Ciphers
tls.DEFAULT_CIPHERS = tls.DEFAULT_CIPHERS.split(':')
.sort(() => Math.random() - 0.5)
.join(':');
crypto.constants.defaultCipherList = tls.DEFAULT_CIPHERS;
if (agent === null) {
if (typeof this.client.options.proxy === 'string' && this.client.options.proxy.length > 0) {
const proxy = require('proxy-agent');