Selfbot update
added headers to discord hard to detect selfbot 'x-fingerprint' cookies 'x-super-properties'
This commit is contained in:
		@@ -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);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -132,91 +132,93 @@ class Options extends null {
 | 
			
		||||
   */
 | 
			
		||||
  static createDefault() {
 | 
			
		||||
    return {
 | 
			
		||||
			jsonTransformer: (object) => JSONBig.stringify(object),
 | 
			
		||||
			checkUpdate: true,
 | 
			
		||||
			readyStatus: false,
 | 
			
		||||
			waitGuildTimeout: 15_000,
 | 
			
		||||
			shardCount: 1,
 | 
			
		||||
			makeCache: this.cacheWithLimits(this.defaultMakeCacheSettings),
 | 
			
		||||
			messageCacheLifetime: 0,
 | 
			
		||||
			messageSweepInterval: 0,
 | 
			
		||||
			invalidRequestWarningInterval: 0,
 | 
			
		||||
			intents: 65535,
 | 
			
		||||
			partials: [
 | 
			
		||||
				'USER',
 | 
			
		||||
				'CHANNEL',
 | 
			
		||||
				'GUILD_MEMBER',
 | 
			
		||||
				'MESSAGE',
 | 
			
		||||
				'REACTION',
 | 
			
		||||
				'GUILD_SCHEDULED_EVENT',
 | 
			
		||||
			], // Enable the partials
 | 
			
		||||
			restWsBridgeTimeout: 5_000,
 | 
			
		||||
			restRequestTimeout: 15_000,
 | 
			
		||||
			restGlobalRateLimit: 0,
 | 
			
		||||
			retryLimit: 1,
 | 
			
		||||
			restTimeOffset: 500,
 | 
			
		||||
			restSweepInterval: 60,
 | 
			
		||||
			failIfNotExists: false,
 | 
			
		||||
			userAgentSuffix: [],
 | 
			
		||||
			presence: {},
 | 
			
		||||
			sweepers: {},
 | 
			
		||||
			ws: {
 | 
			
		||||
				large_threshold: 50,
 | 
			
		||||
				compress: false,
 | 
			
		||||
				properties: {
 | 
			
		||||
					//$os: 'iPhone14,5',
 | 
			
		||||
					//$browser: 'Discord iOS',
 | 
			
		||||
					//$device: 'iPhone14,5 OS 15.2',
 | 
			
		||||
					$os: 'Windows',
 | 
			
		||||
					$browser: 'Discord Client',
 | 
			
		||||
					$device: 'ASUS ROG Phone 5',
 | 
			
		||||
				},
 | 
			
		||||
				version: 9,
 | 
			
		||||
			},
 | 
			
		||||
			http: {
 | 
			
		||||
				headers: {
 | 
			
		||||
					Accept: '*/*',
 | 
			
		||||
					'Accept-Encoding': 'gzip, deflate, br',
 | 
			
		||||
					'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-Mobile': '?0',
 | 
			
		||||
					'Sec-Ch-Ua-Platform': '"iOS"',
 | 
			
		||||
					'Sec-Fetch-Dest': 'empty',
 | 
			
		||||
					'Sec-Fetch-Mode': 'cors',
 | 
			
		||||
					'Sec-Fetch-Site': 'same-origin',
 | 
			
		||||
					'X-Debug-Options': 'bugReporterEnabled',
 | 
			
		||||
					// https://github.com/Merubokkusu/Discord-S.C.U.M/issues/66#issuecomment-1009171667
 | 
			
		||||
					'x-super-properties': `${Buffer.from(
 | 
			
		||||
						JSONBig.stringify({
 | 
			
		||||
							os: 'Windows',
 | 
			
		||||
							browser: 'Discord Client',
 | 
			
		||||
							release_channel: 'stable',
 | 
			
		||||
							client_version: '1.0.9004',
 | 
			
		||||
							os_version: '10.0.22000',
 | 
			
		||||
							os_arch: 'x64',
 | 
			
		||||
							system_locale: 'en-US',
 | 
			
		||||
							client_build_number: 122087,
 | 
			
		||||
							client_event_source: null,
 | 
			
		||||
						}),
 | 
			
		||||
						'ascii',
 | 
			
		||||
					).toString('base64')}`,
 | 
			
		||||
					'X-Discord-Locale': 'en-US',
 | 
			
		||||
					Origin: 'https://discord.com',
 | 
			
		||||
					'user-agent':
 | 
			
		||||
						'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) discord/1.0.9004 Chrome/91.0.4472.164 Electron/13.6.6 Safari/537.36',
 | 
			
		||||
				},
 | 
			
		||||
				agent: {},
 | 
			
		||||
				version: 9,
 | 
			
		||||
				api: 'https://discord.com/api',
 | 
			
		||||
				cdn: 'https://cdn.discordapp.com',
 | 
			
		||||
				invite: 'https://discord.gg',
 | 
			
		||||
				template: 'https://discord.new',
 | 
			
		||||
				scheduledEvent: 'https://discord.com/events',
 | 
			
		||||
			},
 | 
			
		||||
		};
 | 
			
		||||
      jsonTransformer: (object) => JSONBig.stringify(object),
 | 
			
		||||
      checkUpdate: true,
 | 
			
		||||
      readyStatus: false,
 | 
			
		||||
      autoCookie: true,
 | 
			
		||||
      waitGuildTimeout: 15_000,
 | 
			
		||||
      shardCount: 1,
 | 
			
		||||
      makeCache: this.cacheWithLimits(this.defaultMakeCacheSettings),
 | 
			
		||||
      messageCacheLifetime: 0,
 | 
			
		||||
      messageSweepInterval: 0,
 | 
			
		||||
      invalidRequestWarningInterval: 0,
 | 
			
		||||
      intents: 65535,
 | 
			
		||||
      partials: [
 | 
			
		||||
        'USER',
 | 
			
		||||
        'CHANNEL',
 | 
			
		||||
        'GUILD_MEMBER',
 | 
			
		||||
        'MESSAGE',
 | 
			
		||||
        'REACTION',
 | 
			
		||||
        'GUILD_SCHEDULED_EVENT',
 | 
			
		||||
      ], // Enable the partials
 | 
			
		||||
      restWsBridgeTimeout: 5_000,
 | 
			
		||||
      restRequestTimeout: 15_000,
 | 
			
		||||
      restGlobalRateLimit: 0,
 | 
			
		||||
      retryLimit: 1,
 | 
			
		||||
      restTimeOffset: 500,
 | 
			
		||||
      restSweepInterval: 60,
 | 
			
		||||
      failIfNotExists: false,
 | 
			
		||||
      userAgentSuffix: [],
 | 
			
		||||
      presence: {},
 | 
			
		||||
      sweepers: {},
 | 
			
		||||
      ws: {
 | 
			
		||||
        large_threshold: 50,
 | 
			
		||||
        compress: false,
 | 
			
		||||
        properties: {
 | 
			
		||||
          //$os: 'iPhone14,5',
 | 
			
		||||
          //$browser: 'Discord iOS',
 | 
			
		||||
          //$device: 'iPhone14,5 OS 15.2',
 | 
			
		||||
          $os: 'Windows',
 | 
			
		||||
          $browser: 'Discord Client',
 | 
			
		||||
          $device: 'ASUS ROG Phone 5',
 | 
			
		||||
        },
 | 
			
		||||
        version: 9,
 | 
			
		||||
      },
 | 
			
		||||
      http: {
 | 
			
		||||
        headers: {
 | 
			
		||||
          Accept: '*/*',
 | 
			
		||||
          // '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", "Chromium";v="100", "Google Chrome";v="100',
 | 
			
		||||
          'Sec-Ch-Ua-Mobile': '?0',
 | 
			
		||||
          'Sec-Ch-Ua-Platform': '"Windows"',
 | 
			
		||||
          'Sec-Fetch-Dest': 'empty',
 | 
			
		||||
          'Sec-Fetch-Mode': 'cors',
 | 
			
		||||
          'Sec-Fetch-Site': 'same-origin',
 | 
			
		||||
          'X-Debug-Options': 'bugReporterEnabled',
 | 
			
		||||
          // https://github.com/Merubokkusu/Discord-S.C.U.M/issues/66#issuecomment-1009171667
 | 
			
		||||
          'x-super-properties': `${Buffer.from(
 | 
			
		||||
            JSONBig.stringify({
 | 
			
		||||
              os: 'Windows',
 | 
			
		||||
              browser: 'Discord Client',
 | 
			
		||||
              release_channel: 'stable',
 | 
			
		||||
              client_version: '1.0.9004',
 | 
			
		||||
              os_version: '10.0.22000',
 | 
			
		||||
              os_arch: 'x64',
 | 
			
		||||
              system_locale: 'en-US',
 | 
			
		||||
              client_build_number: 122087,
 | 
			
		||||
              client_event_source: null,
 | 
			
		||||
            }),
 | 
			
		||||
            'ascii',
 | 
			
		||||
          ).toString('base64')}`,
 | 
			
		||||
          'X-Discord-Locale': 'en-US',
 | 
			
		||||
          Origin: 'https://discord.com',
 | 
			
		||||
          'user-agent':
 | 
			
		||||
            'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) discord/1.0.9004 Chrome/91.0.4472.164 Electron/13.6.6 Safari/537.36',
 | 
			
		||||
        },
 | 
			
		||||
        agent: {},
 | 
			
		||||
        version: 9,
 | 
			
		||||
        api: 'https://discord.com/api',
 | 
			
		||||
        cdn: 'https://cdn.discordapp.com',
 | 
			
		||||
        invite: 'https://discord.gg',
 | 
			
		||||
        template: 'https://discord.new',
 | 
			
		||||
        scheduledEvent: 'https://discord.com/events',
 | 
			
		||||
      },
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user