bexxcv 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +493 -2
- package/dist/__main__.d.ts +2 -0
- package/dist/__main__.js +156 -0
- package/dist/__version__.d.ts +5 -0
- package/dist/__version__.js +5 -0
- package/dist/addons.d.ts +7 -0
- package/dist/addons.js +56 -0
- package/dist/browser-pin.d.ts +15 -0
- package/dist/browser-pin.js +34 -0
- package/dist/data-files/browser-pin.json +7 -0
- package/dist/data-files/territoryInfo.xml +2024 -0
- package/dist/exceptions.d.ts +79 -0
- package/dist/exceptions.js +159 -0
- package/dist/fingerprints.d.ts +5 -0
- package/dist/fingerprints.js +92 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/ip.d.ts +23 -0
- package/dist/ip.js +98 -0
- package/dist/locale.d.ts +26 -0
- package/dist/locale.js +292 -0
- package/dist/mappings/browserforge.config.d.ts +44 -0
- package/dist/mappings/browserforge.config.js +43 -0
- package/dist/mappings/fonts.config.d.ts +6 -0
- package/dist/mappings/fonts.config.js +822 -0
- package/dist/mappings/warnings.config.d.ts +16 -0
- package/dist/mappings/warnings.config.js +28 -0
- package/dist/multiversion.d.ts +27 -0
- package/dist/multiversion.js +88 -0
- package/dist/pkgman.d.ts +69 -0
- package/dist/pkgman.js +529 -0
- package/dist/selfupdate.d.ts +8 -0
- package/dist/selfupdate.js +84 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.js +6 -0
- package/dist/sync_api.d.ts +11 -0
- package/dist/sync_api.js +47 -0
- package/dist/utils.d.ts +45 -0
- package/dist/utils.js +514 -0
- package/dist/virtdisplay.d.ts +12 -0
- package/dist/virtdisplay.js +139 -0
- package/dist/warnings.d.ts +4 -0
- package/dist/warnings.js +33 -0
- package/dist/webgl/sample.d.ts +19 -0
- package/dist/webgl/sample.js +103 -0
- package/dist/xvfb.d.ts +6 -0
- package/dist/xvfb.js +25 -0
- package/package.json +103 -5
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
navigator: string;
|
|
3
|
+
locale: string;
|
|
4
|
+
geolocation: string;
|
|
5
|
+
"header-ua": string;
|
|
6
|
+
viewport: string;
|
|
7
|
+
custom_fingerprint: string;
|
|
8
|
+
proxy_without_geoip: string;
|
|
9
|
+
ff_version: string;
|
|
10
|
+
no_region: string;
|
|
11
|
+
block_webgl: string;
|
|
12
|
+
block_images: string;
|
|
13
|
+
custom_fonts_only: string;
|
|
14
|
+
disable_coop: string;
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
navigator: "Manually setting navigator properties is not recommended." +
|
|
3
|
+
" Device information is automatically generated within Camoufox" +
|
|
4
|
+
" based on the provided `os`.",
|
|
5
|
+
locale: "Use the `locale` parameter in Camoufox instead of setting the config manually.",
|
|
6
|
+
geolocation: "Please use the `geoip` parameter in Camoufox instead of setting your geolocation manually." +
|
|
7
|
+
" This can lead to detection if your target geolocation does not match your IP." +
|
|
8
|
+
" Pass `geoip=True` or a target IP (ex: geoip='123.45.67.89') to let Camoufox populate this data for you.",
|
|
9
|
+
"header-ua": "Do not set the header.User-Agent manually. Camoufox will generate a User-Agent for you.",
|
|
10
|
+
viewport: "Manually setting screen & window properties is not recommended." +
|
|
11
|
+
" Screen dimensions are randomly generated within Camoufox" +
|
|
12
|
+
" based on the provided screen constraints. See here:" +
|
|
13
|
+
" https://github.com/daijro/camoufox/tree/main/pythonlib#browserforge-integration.",
|
|
14
|
+
custom_fingerprint: "Passing your own fingerprint is not recommended." +
|
|
15
|
+
" BrowserForge fingerprints are automatically generated within Camoufox" +
|
|
16
|
+
" based on the provided `os` and `screen` constraints.",
|
|
17
|
+
proxy_without_geoip: "When using a proxy, it is heavily recommended that you pass `geoip=True`.",
|
|
18
|
+
ff_version: "Spoofing the Firefox version will likely lead to detection." +
|
|
19
|
+
" If rotating the Firefox version is absolutely necessary, it would be more advisable to" +
|
|
20
|
+
" rotate between older versions of Camoufox instead.",
|
|
21
|
+
no_region: "Because you did not pass in a locale region, Camoufox will generate one for you." +
|
|
22
|
+
" This can cause suspicion if your IP does not match your locale region.",
|
|
23
|
+
block_webgl: "Disabling WebGL is not recommended. Many WAFs will check if WebGL is enabled.",
|
|
24
|
+
block_images: "Blocking image requests has been reported to cause detection issues on major WAFs.",
|
|
25
|
+
custom_fonts_only: "Disabling OS-specific fonts while spoofing your OS will make your browser fingerprint inconsistent." +
|
|
26
|
+
" WAFs can detect this mismatch between your claimed OS and available system fonts.",
|
|
27
|
+
disable_coop: "Disabling Cross-Origin-Opener-Policy (COOP) handling can potentially be detected by sophisticated WAFs.",
|
|
28
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Version } from "./pkgman.js";
|
|
2
|
+
export declare const browsersDir: () => string;
|
|
3
|
+
export declare const configFile: () => string;
|
|
4
|
+
export declare const compatFlag: () => string;
|
|
5
|
+
export interface CamoufoxConfig {
|
|
6
|
+
active_version?: string | null;
|
|
7
|
+
channel?: string;
|
|
8
|
+
pinned?: string;
|
|
9
|
+
pinned_sha?: string;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
export declare function loadConfig(): CamoufoxConfig;
|
|
13
|
+
export declare function saveConfig(config: CamoufoxConfig): void;
|
|
14
|
+
export declare function setActive(relativePath: string): void;
|
|
15
|
+
export declare function getRepoName(githubRepo: string): string;
|
|
16
|
+
export declare function versionFolderName(version: string, build: string, sha256?: string): string;
|
|
17
|
+
export interface InstalledVersion {
|
|
18
|
+
repoName: string;
|
|
19
|
+
version: Version;
|
|
20
|
+
path: string;
|
|
21
|
+
relativePath: string;
|
|
22
|
+
isActive: boolean;
|
|
23
|
+
isPrerelease: boolean;
|
|
24
|
+
sha256?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function listInstalled(): InstalledVersion[];
|
|
27
|
+
export declare function getActivePath(): string | null;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { effectivePin, pinMatches } from "./browser-pin.js";
|
|
4
|
+
import { INSTALL_DIR, Version } from "./pkgman.js";
|
|
5
|
+
export const browsersDir = () => path.join(INSTALL_DIR.toString(), "browsers");
|
|
6
|
+
export const configFile = () => path.join(INSTALL_DIR.toString(), "config.json");
|
|
7
|
+
export const compatFlag = () => path.join(INSTALL_DIR.toString(), ".0.5_FLAG");
|
|
8
|
+
export function loadConfig() {
|
|
9
|
+
try {
|
|
10
|
+
return JSON.parse(fs.readFileSync(configFile(), "utf-8"));
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return {};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function saveConfig(config) {
|
|
17
|
+
fs.mkdirSync(INSTALL_DIR, { recursive: true });
|
|
18
|
+
const tmp = `${configFile()}.${process.pid}.tmp`;
|
|
19
|
+
fs.writeFileSync(tmp, JSON.stringify(config, null, 2));
|
|
20
|
+
fs.renameSync(tmp, configFile());
|
|
21
|
+
}
|
|
22
|
+
export function setActive(relativePath) {
|
|
23
|
+
saveConfig({ ...loadConfig(), active_version: relativePath });
|
|
24
|
+
}
|
|
25
|
+
const REPO_NAMES = { "daijro/camoufox": "official" };
|
|
26
|
+
export function getRepoName(githubRepo) {
|
|
27
|
+
return REPO_NAMES[githubRepo] ?? githubRepo.split("/")[0].toLowerCase();
|
|
28
|
+
}
|
|
29
|
+
export function versionFolderName(version, build, sha256) {
|
|
30
|
+
const base = `${version}-${build}`;
|
|
31
|
+
return sha256 ? `${base}-${sha256.slice(0, 8)}` : base;
|
|
32
|
+
}
|
|
33
|
+
export function listInstalled() {
|
|
34
|
+
const installed = [];
|
|
35
|
+
if (!fs.existsSync(browsersDir()))
|
|
36
|
+
return installed;
|
|
37
|
+
const active = loadConfig().active_version;
|
|
38
|
+
for (const repo of fs.readdirSync(browsersDir(), { withFileTypes: true })) {
|
|
39
|
+
if (!repo.isDirectory() || repo.name.startsWith("."))
|
|
40
|
+
continue;
|
|
41
|
+
const repoDir = path.join(browsersDir(), repo.name);
|
|
42
|
+
for (const folder of fs.readdirSync(repoDir, { withFileTypes: true })) {
|
|
43
|
+
const dir = path.join(repoDir, folder.name);
|
|
44
|
+
const versionJson = path.join(dir, "version.json");
|
|
45
|
+
if (!folder.isDirectory() || !fs.existsSync(versionJson))
|
|
46
|
+
continue;
|
|
47
|
+
try {
|
|
48
|
+
const data = JSON.parse(fs.readFileSync(versionJson, "utf-8"));
|
|
49
|
+
const relativePath = `browsers/${repo.name}/${folder.name}`;
|
|
50
|
+
installed.push({
|
|
51
|
+
repoName: repo.name,
|
|
52
|
+
version: Version.fromPath(dir),
|
|
53
|
+
path: dir,
|
|
54
|
+
relativePath,
|
|
55
|
+
isActive: relativePath === active,
|
|
56
|
+
isPrerelease: data.prerelease ?? false,
|
|
57
|
+
sha256: data.sha256 ?? undefined,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const compare = (a, b) => a.lessThan(b) ? -1 : b.lessThan(a) ? 1 : 0;
|
|
65
|
+
return installed.sort((a, b) => (a.repoName < b.repoName ? 1 : a.repoName > b.repoName ? -1 : 0) ||
|
|
66
|
+
compare(b.version, a.version));
|
|
67
|
+
}
|
|
68
|
+
export function getActivePath() {
|
|
69
|
+
const config = loadConfig();
|
|
70
|
+
const active = config.active_version;
|
|
71
|
+
const pin = effectivePin(config);
|
|
72
|
+
if (pin) {
|
|
73
|
+
const inst = listInstalled().find((v) => pinMatches(pin, v.repoName, v.version.version ?? "", v.version.release));
|
|
74
|
+
return inst?.path ?? null;
|
|
75
|
+
}
|
|
76
|
+
if (active) {
|
|
77
|
+
const activePath = path.join(INSTALL_DIR.toString(), active);
|
|
78
|
+
if (fs.existsSync(path.join(activePath, "version.json"))) {
|
|
79
|
+
return activePath;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (!config.channel && !config.pinned) {
|
|
83
|
+
const [newest] = listInstalled();
|
|
84
|
+
if (newest)
|
|
85
|
+
return newest.path;
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
}
|
package/dist/pkgman.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { PathLike } from "node:fs";
|
|
2
|
+
import type { Writable } from "node:stream";
|
|
3
|
+
export declare const OS_NAME: "mac" | "win" | "lin";
|
|
4
|
+
export declare const INSTALL_DIR: PathLike;
|
|
5
|
+
export declare const LOCAL_DATA: PathLike;
|
|
6
|
+
export declare const OS_ARCH_MATRIX: {
|
|
7
|
+
[key: string]: string[];
|
|
8
|
+
};
|
|
9
|
+
export declare class Version {
|
|
10
|
+
release: string;
|
|
11
|
+
version?: string;
|
|
12
|
+
sorted_rel: number[];
|
|
13
|
+
constructor(release: string, version?: string);
|
|
14
|
+
private buildSortedRel;
|
|
15
|
+
get fullString(): string;
|
|
16
|
+
equals(other: Version): boolean;
|
|
17
|
+
lessThan(other: Version): boolean;
|
|
18
|
+
isSupported(): boolean;
|
|
19
|
+
static fromPath(filePath?: PathLike): Version;
|
|
20
|
+
static isSupportedPath(path: PathLike): boolean;
|
|
21
|
+
static buildMinMax(): [Version, Version];
|
|
22
|
+
}
|
|
23
|
+
export declare class GitHubDownloader {
|
|
24
|
+
githubRepo: string;
|
|
25
|
+
apiUrl: string;
|
|
26
|
+
constructor(githubRepo: string);
|
|
27
|
+
checkAsset(asset: any, _release?: any): any;
|
|
28
|
+
releasesUrl(): string;
|
|
29
|
+
missingAssetError(): void;
|
|
30
|
+
getAsset({ retries }?: {
|
|
31
|
+
retries: number;
|
|
32
|
+
}): Promise<any>;
|
|
33
|
+
}
|
|
34
|
+
export declare class CamoufoxFetcher extends GitHubDownloader {
|
|
35
|
+
arch: string;
|
|
36
|
+
_version_obj?: Version;
|
|
37
|
+
pattern: RegExp;
|
|
38
|
+
_url?: string;
|
|
39
|
+
isPrerelease: boolean;
|
|
40
|
+
sha256?: string;
|
|
41
|
+
createdAt?: string;
|
|
42
|
+
constructor();
|
|
43
|
+
init(): Promise<void>;
|
|
44
|
+
releasesUrl(): string;
|
|
45
|
+
checkAsset(asset: any, release?: any): [Version, string] | null;
|
|
46
|
+
missingAssetError(): void;
|
|
47
|
+
static getPlatformArch(): string;
|
|
48
|
+
fetchLatest(): Promise<void>;
|
|
49
|
+
static downloadFile(url: string): Promise<Buffer>;
|
|
50
|
+
extractZip(zipFile: string | Buffer, destDir?: string): Promise<void>;
|
|
51
|
+
static cleanup(): boolean;
|
|
52
|
+
setVersion(destDir?: string): void;
|
|
53
|
+
private static removeLeftovers;
|
|
54
|
+
private static activate;
|
|
55
|
+
install(): Promise<void>;
|
|
56
|
+
get url(): string;
|
|
57
|
+
get version(): string;
|
|
58
|
+
get release(): string;
|
|
59
|
+
get verstr(): string;
|
|
60
|
+
}
|
|
61
|
+
export declare function installedVerStr(): string;
|
|
62
|
+
export declare function camoufoxPath(_downloadIfMissing?: boolean): PathLike;
|
|
63
|
+
export declare function ensureCamoufoxInstalled(): Promise<void>;
|
|
64
|
+
export declare function getPath(file: string): string;
|
|
65
|
+
export declare function launchPath(): string;
|
|
66
|
+
export declare function webdl(url: string, desc?: string, bar?: boolean, buffer?: Writable | null, { retries }?: {
|
|
67
|
+
retries: number;
|
|
68
|
+
}): Promise<Buffer>;
|
|
69
|
+
export declare function unzip(zipFile: Buffer, extractPath: string, desc?: string, bar?: boolean): Promise<void>;
|