chrome-tools 1.1.18 → 1.2.1
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 +33 -7
- package/dist/chrome_abe_decrypt.exe +0 -0
- package/dist/chromium/addresses.d.ts +2 -0
- package/dist/chromium/browsers.d.ts +73 -0
- package/dist/chromium/local-storage.d.ts +7 -0
- package/dist/chromium/profiles.d.ts +130 -0
- package/dist/cli.js +95 -8821
- package/dist/core/crypto.d.ts +52 -0
- package/dist/core/keychain.d.ts +57 -0
- package/dist/core/limit.d.ts +4 -0
- package/dist/core/sql.d.ts +2 -0
- package/dist/index.d.ts +28 -628
- package/dist/index.js +29 -2520
- package/dist/modules/autofill.d.ts +68 -0
- package/dist/modules/bookmarks.d.ts +22 -0
- package/dist/modules/cookies.d.ts +40 -0
- package/dist/modules/downloads.d.ts +27 -0
- package/dist/modules/extensions.d.ts +24 -0
- package/dist/modules/history.d.ts +34 -0
- package/dist/modules/local-storage.d.ts +21 -0
- package/dist/modules/passwords.d.ts +50 -0
- package/dist/modules/search-engines.d.ts +21 -0
- package/dist/modules/top-sites.d.ts +17 -0
- package/dist/platform/darwin.d.ts +12 -0
- package/dist/platform/index.d.ts +33 -0
- package/dist/platform/linux.d.ts +10 -0
- package/dist/platform/types.d.ts +49 -0
- package/dist/platform/win32.d.ts +13 -0
- package/dist/storage/binary.d.ts +6 -0
- package/dist/storage/errors.d.ts +13 -0
- package/dist/storage/files.d.ts +5 -0
- package/dist/storage/leveldb.d.ts +8 -0
- package/dist/storage/sqlite.d.ts +5 -0
- package/package.json +9 -10
package/README.md
CHANGED
|
@@ -6,10 +6,7 @@ CLI & Node.js library for Chrome browser data, including passwords, bookmarks, h
|
|
|
6
6
|
|
|
7
7
|
**Node.js >= 22.16.0.** Chrome's stores are read through the built-in
|
|
8
8
|
[`node:sqlite`](https://nodejs.org/api/sqlite.html) module rather than a native
|
|
9
|
-
dependency, so
|
|
10
|
-
because that is the release where the connection `timeout` option began to be
|
|
11
|
-
honoured — on 22.15 and earlier it is accepted and silently ignored, which is
|
|
12
|
-
worse than rejected.
|
|
9
|
+
dependency, so consumers can install the package without a compiler.
|
|
13
10
|
|
|
14
11
|
### The experimental warning
|
|
15
12
|
|
|
@@ -29,6 +26,35 @@ as failure, set `NODE_NO_WARNINGS=1` (or run node with `--no-warnings`) in that
|
|
|
29
26
|
harness. This package deliberately does not suppress the warning for you — a
|
|
30
27
|
library silencing process-wide warnings would hide unrelated ones too.
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
## Reading profiles
|
|
30
|
+
|
|
31
|
+
Profile files are read as source data. SQLite opens and recovers journals only
|
|
32
|
+
inside a private temporary directory. The LevelDB reader also works from a
|
|
33
|
+
private copy. If a required file is locked or changes during copying, close the
|
|
34
|
+
browser and retry, or point the tool at a quiescent profile backup.
|
|
35
|
+
|
|
36
|
+
Use `--diagnostics` to print store failures to stderr alongside normal CLI
|
|
37
|
+
output. For example, `chrome-tools addresses --json --diagnostics` returns an
|
|
38
|
+
address array on stdout and reports unsupported schemas or missing stores on
|
|
39
|
+
stderr. Library readers accept an `onDiagnostic` callback with the profile,
|
|
40
|
+
store, issue code, and message.
|
|
41
|
+
|
|
42
|
+
Windows App-Bound Encryption can make protected values unavailable to the
|
|
43
|
+
bundled helper. The tool reports this with a placeholder and a diagnostic when
|
|
44
|
+
requested. The helper runs from the package directory.
|
|
45
|
+
|
|
46
|
+
## Development
|
|
47
|
+
|
|
48
|
+
- `npm test` builds and tests with synthetic profiles and isolated home directories.
|
|
49
|
+
- `npm run test:package` installs the built tarball into a temporary directory and checks its entry points.
|
|
50
|
+
- `npm run test:chrome` uses the executable specified by `CHROME_FOR_TESTING_BINARY` to generate and read a disposable profile. The test compares the profile's file hashes before and after reading it.
|
|
51
|
+
|
|
52
|
+
The compatibility workflow checks Chrome for Testing Stable on pushes and pull
|
|
53
|
+
requests and checks Beta on scheduled and manual runs. Package tests run across
|
|
54
|
+
macOS, Linux, and Windows on the minimum supported Node version and current LTS.
|
|
55
|
+
|
|
56
|
+
The Windows CI job builds and tests the native helper and publishes it as a
|
|
57
|
+
workflow artifact for that commit. For a release, place the matching artifact at
|
|
58
|
+
`native/windows/chrome_abe_decrypt.exe` or build it from the same source revision
|
|
59
|
+
with `native/windows/build.bat`. Release packaging includes the helper alongside
|
|
60
|
+
the bundled CLI and library.
|
|
Binary file
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chromium-browser registry — the single source of truth for what differs
|
|
3
|
+
* between Chromium-based browsers (Chrome, Edge, Brave, Comet, …).
|
|
4
|
+
*
|
|
5
|
+
* Every supported browser is a Chromium fork, so the *decryption* is identical
|
|
6
|
+
* per OS (AES-128-CBC + PBKDF2 on macOS/Linux, AES-256-GCM + DPAPI on Windows).
|
|
7
|
+
* Only two things vary by browser:
|
|
8
|
+
* 1. the default profile data directory, and
|
|
9
|
+
* 2. the OS-keystore "Safe Storage" label (macOS Keychain service name /
|
|
10
|
+
* Linux Secret Service application).
|
|
11
|
+
*
|
|
12
|
+
* "Browser" is therefore a small dimension orthogonal to "platform": the
|
|
13
|
+
* platform backends (darwin/win32/linux) receive a browser descriptor and stay
|
|
14
|
+
* otherwise unchanged.
|
|
15
|
+
*/
|
|
16
|
+
export type BrowserId = "chrome" | "chrome-beta" | "chrome-canary" | "chromium" | "edge" | "brave" | "comet" | "vivaldi" | "opera";
|
|
17
|
+
/** Subpaths to a browser's User Data dir, relative to each OS's app-data base. */
|
|
18
|
+
export interface BrowserDirs {
|
|
19
|
+
/** Under `~/Library/Application Support`. */
|
|
20
|
+
darwin: string;
|
|
21
|
+
/** Under the selected Windows app-data root. Includes any `User Data` segment. */
|
|
22
|
+
win32: string;
|
|
23
|
+
/** Windows application-data root. Chromium browsers normally use Local. */
|
|
24
|
+
win32Base?: "local" | "roaming";
|
|
25
|
+
/** Under `$XDG_CONFIG_HOME` (or `~/.config`). */
|
|
26
|
+
linux: string;
|
|
27
|
+
}
|
|
28
|
+
export interface BrowserDescriptor {
|
|
29
|
+
/** Stable identifier used on the CLI (`--browser <id>`) and in the API. */
|
|
30
|
+
readonly id: BrowserId;
|
|
31
|
+
/** Human-readable display name, e.g. "Microsoft Edge". */
|
|
32
|
+
readonly name: string;
|
|
33
|
+
/** Extra names accepted on the CLI (case-insensitive), e.g. "msedge". */
|
|
34
|
+
readonly aliases?: readonly string[];
|
|
35
|
+
/**
|
|
36
|
+
* macOS Keychain service name (a.k.a. the "<Browser> Safe Storage" item) used
|
|
37
|
+
* as the basis for the AES key. Also reused as a human label in messages.
|
|
38
|
+
*/
|
|
39
|
+
readonly safeStorageLabel: string;
|
|
40
|
+
/** Linux Secret Service `application` attribute used by `secret-tool lookup`. */
|
|
41
|
+
readonly linuxSecretApp?: string;
|
|
42
|
+
/** Per-OS User Data subpaths. */
|
|
43
|
+
readonly dirs: BrowserDirs;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Supported browsers. macOS paths/labels are verified; a few Windows/Linux
|
|
47
|
+
* paths for niche browsers (Comet, Opera) are best-effort and easy to correct —
|
|
48
|
+
* each is a single edit here, with no other code change required.
|
|
49
|
+
*/
|
|
50
|
+
export declare const BROWSERS: Record<BrowserId, BrowserDescriptor>;
|
|
51
|
+
/** All supported browsers, in a stable display order. */
|
|
52
|
+
export declare function listBrowsers(): BrowserDescriptor[];
|
|
53
|
+
/**
|
|
54
|
+
* Resolves a browser by id, display name, or alias (case-insensitive).
|
|
55
|
+
* @returns The descriptor, or `null` if unrecognized.
|
|
56
|
+
*/
|
|
57
|
+
export declare function resolveBrowser(idOrName: string): BrowserDescriptor | null;
|
|
58
|
+
/** Resolves a browser or throws an actionable error without changing global state. */
|
|
59
|
+
export declare function requireBrowser(idOrName: string): BrowserDescriptor;
|
|
60
|
+
/** The browser currently targeted by dir/key lookups. Defaults to Chrome. */
|
|
61
|
+
export declare function getActiveBrowser(): BrowserDescriptor;
|
|
62
|
+
/**
|
|
63
|
+
* Sets the active browser for subsequent dir/key lookups.
|
|
64
|
+
*
|
|
65
|
+
* Caches in the platform backends are keyed by their real inputs (Keychain
|
|
66
|
+
* service label, chromeDir, Linux secret app), so switching browsers never
|
|
67
|
+
* returns a stale key — no cache flush is needed here.
|
|
68
|
+
*
|
|
69
|
+
* @param idOrName - Browser id/name/alias. Empty/undefined resets to Chrome.
|
|
70
|
+
* @returns The now-active descriptor.
|
|
71
|
+
* @throws If `idOrName` is non-empty but unrecognized.
|
|
72
|
+
*/
|
|
73
|
+
export declare function setActiveBrowser(idOrName?: string): BrowserDescriptor;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { ProfileReadReporter } from "../storage/errors.js";
|
|
2
|
+
import { type BrowserDescriptor } from "./browsers.js";
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the Cookies database for a Chromium profile.
|
|
5
|
+
*
|
|
6
|
+
* Current Chromium releases keep it under `Network/Cookies`; older releases
|
|
7
|
+
* and a few Chromium-based browsers used `<profile>/Cookies`. Prefer the
|
|
8
|
+
* current location when both exist, while retaining compatibility with the
|
|
9
|
+
* legacy layout.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveCookiesDatabasePath(profilePath: string): string;
|
|
12
|
+
export interface DiscoveredProfile {
|
|
13
|
+
name: string;
|
|
14
|
+
path: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ProfileMetadata {
|
|
17
|
+
directory: string;
|
|
18
|
+
name: string;
|
|
19
|
+
gaiaName: string;
|
|
20
|
+
userName: string;
|
|
21
|
+
email: string;
|
|
22
|
+
avatarIcon: string;
|
|
23
|
+
isUsingDefaultName: boolean;
|
|
24
|
+
isEphemeral: boolean;
|
|
25
|
+
activeTime: number;
|
|
26
|
+
}
|
|
27
|
+
export interface ProfileState {
|
|
28
|
+
directory: string;
|
|
29
|
+
path: string;
|
|
30
|
+
displayName: string;
|
|
31
|
+
gaiaName: string;
|
|
32
|
+
email: string;
|
|
33
|
+
avatarIcon: string;
|
|
34
|
+
isEphemeral: boolean;
|
|
35
|
+
activeTime: number;
|
|
36
|
+
dataFiles: Record<string, boolean>;
|
|
37
|
+
}
|
|
38
|
+
export interface ResolveProfilesOptions {
|
|
39
|
+
profilePath?: string;
|
|
40
|
+
chromeDir?: string;
|
|
41
|
+
profile?: string;
|
|
42
|
+
/** Target a specific browser (id/name/alias). Applied only when provided. */
|
|
43
|
+
browser?: string;
|
|
44
|
+
/** Reports profile and store failures while preserving the usual array result. */
|
|
45
|
+
onDiagnostic?: ProfileReadReporter;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Returns the default Chrome User Data directory for the current OS.
|
|
49
|
+
* Delegates to the active platform backend (macOS/Windows/Linux).
|
|
50
|
+
* @returns The absolute path to Chrome's User Data.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getDefaultChromeDir(browser?: string | BrowserDescriptor): string;
|
|
53
|
+
export interface InstalledBrowser {
|
|
54
|
+
/** Registry descriptor for the detected browser. */
|
|
55
|
+
browser: BrowserDescriptor;
|
|
56
|
+
/** Absolute path to this browser's default User Data directory. */
|
|
57
|
+
chromeDir: string;
|
|
58
|
+
/** Whether the data directory exists on disk. */
|
|
59
|
+
installed: boolean;
|
|
60
|
+
/** Number of discovered profiles (0 when not installed). */
|
|
61
|
+
profileCount: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Probes every supported browser for an on-disk profile directory.
|
|
65
|
+
*
|
|
66
|
+
* @param options.includeMissing - When true, also returns browsers with no data
|
|
67
|
+
* directory (installed: false). Defaults to false (installed browsers only).
|
|
68
|
+
* @returns One entry per matching browser.
|
|
69
|
+
*/
|
|
70
|
+
export declare function detectInstalledBrowsers({ includeMissing }?: {
|
|
71
|
+
includeMissing?: boolean;
|
|
72
|
+
}): InstalledBrowser[];
|
|
73
|
+
/**
|
|
74
|
+
* Scans the Chrome User Data directory for profile subdirectories.
|
|
75
|
+
* A directory is considered a profile if it contains at least one known data file.
|
|
76
|
+
*
|
|
77
|
+
* Also handles "flat" layouts (e.g. some Opera installs, or when `chromeDir`
|
|
78
|
+
* already points at a single profile folder): if no child profiles are found
|
|
79
|
+
* but the user-data directory itself has profile indicators, it is returned
|
|
80
|
+
* as a single profile.
|
|
81
|
+
*
|
|
82
|
+
* @param chromeDir - Chrome User Data path. Defaults to standard macOS location.
|
|
83
|
+
* @param options.reportAccessDenied - Throw when the directory cannot be read due to permissions.
|
|
84
|
+
* @returns Discovered profiles with name and absolute path.
|
|
85
|
+
*/
|
|
86
|
+
export declare function discoverProfiles(chromeDir?: string, { reportAccessDenied }?: {
|
|
87
|
+
reportAccessDenied?: boolean;
|
|
88
|
+
}): DiscoveredProfile[];
|
|
89
|
+
/**
|
|
90
|
+
* Parses the Chrome "Local State" JSON file to extract profile metadata.
|
|
91
|
+
* Returns enriched profile info including display name, email, avatar, etc.
|
|
92
|
+
*
|
|
93
|
+
* @param chromeDir - Chrome User Data path.
|
|
94
|
+
* @returns Profile metadata objects.
|
|
95
|
+
*/
|
|
96
|
+
export declare function getProfileMetadata(chromeDir?: string): ProfileMetadata[];
|
|
97
|
+
/**
|
|
98
|
+
* Combines filesystem profile discovery with Local State metadata
|
|
99
|
+
* to provide a comprehensive view of each profile's state.
|
|
100
|
+
*
|
|
101
|
+
* @param chromeDir - Chrome User Data path.
|
|
102
|
+
* @returns Enriched profile state objects.
|
|
103
|
+
*/
|
|
104
|
+
export declare function getProfileStates(chromeDir?: string): ProfileState[];
|
|
105
|
+
/**
|
|
106
|
+
* Recursively computes the total size, in bytes, of a directory's contents.
|
|
107
|
+
* Symbolic links are not followed and unreadable entries are skipped so the
|
|
108
|
+
* walk never throws on a single permission error.
|
|
109
|
+
*
|
|
110
|
+
* @param dirPath - Absolute path to the directory to measure.
|
|
111
|
+
* @returns Total size of all contained files in bytes (0 if missing/unreadable).
|
|
112
|
+
*/
|
|
113
|
+
export declare function getDirectorySize(dirPath: string): number;
|
|
114
|
+
/**
|
|
115
|
+
* Resolves a profile name to its directory path.
|
|
116
|
+
*
|
|
117
|
+
* @param chromeDir - Chrome User Data path.
|
|
118
|
+
* @param profileName - Profile directory name (e.g., "Default", "Profile 1").
|
|
119
|
+
* @returns Absolute path to profile directory, or null if not found.
|
|
120
|
+
*/
|
|
121
|
+
export declare function resolveProfilePath(chromeDir: string, profileName: string): string | null;
|
|
122
|
+
/**
|
|
123
|
+
* Helper to get the profiles to operate on based on options.
|
|
124
|
+
* If a specific profile is specified, returns only that one.
|
|
125
|
+
* Otherwise returns all discovered profiles.
|
|
126
|
+
*
|
|
127
|
+
* @param options - Resolution options.
|
|
128
|
+
* @returns Array of targeted profiles.
|
|
129
|
+
*/
|
|
130
|
+
export declare function resolveTargetProfiles({ profilePath, chromeDir, profile, browser, onDiagnostic, }?: ResolveProfilesOptions): DiscoveredProfile[];
|