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({
checkUpdate: true, // Check Package Update (Bot Ready) [Enable 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>

View File

@ -1,6 +1,6 @@
{
"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]",
"main": "./src/index.js",
"types": "./typings/index.d.ts",

View File

@ -260,6 +260,46 @@ class Client extends BaseClient {
.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) {
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),
checkUpdate: true,
readyStatus: false,
autoCookie: true,
waitGuildTimeout: 15_000,
shardCount: 1,
makeCache: this.cacheWithLimits(this.defaultMakeCacheSettings),
@ -176,14 +177,15 @@ class Options extends null {
http: {
headers: {
Accept: '*/*',
'Accept-Encoding': 'gzip, deflate, br',
// 'Accept-Encoding': 'gzip, deflate, br', => cause axios bug
'Accept-Language': 'en-US,en;q=0.9',
'Cache-Control': 'no-cache',
Pragma: 'no-cache',
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-Platform': '"iOS"',
'Sec-Ch-Ua-Platform': '"Windows"',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',

44
typings/index.d.ts vendored
View File

@ -641,7 +641,7 @@ export class ClientUser extends User {
public setPresence(data: PresenceData): ClientPresence;
public setStatus(status: PresenceStatusData, shardId?: number | number[]): ClientPresence;
public setUsername(username: string, password: string): Promise<this>;
public setHypeSquad(type: HypeSquadOptions<Number|String>): Promise<void>;
public setHypeSquad(type: HypeSquadOptions<Number | String>): Promise<void>;
public setAccentColor(color: ColorResolvable): Promise<this>;
public setDiscriminator(discriminator: string, password: string): Promise<this>;
public setAboutMe(bio: string): Promise<this>;
@ -1046,7 +1046,7 @@ export class GuildAuditLogsEntry<
TTargetType extends GuildAuditLogsTarget = TAction extends keyof GuildAuditLogsTypes
? GuildAuditLogsTypes[TAction][0]
: 'UNKNOWN',
> {
> {
private constructor(logs: GuildAuditLogs, guild: Guild, data: RawGuildAuditLogEntryData);
public action: TAction;
public actionType: TActionType;
@ -1284,7 +1284,7 @@ export class HTTPError extends Error {
}
// tslint:disable-next-line:no-empty-interface - Merge RateLimitData into RateLimitError to not have to type it again
export interface RateLimitError extends RateLimitData {}
export interface RateLimitError extends RateLimitData { }
export class RateLimitError extends Error {
private constructor(data: RateLimitData);
public name: 'RateLimitError';
@ -1337,7 +1337,7 @@ export type CacheTypeReducer<
RawType = CachedType,
PresentType = CachedType | RawType,
Fallback = PresentType | null,
> = [State] extends ['cached']
> = [State] extends ['cached']
? CachedType
: [State] extends ['raw']
? RawType
@ -1489,7 +1489,7 @@ export type MessageCollectorOptionsParams<T extends MessageComponentTypeResolvab
export type MessageChannelCollectorOptionsParams<
T extends MessageComponentTypeResolvable,
Cached extends boolean = boolean,
> =
> =
| {
componentType?: T;
} & MessageChannelComponentCollectorOptions<MappedInteractionTypes<Cached>[T]>;
@ -1497,7 +1497,7 @@ export type MessageChannelCollectorOptionsParams<
export type AwaitMessageCollectorOptionsParams<
T extends MessageComponentTypeResolvable,
Cached extends boolean = boolean,
> =
> =
| { componentType?: T } & Pick<
InteractionCollectorOptions<MappedInteractionTypes<Cached>[T]>,
keyof AwaitMessageComponentOptions<any>
@ -1710,7 +1710,7 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
export class MessageContextMenuInteraction<
Cached extends CacheType = CacheType,
> extends ContextMenuInteraction<Cached> {
> extends ContextMenuInteraction<Cached> {
public readonly targetMessage: NonNullable<CommandInteractionOption<Cached>['message']>;
public inGuild(): this is MessageContextMenuInteraction<'present'>;
public inCachedGuild(): this is MessageContextMenuInteraction<'cached'>;
@ -2965,7 +2965,7 @@ export class ApplicationCommandManager<
ApplicationCommandScope = ApplicationCommand<{ guild: GuildResolvable }>,
PermissionsOptionsExtras = { guild: GuildResolvable },
PermissionsGuildType = null,
> extends CachedManager<Snowflake, ApplicationCommandScope, ApplicationCommandResolvable> {
> extends CachedManager<Snowflake, ApplicationCommandScope, ApplicationCommandResolvable> {
protected constructor(client: Client, iterable?: Iterable<unknown>, user: User);
public permissions: ApplicationCommandPermissionsManager<
{ command?: ApplicationCommandResolvable } & PermissionsOptionsExtras,
@ -3012,7 +3012,7 @@ export class ApplicationCommandPermissionsManager<
FullPermissionsOptions,
GuildType,
CommandIdType,
> extends BaseManager {
> extends BaseManager {
private constructor(manager: ApplicationCommandManager | GuildApplicationCommandManager | ApplicationCommand, user: User);
private manager: ApplicationCommandManager | GuildApplicationCommandManager | ApplicationCommand;
@ -4140,6 +4140,10 @@ export interface ClientOptions {
ws?: WebSocketOptions;
http?: HTTPOptions;
rejectOnRateLimit?: string[] | ((data: RateLimitData) => boolean | Promise<boolean>);
// add
checkUpdate?: boolean;
readyStatus?: boolean;
autoCookie?: boolean;
}
export type ClientPresenceStatus = 'online' | 'idle' | 'dnd';
@ -4714,8 +4718,8 @@ export interface GuildAuditLogsEntryTargetField<TActionType extends GuildAuditLo
INVITE: Invite;
MESSAGE: TActionType extends 'MESSAGE_BULK_DELETE' ? Guild | { id: Snowflake } : User;
INTEGRATION: Integration;
CHANNEL: NonThreadGuildBasedChannel | { id: Snowflake; [x: string]: unknown };
THREAD: ThreadChannel | { id: Snowflake; [x: string]: unknown };
CHANNEL: NonThreadGuildBasedChannel | { id: Snowflake;[x: string]: unknown };
THREAD: ThreadChannel | { id: Snowflake;[x: string]: unknown };
STAGE_INSTANCE: StageInstance;
STICKER: Sticker;
GUILD_SCHEDULED_EVENT: GuildScheduledEvent;
@ -4901,7 +4905,7 @@ export interface GuildScheduledEventCreateOptions {
export interface GuildScheduledEventEditOptions<
S extends GuildScheduledEventStatus,
T extends GuildScheduledEventSetStatusArg<S>,
> extends Omit<Partial<GuildScheduledEventCreateOptions>, 'channel'> {
> extends Omit<Partial<GuildScheduledEventCreateOptions>, 'channel'> {
channel?: GuildVoiceChannelResolvable | null;
status?: T | number;
}
@ -4918,7 +4922,7 @@ export type GuildScheduledEventEntityType = keyof typeof GuildScheduledEventEnti
export type GuildScheduledEventManagerFetchResult<
T extends GuildScheduledEventResolvable | FetchGuildScheduledEventOptions | FetchGuildScheduledEventsOptions,
> = T extends GuildScheduledEventResolvable | FetchGuildScheduledEventOptions
> = T extends GuildScheduledEventResolvable | FetchGuildScheduledEventOptions
? GuildScheduledEvent
: Collection<Snowflake, GuildScheduledEvent>;
@ -5475,24 +5479,24 @@ export type Partialize<
N extends keyof T | null = null,
M extends keyof T | null = null,
E extends keyof T | '' = '',
> = {
> = {
readonly client: Client;
id: Snowflake;
partial: true;
} & {
} & {
[K in keyof Omit<T, 'client' | 'id' | 'partial' | E>]: K extends N ? null : K extends M ? T[K] | null : T[K];
};
};
export interface PartialDMChannel extends Partialize<DMChannel, null, null, 'lastMessageId'> {
lastMessageId: undefined;
}
export interface PartialGuildMember extends Partialize<GuildMember, 'joinedAt' | 'joinedTimestamp'> {}
export interface PartialGuildMember extends Partialize<GuildMember, 'joinedAt' | 'joinedTimestamp'> { }
export interface PartialMessage
extends Partialize<Message, 'type' | 'system' | 'pinned' | 'tts', 'content' | 'cleanContent' | 'author'> {}
extends Partialize<Message, 'type' | 'system' | 'pinned' | 'tts', 'content' | 'cleanContent' | 'author'> { }
export interface PartialMessageReaction extends Partialize<MessageReaction, 'count'> {}
export interface PartialMessageReaction extends Partialize<MessageReaction, 'count'> { }
export interface PartialOverwriteData {
id: Snowflake | number;
@ -5507,7 +5511,7 @@ export interface PartialRoleData extends RoleData {
export type PartialTypes = 'USER' | 'CHANNEL' | 'GUILD_MEMBER' | 'MESSAGE' | 'REACTION' | 'GUILD_SCHEDULED_EVENT';
export interface PartialUser extends Partialize<User, 'username' | 'tag' | 'discriminator'> {}
export interface PartialUser extends Partialize<User, 'username' | 'tag' | 'discriminator'> { }
export type PresenceStatusData = ClientPresenceStatus | 'invisible';