Selfbot update

added headers to discord hard to detect selfbot
'x-fingerprint'
cookies
'x-super-properties'
This commit is contained in:
March 7th 2022-04-08 19:00:31 +07:00
parent 590a778c4a
commit f361bed628
5 changed files with 212 additions and 165 deletions

View File

@ -34,6 +34,7 @@ const client = new Client({
new Client({ new Client({
checkUpdate: true, // Check Package Update (Bot Ready) [Enable Default] checkUpdate: true, // Check Package Update (Bot Ready) [Enable Default]
readyStatus: false, // Set Custom Status sync from Account (Bot Ready) [Disable Default] readyStatus: false, // Set Custom Status sync from Account (Bot Ready) [Disable Default]
autoCookie: true, // Auto added Cookie and Fingerprint [Enable Default](https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/DOCUMENT.md#http-options)
}) })
``` ```
</details> </details>

View File

@ -1,6 +1,6 @@
{ {
"name": "discord.js-selfbot-v13", "name": "discord.js-selfbot-v13",
"version": "1.2.8", "version": "1.3.0",
"description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]", "description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]",
"main": "./src/index.js", "main": "./src/index.js",
"types": "./typings/index.d.ts", "types": "./typings/index.d.ts",

View File

@ -260,6 +260,46 @@ class Client extends BaseClient {
.join('.')}`, .join('.')}`,
); );
if (this.options.autoCookie) {
/* Auto find fingerprint and add Cookie */
let cookie = '';
await require('axios')({
method: 'get',
url: 'https://discord.com/api/v9/experiments',
headers: this.options.http.headers,
})
.then((res) => {
if (!'set-cookie' in res.headers) return;
res.headers['set-cookie'].map((line) => {
line.split('; ').map((arr) => {
if (
arr.startsWith('Expires') ||
arr.startsWith('Path') ||
arr.startsWith('Domain') ||
arr.startsWith('HttpOnly') ||
arr.startsWith('Secure') ||
arr.startsWith('Max-Age') ||
arr.startsWith('SameSite')
) {
return;
} else {
cookie += `${arr}; `;
}
});
});
this.options.http.headers['Cookie'] = `${cookie}locale=en`;
this.options.http.headers['x-fingerprint'] = res.data.fingerprint;
this.emit(Events.DEBUG, `Added Cookie: ${cookie}`);
this.emit(Events.DEBUG, `Added Fingerprint: ${res.data.fingerprint}`);
})
.catch((err) => {
this.emit(
Events.DEBUG,
`Finding Cookie and Fingerprint failed: ${err.message}`,
);
});
}
if (this.options.presence) { if (this.options.presence) {
this.options.ws.presence = this.presence._parse(this.options.presence); this.options.ws.presence = this.presence._parse(this.options.presence);
} }

View File

@ -135,6 +135,7 @@ class Options extends null {
jsonTransformer: (object) => JSONBig.stringify(object), jsonTransformer: (object) => JSONBig.stringify(object),
checkUpdate: true, checkUpdate: true,
readyStatus: false, readyStatus: false,
autoCookie: true,
waitGuildTimeout: 15_000, waitGuildTimeout: 15_000,
shardCount: 1, shardCount: 1,
makeCache: this.cacheWithLimits(this.defaultMakeCacheSettings), makeCache: this.cacheWithLimits(this.defaultMakeCacheSettings),
@ -176,14 +177,15 @@ class Options extends null {
http: { http: {
headers: { headers: {
Accept: '*/*', Accept: '*/*',
'Accept-Encoding': 'gzip, deflate, br', // 'Accept-Encoding': 'gzip, deflate, br', => cause axios bug
'Accept-Language': 'en-US,en;q=0.9', 'Accept-Language': 'en-US,en;q=0.9',
'Cache-Control': 'no-cache', 'Cache-Control': 'no-cache',
Pragma: 'no-cache', Pragma: 'no-cache',
Referer: 'https://discord.com/channels/@me', Referer: 'https://discord.com/channels/@me',
'Sec-Ch-Ua': '" Not A;Brand";v="99" "', 'Sec-Ch-Ua':
'"Not A;Brand";v="99", "Chromium";v="100", "Google Chrome";v="100',
'Sec-Ch-Ua-Mobile': '?0', 'Sec-Ch-Ua-Mobile': '?0',
'Sec-Ch-Ua-Platform': '"iOS"', 'Sec-Ch-Ua-Platform': '"Windows"',
'Sec-Fetch-Dest': 'empty', 'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors', 'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin', 'Sec-Fetch-Site': 'same-origin',

4
typings/index.d.ts vendored
View File

@ -4140,6 +4140,10 @@ export interface ClientOptions {
ws?: WebSocketOptions; ws?: WebSocketOptions;
http?: HTTPOptions; http?: HTTPOptions;
rejectOnRateLimit?: string[] | ((data: RateLimitData) => boolean | Promise<boolean>); rejectOnRateLimit?: string[] | ((data: RateLimitData) => boolean | Promise<boolean>);
// add
checkUpdate?: boolean;
readyStatus?: boolean;
autoCookie?: boolean;
} }
export type ClientPresenceStatus = 'online' | 'idle' | 'dnd'; export type ClientPresenceStatus = 'online' | 'idle' | 'dnd';