Skip to content

Attach fingerprints with chrome debug protocol using chrome-remote-interface #415

Description

@EmpiresHQ

Describe the feature
I were thinking of adding a attachFingerprintWithCDP method which would use objects provided by chrome-remote-interface. This way the suite could be easily usable with raw chrome implementations avoiding puppeteer/playwright

Motivation
I am using a custom chrome setup with raw CDP protocol and would like to swap my custom evasions with fingerprint-suite

Constraints
Not really, it seems fairly straightforward. The only global change would be in adding following packages to devDependencies:

 "@types/chrome-remote-interface": "^0.33.3"

The idea is to add a method looking approximately like that:

import CDP from "@types/chrome-remote-interface";

async attachFingerprintToCDP(
  page: CDP.StableDomains["Page"],
  network: CDP.StableDomains["Network"],
  emulation: CDP.StableDomains["Emulation"]
  browserFingerprintWithHeaders: BrowserFingerprintWithHeaders,
): Promise<void> {
   ...
   await network.setUserAgentOverride(userAgent);
   ....
   await network.setExtraHTTPHeaders(
      this.onlyInjectableHeaders(headers, browserVersion)
   );
   ...
  await emulation.emulateMediaFeatures(
     [{ name: 'prefers-color-scheme', value: 'dark' }]
   );
  await page.addScriptToEvaluateOnNewDocument(
     this.getInjectableFingerprintFunction(enhancedFingerprint)
  );
}

Basically puppeteer does exactly the same using the chain of methods:

https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer-core/src/cdp/EmulationManager.ts#L433
https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer-core/src/cdp/NetworkManager.ts#L164
https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer-core/src/cdp/FrameManager.ts#L284

Coulda make a PR for that if above would make sense

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    t-toolingIssues with this label are in the ownership of the tooling team.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions