refactor: format project layout

This commit is contained in:
ᴍᴏᴏɴD4ʀᴋ 2022-04-02 16:59:34 +08:00
parent 4f7adf3db7
commit 87a026a13e
14 changed files with 53 additions and 48 deletions

View File

@ -8,8 +8,8 @@ import (
"github.com/urfave/cli/v2"
"hack-browser-data/internal/browser"
"hack-browser-data/internal/browser/outputter"
"hack-browser-data/internal/log"
"hack-browser-data/internal/outputter"
)
var (

View File

@ -4,7 +4,7 @@ import (
"os"
"strings"
"hack-browser-data/internal/browser/data"
"hack-browser-data/internal/data"
)
type Browser interface {

View File

@ -4,8 +4,8 @@ import (
"fmt"
"testing"
"hack-browser-data/internal/browser/outputter"
"hack-browser-data/internal/log"
"hack-browser-data/internal/outputter"
)
func TestPickChromium(t *testing.T) {

View File

@ -8,7 +8,7 @@ import (
"path/filepath"
"strings"
"hack-browser-data/internal/browser/data"
"hack-browser-data/internal/data"
"hack-browser-data/internal/item"
)

View File

@ -9,7 +9,7 @@ import (
"path/filepath"
"strings"
"hack-browser-data/internal/browser/data"
"hack-browser-data/internal/data"
"hack-browser-data/internal/item"
)

View File

@ -6,6 +6,7 @@ import (
"sort"
"hack-browser-data/internal/browser/item"
"hack-browser-data/internal/decrypter"
"hack-browser-data/internal/utils"

View File

@ -7,6 +7,7 @@ import (
_ "github.com/mattn/go-sqlite3"
"hack-browser-data/internal/browser/item"
"hack-browser-data/internal/decrypter"
)

View File

@ -9,6 +9,7 @@ import (
"github.com/tidwall/gjson"
"hack-browser-data/internal/browser/item"
"hack-browser-data/internal/utils"
_ "github.com/mattn/go-sqlite3"

View File

@ -6,6 +6,7 @@ import (
"sort"
"hack-browser-data/internal/browser/item"
"hack-browser-data/internal/utils"
_ "github.com/mattn/go-sqlite3"

View File

@ -10,6 +10,7 @@ import (
"time"
"hack-browser-data/internal/browser/item"
decrypter2 "hack-browser-data/internal/decrypter"
"hack-browser-data/internal/utils"

View File

@ -1,34 +1,7 @@
package item
import (
"hack-browser-data/internal/browser/data"
)
type Item int
const (
ChromiumKey Item = iota
ChromiumPassword
ChromiumCookie
ChromiumBookmark
ChromiumHistory
ChromiumDownload
ChromiumCreditCard
ChromiumLocalStorage
ChromiumExtension
YandexPassword
YandexCreditCard
FirefoxKey4
FirefoxPassword
FirefoxCookie
FirefoxBookmark
FirefoxHistory
FirefoxDownload
FirefoxCreditCard
FirefoxLocalStorage
FirefoxExtension
data2 "hack-browser-data/internal/data"
)
var DefaultFirefox = []Item{
@ -67,6 +40,33 @@ var DefaultChromium = []Item{
ChromiumExtension,
}
type Item int
const (
ChromiumKey Item = iota
ChromiumPassword
ChromiumCookie
ChromiumBookmark
ChromiumHistory
ChromiumDownload
ChromiumCreditCard
ChromiumLocalStorage
ChromiumExtension
YandexPassword
YandexCreditCard
FirefoxKey4
FirefoxPassword
FirefoxCookie
FirefoxBookmark
FirefoxHistory
FirefoxDownload
FirefoxCreditCard
FirefoxLocalStorage
FirefoxExtension
)
func (i Item) FileName() string {
switch i {
case ChromiumKey:
@ -161,40 +161,40 @@ func (i Item) String() string {
}
}
func (i Item) NewBrowsingData() data.BrowsingData {
func (i Item) NewBrowsingData() data2.BrowsingData {
switch i {
case ChromiumKey:
return nil
case ChromiumPassword:
return &data.ChromiumPassword{}
return &data2.ChromiumPassword{}
case ChromiumCookie:
return &data.ChromiumCookie{}
return &data2.ChromiumCookie{}
case ChromiumBookmark:
return &data.ChromiumBookmark{}
return &data2.ChromiumBookmark{}
case ChromiumDownload:
return &data.ChromiumDownload{}
return &data2.ChromiumDownload{}
case ChromiumLocalStorage:
return nil
case ChromiumCreditCard:
return &data.ChromiumCreditCard{}
return &data2.ChromiumCreditCard{}
case ChromiumExtension:
return nil
case ChromiumHistory:
return &data.ChromiumHistory{}
return &data2.ChromiumHistory{}
case YandexPassword:
return &data.ChromiumPassword{}
return &data2.ChromiumPassword{}
case YandexCreditCard:
return &data.ChromiumCreditCard{}
return &data2.ChromiumCreditCard{}
case FirefoxPassword:
return &data.FirefoxPassword{}
return &data2.FirefoxPassword{}
case FirefoxCookie:
return &data.FirefoxCookie{}
return &data2.FirefoxCookie{}
case FirefoxBookmark:
return &data.FirefoxBookmark{}
return &data2.FirefoxBookmark{}
case FirefoxDownload:
return &data.FirefoxDownload{}
return &data2.FirefoxDownload{}
case FirefoxHistory:
return &data.FirefoxHistory{}
return &data2.FirefoxHistory{}
default:
return nil
}

View File

@ -10,7 +10,7 @@ import (
"github.com/gocarina/gocsv"
jsoniter "github.com/json-iterator/go"
"hack-browser-data/internal/browser/data"
"hack-browser-data/internal/data"
)
type outPutter struct {