browser

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package browser holds the browser table and the types the base packages hand the pipeline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAll

func AddAll[T any, P interface {
	*T
	record.Record
}](out Collector, rows []T)

AddAll hands rows to out by pointer, because out sets each record's Browser and Profile in place.

func Names

func Names() []string

Names are this OS's browser names, sorted as the -b help has always listed them.

Types

type Base

type Base int

Base is what a browser is built on; it selects the base package and the key path.

const (
	Chromium Base = iota + 1
	Firefox
	Safari
)

type Browser

type Browser struct {
	Name        string
	DisplayName string
	Base        Base

	Darwin  Platform
	Linux   Platform
	Windows Platform
}

Browser is one browser HBD knows. Name is the -b value and the keys.json vault key; DisplayName goes on every record.

func Lookup

func Lookup(name string) (Browser, bool)

Lookup finds a browser by name in the whole table, whatever the OS, so restore resolves another host's vaults.

func Supported

func Supported() []Browser

Supported returns the browsers of the running OS, in table order.

func (Browser) Platform

func (b Browser) Platform() Platform

func (Browser) UserDataDirID

func (b Browser) UserDataDirID(index int) UserDataDirID

UserDataDirID numbers by path order among a browser's user data dirs, so IDs stay the same from run to run.

type Collector

type Collector interface {
	Add(row record.Record)
	Fail(err error)
}

Collector sets every record's Browser and Profile; Fail reports a bad record and the extraction goes on.

type DiscoverOptions

type DiscoverOptions struct {
	Home        string // the user's home directory; tests pass a temp dir
	ProfilePath string // the -p value; "" when not given
}

DiscoverOptions is everything discovery would otherwise read from the environment.

type Extractor

type Extractor struct {
	FileSpecs []FileSpec
	Extract   func(ctx context.Context, profileSnapshot ProfileSnapshot, out Collector) error
}

type Extractors

type Extractors map[category.Category]Extractor

type FileSpec

type FileSpec struct {
	Paths    []string // slash-separated, relative to the profile dir, or to the user data dir when Shared
	IsDir    bool
	Shared   bool // belongs to the whole user data dir, such as Local State, so it is captured once per dir
	Optional bool // the extraction still runs without it
}

FileSpec is one file or directory an extractor reads; Paths are its candidates in priority order.

func (FileSpec) CandidatePaths

func (s FileSpec) CandidatePaths(profile Profile) []string

CandidatePaths are the Paths for a profile, relative to the user data dir, in priority order.

type Platform

type Platform struct {
	UserDataDirs  []string // slash-separated, relative to the home directory; globs allowed
	KeychainLabel string   // macOS Keychain account / Linux Secret Service label; "" = none
	Exe           string   // Windows: the program the ABE payload is injected into
	ExeFallbacks  []string // Windows: program paths tried when the registry has no App Paths entry
	ABE           masterkey.ABEKind
}

Platform is one OS's half of a Browser; one without UserDataDirs means the browser is not supported there.

type Profile

type Profile struct {
	Name string
	Dir  string // slash-separated, relative to UserDataDir.Path; "" when the user data dir itself is the profile
}

Profile is one profile within a user data dir. Name is the output's profile value and never a path.

type ProfileSnapshot

type ProfileSnapshot struct {
	Profile Profile
	// contains filtered or unexported fields
}

func NewProfileSnapshot

func NewProfileSnapshot(dirSnapshot snapshot.Snapshot, profile Profile, masterKeys func(context.Context) masterkey.Set) ProfileSnapshot

NewProfileSnapshot takes masterKeys, the dir's call-once retrieval, nil for bases that keep no Chromium keys.

func (ProfileSnapshot) MasterKeys

func (ps ProfileSnapshot) MasterKeys(ctx context.Context) masterkey.Set

MasterKeys may block on its first call; a key version that could not be retrieved is absent from the Set.

func (ProfileSnapshot) Path

func (ps ProfileSnapshot) Path(fileSpec FileSpec) (string, error)

Path skips a candidate that was never captured but returns the error of one whose copy failed.

type UserDataDir

type UserDataDir struct {
	ID       UserDataDirID
	Browser  Browser
	Path     string
	Profiles []Profile
}

UserDataDir is one browser data directory found on this machine; ID also names its snapshot and archive directory.

type UserDataDirID

type UserDataDirID string

UserDataDirID is Browser.Name, then "-2", "-3"... in Path order; its own type keeps it apart from that name.

Directories

Path Synopsis
Package chromium is the Chromium base: profile discovery, file parsing, and where a user data dir's keys come from.
Package chromium is the Chromium base: profile discovery, file parsing, and where a user data dir's keys come from.
Package firefox is the Firefox base: profile discovery, file parsing, and each profile's own key4.db.
Package firefox is the Firefox base: profile discovery, file parsing, and each profile's own key4.db.
Package safari is the Safari base: default and named profiles under ~/Library, their files, and the login keychain.
Package safari is the Safari base: default and named profiles under ~/Library, their files, and the login keychain.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL