mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-05-19 18:58:03 +02:00
d105a1f488
* feat: add Safari bookmark and download extraction from plist files * test: add nested folder test for bookmark tree traversal Part of #565
32 lines
971 B
Go
32 lines
971 B
Go
package safari
|
|
|
|
import (
|
|
"path/filepath"
|
|
|
|
"github.com/moond4rk/hackbrowserdata/types"
|
|
)
|
|
|
|
// sourcePath describes a single candidate location for browser data,
|
|
// relative to the Safari data directory.
|
|
type sourcePath struct {
|
|
rel string // relative path from dataDir
|
|
isDir bool // true for directory targets
|
|
}
|
|
|
|
func file(rel string) sourcePath { return sourcePath{rel: filepath.FromSlash(rel)} }
|
|
|
|
// safariSources defines the Safari file layout.
|
|
// Each category maps to one or more candidate paths tried in priority order;
|
|
// the first existing path wins.
|
|
var safariSources = map[types.Category][]sourcePath{
|
|
types.History: {file("History.db")},
|
|
types.Bookmark: {file("Bookmarks.plist")},
|
|
types.Download: {file("Downloads.plist")},
|
|
types.Cookie: {
|
|
// macOS 14+ (containerized Safari)
|
|
file("../Containers/com.apple.Safari/Data/Library/Cookies/Cookies.binarycookies"),
|
|
// macOS ≤13 (traditional path)
|
|
file("../Cookies/Cookies.binarycookies"),
|
|
},
|
|
}
|