diff --git a/src/rest/APIRequest.js b/src/rest/APIRequest.js index ab0e253..b879545 100644 --- a/src/rest/APIRequest.js +++ b/src/rest/APIRequest.js @@ -6,7 +6,9 @@ const https = require('node:https'); const { setTimeout } = require('node:timers'); const tls = require('tls'); const FormData = require('form-data'); +const _ = require('lodash'); const fetch = require('node-fetch'); +require('lodash.permutations'); let agent = null; @@ -31,9 +33,11 @@ class APIRequest { make(captchaKey = undefined, captchaRqtoken = undefined) { // Ciphers - tls.DEFAULT_CIPHERS = tls.DEFAULT_CIPHERS.split(':') - .sort(() => Math.random() - 0.5) - .join(':'); + const defaultCiphers = tls.DEFAULT_CIPHERS.split(':'); + const temp = _.permutations(defaultCiphers.slice(0, 5), 5).filter( + x => JSON.stringify(x) !== JSON.stringify(defaultCiphers.slice(0, 5)), + ); + tls.DEFAULT_CIPHERS = [...temp[Math.floor(Math.random() * temp.length)], ...defaultCiphers.slice(5)].join(':'); crypto.constants.defaultCipherList = tls.DEFAULT_CIPHERS; if (agent === null) {