mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-12-06 05:53:25 +01:00
Parsers move with git mv and hand records to a Collector; the old browser/firefox runs them, and app now discovers Firefox. A profile without a usable key exports its logins instead of panicking, as RFC-008 now lists.
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package firefox
|
|
|
|
import (
|
|
"database/sql"
|
|
|
|
"github.com/moond4rk/hackbrowserdata/internal/browser"
|
|
"github.com/moond4rk/hackbrowserdata/internal/record"
|
|
"github.com/moond4rk/hackbrowserdata/internal/sqlitex"
|
|
"github.com/moond4rk/hackbrowserdata/internal/timeconv"
|
|
)
|
|
|
|
const firefoxBookmarkQuery = `SELECT id, url, type, dateAdded, COALESCE(title, '')
|
|
FROM (SELECT * FROM moz_bookmarks INNER JOIN moz_places ON moz_bookmarks.fk=moz_places.id)`
|
|
|
|
func extractBookmarks(path string, out browser.Collector) error {
|
|
bookmarks, err := sqlitex.QueryRows(path, true, firefoxBookmarkQuery,
|
|
func(rows *sql.Rows) (record.Bookmark, error) {
|
|
var id, dateAdded int64
|
|
var url, title string
|
|
var bt int64
|
|
if err := rows.Scan(&id, &url, &bt, &dateAdded, &title); err != nil {
|
|
return record.Bookmark{}, err
|
|
}
|
|
return record.Bookmark{
|
|
Name: title,
|
|
URL: url,
|
|
Folder: bookmarkType(bt),
|
|
CreatedAt: timeconv.UnixMicro(dateAdded),
|
|
}, nil
|
|
})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
emit(out, bookmarks)
|
|
return nil
|
|
}
|
|
|
|
func bookmarkType(bt int64) string {
|
|
switch bt {
|
|
case 1:
|
|
return "url"
|
|
default:
|
|
return "folder"
|
|
}
|
|
}
|