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 ChromiumDownload []download
|
||||
|
||||
func (c *ChromiumDownload) Parse(masterKey []byte) error {
|
||||
historyDB, err := sql.Open("sqlite3", consts.ChromiumDownloadFilename)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer historyDB.Close()
|
||||
rows, err := historyDB.Query(queryChromiumDownload)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
var (
|
||||
targetPath, tabUrl, mimeType string
|
||||
totalBytes, startTime, endTime int64
|
||||
)
|
||||
if err := rows.Scan(&targetPath, &tabUrl, &totalBytes, &startTime, &endTime, &mimeType); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
data := download{
|
||||
TargetPath: targetPath,
|
||||
Url: tabUrl,
|
||||
TotalBytes: totalBytes,
|
||||
StartTime: utils.TimeEpochFormat(startTime),
|
||||
EndTime: utils.TimeEpochFormat(endTime),
|
||||
MimeType: mimeType,
|
||||
}
|
||||
*c = append(*c, data)
|
||||
}
|
||||
sort.Slice(*c, func(i, j int) bool {
|
||||
return (*c)[i].TotalBytes > (*c)[j].TotalBytes
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *ChromiumDownload) Name() string {
|
||||
return "download"
|
||||
}
|
||||
Reference in New Issue
Block a user