refactor: format project layout

pull/121/head
ᴍᴏᴏɴD4ʀᴋ 3 years ago
parent 4f7adf3db7
commit 87a026a13e
  1. 2
      cmd/cmd.go
  2. 2
      internal/browser/browser.go
  3. 2
      internal/browser/browser_test.go
  4. 2
      internal/browser/chromium/chromium.go
  5. 2
      internal/browser/firefox/firefox.go
  6. 0
      internal/data/bookmark.go
  7. 0
      internal/data/browsingdata.go
  8. 1
      internal/data/cookie.go
  9. 1
      internal/data/creditcard.go
  10. 1
      internal/data/download.go
  11. 1
      internal/data/history.go
  12. 1
      internal/data/password.go
  13. 84
      internal/item/item.go
  14. 2
      internal/outputter/outputter.go

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

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

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

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

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

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

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

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

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

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

@ -1,34 +1,7 @@
package item package item
import ( import (
"hack-browser-data/internal/browser/data" data2 "hack-browser-data/internal/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
) )
var DefaultFirefox = []Item{ var DefaultFirefox = []Item{
@ -67,6 +40,33 @@ var DefaultChromium = []Item{
ChromiumExtension, 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 { func (i Item) FileName() string {
switch i { switch i {
case ChromiumKey: 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 { switch i {
case ChromiumKey: case ChromiumKey:
return nil return nil
case ChromiumPassword: case ChromiumPassword:
return &data.ChromiumPassword{} return &data2.ChromiumPassword{}
case ChromiumCookie: case ChromiumCookie:
return &data.ChromiumCookie{} return &data2.ChromiumCookie{}
case ChromiumBookmark: case ChromiumBookmark:
return &data.ChromiumBookmark{} return &data2.ChromiumBookmark{}
case ChromiumDownload: case ChromiumDownload:
return &data.ChromiumDownload{} return &data2.ChromiumDownload{}
case ChromiumLocalStorage: case ChromiumLocalStorage:
return nil return nil
case ChromiumCreditCard: case ChromiumCreditCard:
return &data.ChromiumCreditCard{} return &data2.ChromiumCreditCard{}
case ChromiumExtension: case ChromiumExtension:
return nil return nil
case ChromiumHistory: case ChromiumHistory:
return &data.ChromiumHistory{} return &data2.ChromiumHistory{}
case YandexPassword: case YandexPassword:
return &data.ChromiumPassword{} return &data2.ChromiumPassword{}
case YandexCreditCard: case YandexCreditCard:
return &data.ChromiumCreditCard{} return &data2.ChromiumCreditCard{}
case FirefoxPassword: case FirefoxPassword:
return &data.FirefoxPassword{} return &data2.FirefoxPassword{}
case FirefoxCookie: case FirefoxCookie:
return &data.FirefoxCookie{} return &data2.FirefoxCookie{}
case FirefoxBookmark: case FirefoxBookmark:
return &data.FirefoxBookmark{} return &data2.FirefoxBookmark{}
case FirefoxDownload: case FirefoxDownload:
return &data.FirefoxDownload{} return &data2.FirefoxDownload{}
case FirefoxHistory: case FirefoxHistory:
return &data.FirefoxHistory{} return &data2.FirefoxHistory{}
default: default:
return nil return nil
} }

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