mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-12-04 05:43:27 +01:00
Later layers speak categories and records, and export needs nothing else. Ordering rows once in the exporter fixes Firefox history, written least visited first.
58 lines
1.0 KiB
Go
58 lines
1.0 KiB
Go
package category
|
|
|
|
import "fmt"
|
|
|
|
// Numbering starts at 1, so the zero Category means "none".
|
|
type Category int
|
|
|
|
const (
|
|
Password Category = iota + 1
|
|
Cookie
|
|
Bookmark
|
|
History
|
|
Download
|
|
CreditCard
|
|
Extension
|
|
LocalStorage
|
|
SessionStorage
|
|
)
|
|
|
|
// String's values are the -c values and the output file names, so they cannot change.
|
|
func (c Category) String() string {
|
|
switch c {
|
|
case Password:
|
|
return "password"
|
|
case Cookie:
|
|
return "cookie"
|
|
case Bookmark:
|
|
return "bookmark"
|
|
case History:
|
|
return "history"
|
|
case Download:
|
|
return "download"
|
|
case CreditCard:
|
|
return "creditcard"
|
|
case Extension:
|
|
return "extension"
|
|
case LocalStorage:
|
|
return "localstorage"
|
|
case SessionStorage:
|
|
return "sessionstorage"
|
|
default:
|
|
return "unknown"
|
|
}
|
|
}
|
|
|
|
func All() []Category {
|
|
return []Category{Password, Cookie, Bookmark, History, Download, CreditCard, Extension, LocalStorage, SessionStorage}
|
|
}
|
|
|
|
func Parse(s string) (Category, error) {
|
|
for _, c := range All() {
|
|
if c.String() == s {
|
|
return c, nil
|
|
}
|
|
}
|
|
return 0, fmt.Errorf("unknown category: %q", s)
|
|
}
|