mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-07-14 21:47:19 +02:00
dev-feat: add chromium browser for macos
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package data
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"hack-browser-data/pkg/browser/consts"
|
||||
"hack-browser-data/utils"
|
||||
)
|
||||
|
||||
type ChromiumHistory []history
|
||||
|
||||
func (c *ChromiumHistory) Parse(masterKey []byte) error {
|
||||
historyDB, err := sql.Open("sqlite3", consts.ChromiumHistoryFilename)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer historyDB.Close()
|
||||
rows, err := historyDB.Query(queryChromiumHistory)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
var (
|
||||
url, title string
|
||||
visitCount int
|
||||
lastVisitTime int64
|
||||
)
|
||||
// TODO: handle rows error
|
||||
if err := rows.Scan(&url, &title, &visitCount, &lastVisitTime); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
data := history{
|
||||
Url: url,
|
||||
Title: title,
|
||||
VisitCount: visitCount,
|
||||
LastVisitTime: utils.TimeEpochFormat(lastVisitTime),
|
||||
}
|
||||
*c = append(*c, data)
|
||||
}
|
||||
sort.Slice(*c, func(i, j int) bool {
|
||||
return (*c)[i].VisitCount > (*c)[j].VisitCount
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *ChromiumHistory) Name() string {
|
||||
return "history"
|
||||
}
|
||||
Reference in New Issue
Block a user