feat: add log

pull/121/head
ᴍᴏᴏɴD4ʀᴋ 3 years ago
parent dfa095eecc
commit 1f47250456
  1. 4
      internal/browingdata/bookmark.go
  2. 3
      internal/browingdata/browsingdata.go
  3. 14
      internal/browingdata/cookie.go
  4. 4
      internal/browingdata/creditcard.go
  5. 3
      internal/browingdata/download.go
  6. 6
      internal/browingdata/history.go
  7. 12
      internal/browingdata/password.go

@ -2,7 +2,6 @@ package browingdata
import ( import (
"database/sql" "database/sql"
"fmt"
"os" "os"
"sort" "sort"
"time" "time"
@ -10,6 +9,7 @@ import (
"github.com/tidwall/gjson" "github.com/tidwall/gjson"
"hack-browser-data/internal/item" "hack-browser-data/internal/item"
"hack-browser-data/internal/log"
"hack-browser-data/internal/utils" "hack-browser-data/internal/utils"
"hack-browser-data/internal/utils/fileutil" "hack-browser-data/internal/utils/fileutil"
@ -107,7 +107,7 @@ func (f *FirefoxBookmark) Parse(masterKey []byte) error {
title, url string title, url string
) )
if err = bookmarkRows.Scan(&id, &url, &bType, &dateAdded, &title); err != nil { if err = bookmarkRows.Scan(&id, &url, &bType, &dateAdded, &title); err != nil {
fmt.Println(err) log.Warn(err)
} }
*f = append(*f, bookmark{ *f = append(*f, bookmark{
ID: id, ID: id,

@ -4,6 +4,7 @@ import (
"time" "time"
"hack-browser-data/internal/item" "hack-browser-data/internal/item"
"hack-browser-data/internal/log"
) )
type Data struct { type Data struct {
@ -28,7 +29,7 @@ func (d *Data) Recovery(masterKey []byte) error {
for _, source := range d.Sources { for _, source := range d.Sources {
if err := source.Parse(masterKey); err != nil { if err := source.Parse(masterKey); err != nil {
panic(err) log.Error(err)
} }
} }
return nil return nil

@ -2,7 +2,6 @@ package browingdata
import ( import (
"database/sql" "database/sql"
"fmt"
"os" "os"
"sort" "sort"
@ -10,6 +9,7 @@ import (
"hack-browser-data/internal/decrypter" "hack-browser-data/internal/decrypter"
"hack-browser-data/internal/item" "hack-browser-data/internal/item"
"hack-browser-data/internal/log"
"hack-browser-data/internal/utils" "hack-browser-data/internal/utils"
) )
@ -35,7 +35,7 @@ func (c *ChromiumCookie) Parse(masterKey []byte) error {
value, encryptValue []byte value, encryptValue []byte
) )
if err = rows.Scan(&key, &encryptValue, &host, &path, &createDate, &expireDate, &isSecure, &isHTTPOnly, &hasExpire, &isPersistent); err != nil { if err = rows.Scan(&key, &encryptValue, &host, &path, &createDate, &expireDate, &isSecure, &isHTTPOnly, &hasExpire, &isPersistent); err != nil {
fmt.Println(err) log.Warn(err)
} }
cookie := cookie{ cookie := cookie{
@ -52,17 +52,13 @@ func (c *ChromiumCookie) Parse(masterKey []byte) error {
} }
// TODO: replace DPAPI // TODO: replace DPAPI
if len(encryptValue) > 0 { if len(encryptValue) > 0 {
var err error
if masterKey == nil { if masterKey == nil {
value, err = decrypter.DPApi(encryptValue) value, err = decrypter.DPApi(encryptValue)
if err != nil {
fmt.Println(err)
}
} else { } else {
value, err = decrypter.ChromePass(masterKey, encryptValue) value, err = decrypter.ChromePass(masterKey, encryptValue)
if err != nil {
fmt.Println(err)
}
} }
log.Error(err)
} }
cookie.Value = string(value) cookie.Value = string(value)
*c = append(*c, cookie) *c = append(*c, cookie)
@ -98,7 +94,7 @@ func (f *FirefoxCookie) Parse(masterKey []byte) error {
creationTime, expiry int64 creationTime, expiry int64
) )
if err = rows.Scan(&name, &value, &host, &path, &creationTime, &expiry, &isSecure, &isHttpOnly); err != nil { if err = rows.Scan(&name, &value, &host, &path, &creationTime, &expiry, &isSecure, &isHttpOnly); err != nil {
fmt.Println(err) log.Warn(err)
} }
*f = append(*f, cookie{ *f = append(*f, cookie{
KeyName: name, KeyName: name,

@ -2,13 +2,13 @@ package browingdata
import ( import (
"database/sql" "database/sql"
"fmt"
"os" "os"
_ "github.com/mattn/go-sqlite3" _ "github.com/mattn/go-sqlite3"
"hack-browser-data/internal/decrypter" "hack-browser-data/internal/decrypter"
"hack-browser-data/internal/item" "hack-browser-data/internal/item"
"hack-browser-data/internal/log"
) )
type ChromiumCreditCard []card type ChromiumCreditCard []card
@ -31,7 +31,7 @@ func (c *ChromiumCreditCard) Parse(masterKey []byte) error {
value, encryptValue []byte value, encryptValue []byte
) )
if err := rows.Scan(&guid, &name, &month, &year, &encryptValue); err != nil { if err := rows.Scan(&guid, &name, &month, &year, &encryptValue); err != nil {
fmt.Println(err) log.Warn(err)
} }
creditCardInfo := card{ creditCardInfo := card{
GUID: guid, GUID: guid,

@ -8,6 +8,7 @@ import (
"strings" "strings"
"hack-browser-data/internal/item" "hack-browser-data/internal/item"
"hack-browser-data/internal/log"
"hack-browser-data/internal/utils" "hack-browser-data/internal/utils"
_ "github.com/mattn/go-sqlite3" _ "github.com/mattn/go-sqlite3"
@ -86,7 +87,7 @@ func (f *FirefoxDownload) Parse(masterKey []byte) error {
placeID, dateAdded int64 placeID, dateAdded int64
) )
if err = downloadRows.Scan(&placeID, &content, &url, &dateAdded); err != nil { if err = downloadRows.Scan(&placeID, &content, &url, &dateAdded); err != nil {
fmt.Println(err) log.Warn(err)
} }
contentList := strings.Split(content, ",{") contentList := strings.Split(content, ",{")
if len(contentList) > 1 { if len(contentList) > 1 {

@ -2,13 +2,13 @@ package browingdata
import ( import (
"database/sql" "database/sql"
"fmt"
"os" "os"
"sort" "sort"
_ "github.com/mattn/go-sqlite3" _ "github.com/mattn/go-sqlite3"
"hack-browser-data/internal/item" "hack-browser-data/internal/item"
"hack-browser-data/internal/log"
"hack-browser-data/internal/utils" "hack-browser-data/internal/utils"
) )
@ -34,7 +34,7 @@ func (c *ChromiumHistory) Parse(masterKey []byte) error {
) )
// TODO: handle rows error // TODO: handle rows error
if err := rows.Scan(&url, &title, &visitCount, &lastVisitTime); err != nil { if err := rows.Scan(&url, &title, &visitCount, &lastVisitTime); err != nil {
fmt.Println(err) log.Warn(err)
} }
data := history{ data := history{
Url: url, Url: url,
@ -85,7 +85,7 @@ func (f *FirefoxHistory) Parse(masterKey []byte) error {
visitCount int visitCount int
) )
if err = historyRows.Scan(&id, &url, &visitDate, &title, &visitCount); err != nil { if err = historyRows.Scan(&id, &url, &visitDate, &title, &visitCount); err != nil {
fmt.Println(err) log.Warn(err)
} }
*f = append(*f, history{ *f = append(*f, history{
Title: title, Title: title,

@ -4,7 +4,6 @@ import (
"bytes" "bytes"
"database/sql" "database/sql"
"encoding/base64" "encoding/base64"
"fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"sort" "sort"
@ -15,6 +14,7 @@ import (
"hack-browser-data/internal/decrypter" "hack-browser-data/internal/decrypter"
"hack-browser-data/internal/item" "hack-browser-data/internal/item"
"hack-browser-data/internal/log"
"hack-browser-data/internal/utils" "hack-browser-data/internal/utils"
) )
@ -40,7 +40,7 @@ func (c *ChromiumPassword) Parse(masterKey []byte) error {
create int64 create int64
) )
if err := rows.Scan(&url, &username, &pwd, &create); err != nil { if err := rows.Scan(&url, &username, &pwd, &create); err != nil {
fmt.Println(err) log.Warn(err)
} }
login := loginData{ login := loginData{
UserName: username, UserName: username,
@ -48,17 +48,13 @@ func (c *ChromiumPassword) Parse(masterKey []byte) error {
LoginUrl: url, LoginUrl: url,
} }
if len(pwd) > 0 { if len(pwd) > 0 {
var err error
if masterKey == nil { if masterKey == nil {
password, err = decrypter.DPApi(pwd) password, err = decrypter.DPApi(pwd)
if err != nil {
fmt.Println(err)
}
} else { } else {
password, err = decrypter.ChromePass(masterKey, pwd) password, err = decrypter.ChromePass(masterKey, pwd)
if err != nil {
fmt.Println(err)
}
} }
log.Error(err)
} }
if create > time.Now().Unix() { if create > time.Now().Unix() {
login.CreateDate = utils.TimeEpochFormat(create) login.CreateDate = utils.TimeEpochFormat(create)

Loading…
Cancel
Save