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.
91 lines
2.0 KiB
91 lines
2.0 KiB
3 years ago
|
package browser
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
|
||
3 years ago
|
"hack-browser-data/internal/browser/outputter"
|
||
|
"hack-browser-data/internal/log"
|
||
3 years ago
|
)
|
||
|
|
||
3 years ago
|
func TestPickChromium(t *testing.T) {
|
||
3 years ago
|
browsers := pickChromium("chrome")
|
||
|
log.InitLog("debug")
|
||
3 years ago
|
filetype := "json"
|
||
|
dir := "result"
|
||
|
output := outputter.NewOutPutter(filetype)
|
||
|
if err := output.MakeDir("result"); err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
for _, b := range browsers {
|
||
|
fmt.Printf("%+v\n", b)
|
||
3 years ago
|
if err := b.CopyItemFileToLocal(); err != nil {
|
||
3 years ago
|
panic(err)
|
||
|
}
|
||
|
masterKey, err := b.GetMasterKey()
|
||
|
if err != nil {
|
||
|
fmt.Println(err)
|
||
|
}
|
||
3 years ago
|
browserName := b.GetName()
|
||
3 years ago
|
multiData := b.GetBrowsingData()
|
||
|
for _, data := range multiData {
|
||
|
if err := data.Parse(masterKey); err != nil {
|
||
|
fmt.Println(err)
|
||
|
}
|
||
|
filename := fmt.Sprintf("%s_%s.%s", browserName, data.Name(), filetype)
|
||
|
file, err := output.CreateFile(dir, filename)
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
if err := output.Write(data, file); err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
3 years ago
|
|
||
3 years ago
|
func TestPickBrowsers(t *testing.T) {
|
||
|
browsers := PickBrowser("all")
|
||
|
for _, v := range browsers {
|
||
|
fmt.Println(v.GetName())
|
||
|
}
|
||
|
// filetype := "json"
|
||
|
// dir := "result"
|
||
|
// output := outputter.NewOutPutter(filetype)
|
||
|
}
|
||
|
|
||
3 years ago
|
func TestPickFirefox(t *testing.T) {
|
||
3 years ago
|
browsers := pickFirefox("all")
|
||
3 years ago
|
filetype := "json"
|
||
|
dir := "result"
|
||
|
output := outputter.NewOutPutter(filetype)
|
||
|
if err := output.MakeDir("result"); err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
for _, b := range browsers {
|
||
|
fmt.Printf("%+v\n", b)
|
||
3 years ago
|
if err := b.CopyItemFileToLocal(); err != nil {
|
||
3 years ago
|
panic(err)
|
||
|
}
|
||
|
masterKey, err := b.GetMasterKey()
|
||
|
if err != nil {
|
||
|
fmt.Println(err)
|
||
|
}
|
||
3 years ago
|
browserName := b.GetName()
|
||
3 years ago
|
multiData := b.GetBrowsingData()
|
||
|
for _, data := range multiData {
|
||
|
if err := data.Parse(masterKey); err != nil {
|
||
|
fmt.Println(err)
|
||
|
}
|
||
|
filename := fmt.Sprintf("%s_%s.%s", browserName, data.Name(), filetype)
|
||
|
file, err := output.CreateFile(dir, filename)
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
if err := output.Write(data, file); err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|