feat: update to v0.4.0, based by generics

This commit is contained in:
ᴍᴏᴏɴD4ʀᴋ
2022-04-18 02:11:33 +08:00
parent 6217ca3bed
commit aa3326f1a3
16 changed files with 252 additions and 135 deletions
+24 -1
View File
@@ -1,9 +1,10 @@
package browingdata
package cookie
import (
"database/sql"
"os"
"sort"
"time"
_ "github.com/mattn/go-sqlite3"
@@ -15,6 +16,24 @@ import (
type ChromiumCookie []cookie
type cookie struct {
Host string
Path string
KeyName string
encryptValue []byte
Value string
IsSecure bool
IsHTTPOnly bool
HasExpire bool
IsPersistent bool
CreateDate time.Time
ExpireDate time.Time
}
const (
queryChromiumCookie = `SELECT name, encrypted_value, host_key, path, creation_utc, expires_utc, is_secure, is_httponly, has_expires, is_persistent FROM cookies`
)
func (c *ChromiumCookie) Parse(masterKey []byte) error {
cookieDB, err := sql.Open("sqlite3", item.TempChromiumCookie)
if err != nil {
@@ -77,6 +96,10 @@ func (c *ChromiumCookie) Name() string {
type FirefoxCookie []cookie
const (
queryFirefoxCookie = `SELECT name, value, host, path, creationTime, expiry, isSecure, isHttpOnly FROM moz_cookies`
)
func (f *FirefoxCookie) Parse(masterKey []byte) error {
cookieDB, err := sql.Open("sqlite3", item.TempFirefoxCookie)
if err != nil {