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.
60 lines
1.2 KiB
60 lines
1.2 KiB
3 years ago
|
package browingdata
|
||
3 years ago
|
|
||
|
import (
|
||
|
"database/sql"
|
||
|
"fmt"
|
||
|
|
||
3 years ago
|
_ "github.com/mattn/go-sqlite3"
|
||
3 years ago
|
|
||
3 years ago
|
"hack-browser-data/internal/browser/item"
|
||
3 years ago
|
|
||
3 years ago
|
"hack-browser-data/internal/decrypter"
|
||
3 years ago
|
)
|
||
|
|
||
|
type ChromiumCreditCard []card
|
||
|
|
||
|
func (c *ChromiumCreditCard) Parse(masterKey []byte) error {
|
||
3 years ago
|
creditDB, err := sql.Open("sqlite3", item.TempChromiumCredit)
|
||
3 years ago
|
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"
|
||
|
}
|