From 115e1d29c66f55a178e0b440a5310d9bee56f51e Mon Sep 17 00:00:00 2001 From: Mingxing Liu Date: Wed, 19 Apr 2023 03:00:37 +0800 Subject: [PATCH] feat: support export session storage for chromium --- browingdata/browsingdata.go | 3 ++ browser/chromium/chromium.go | 4 +++ item/filename.go | 57 +++++++++++++++++++----------------- item/item.go | 11 +++++++ 4 files changed, 48 insertions(+), 27 deletions(-) diff --git a/browingdata/browsingdata.go b/browingdata/browsingdata.go index db63e6c..1693367 100644 --- a/browingdata/browsingdata.go +++ b/browingdata/browsingdata.go @@ -11,6 +11,7 @@ import ( "github.com/moond4rk/HackBrowserData/browingdata/history" "github.com/moond4rk/HackBrowserData/browingdata/localstorage" "github.com/moond4rk/HackBrowserData/browingdata/password" + "github.com/moond4rk/HackBrowserData/browingdata/sessionstorage" "github.com/moond4rk/HackBrowserData/item" "github.com/moond4rk/HackBrowserData/log" "github.com/moond4rk/HackBrowserData/utils/fileutil" @@ -89,6 +90,8 @@ func (d *Data) addSources(items []item.Item) { d.sources[source] = &creditcard.ChromiumCreditCard{} case item.ChromiumLocalStorage: d.sources[source] = &localstorage.ChromiumLocalStorage{} + case item.ChromiumSessionStorage: + d.sources[source] = &sessionstorage.ChromiumSessionStorage{} case item.ChromiumExtension: d.sources[source] = &extension.ChromiumExtension{} case item.YandexPassword: diff --git a/browser/chromium/chromium.go b/browser/chromium/chromium.go index ea024e0..924264c 100644 --- a/browser/chromium/chromium.go +++ b/browser/chromium/chromium.go @@ -69,6 +69,7 @@ func (c *Chromium) BrowsingData(isFullExport bool) (*browingdata.Data, error) { if err := data.Recovery(c.masterKey); err != nil { return nil, err } + return data, nil } @@ -81,6 +82,9 @@ func (c *Chromium) copyItemToLocal() error { if i == item.ChromiumLocalStorage { err = fileutil.CopyDir(path, filename, "lock") } + if i == item.ChromiumSessionStorage { + err = fileutil.CopyDir(path, filename, "lock") + } if i == item.ChromiumExtension { err = fileutil.CopyDirHasSuffix(path, filename, "manifest.json") } diff --git a/item/filename.go b/item/filename.go index 8810f53..7904f44 100644 --- a/item/filename.go +++ b/item/filename.go @@ -2,15 +2,16 @@ package item // item's default filename const ( - fileChromiumKey = "Local State" - fileChromiumCredit = "Web Data" - fileChromiumPassword = "Login Data" - fileChromiumHistory = "History" - fileChromiumDownload = "History" - fileChromiumCookie = "Cookies" - fileChromiumBookmark = "Bookmarks" - fileChromiumLocalStorage = "Local Storage/leveldb" - fileChromiumExtension = "Extensions" + fileChromiumKey = "Local State" + fileChromiumCredit = "Web Data" + fileChromiumPassword = "Login Data" + fileChromiumHistory = "History" + fileChromiumDownload = "History" + fileChromiumCookie = "Cookies" + fileChromiumBookmark = "Bookmarks" + fileChromiumLocalStorage = "Local Storage/leveldb" + fileChromiumSessionStorage = "Session Storage" + fileChromiumExtension = "Extensions" fileYandexPassword = "Ya Passman Data" fileYandexCredit = "Ya Credit Cards" @@ -29,26 +30,28 @@ const ( ) const ( - TempChromiumKey = "chromiumKey" - TempChromiumPassword = "password" - TempChromiumCookie = "cookie" - TempChromiumBookmark = "bookmark" - TempChromiumHistory = "history" - TempChromiumDownload = "download" - TempChromiumCreditCard = "creditCard" - TempChromiumLocalStorage = "localStorage" - TempChromiumExtension = "extension" + TempChromiumKey = "chromiumKey" + TempChromiumPassword = "password" + TempChromiumCookie = "cookie" + TempChromiumBookmark = "bookmark" + TempChromiumHistory = "history" + TempChromiumDownload = "download" + TempChromiumCreditCard = "creditCard" + TempChromiumLocalStorage = "localStorage" + TempChromiumSessionStorage = "sessionStorage" + TempChromiumExtension = "extension" TempYandexPassword = "yandexPassword" TempYandexCreditCard = "yandexCreditCard" - TempFirefoxKey4 = "firefoxKey4" - TempFirefoxPassword = "firefoxPassword" - TempFirefoxCookie = "firefoxCookie" - TempFirefoxBookmark = "firefoxBookmark" - TempFirefoxHistory = "firefoxHistory" - TempFirefoxDownload = "firefoxDownload" - TempFirefoxLocalStorage = "firefoxLocalStorage" - TempFirefoxCreditCard = "" - TempFirefoxExtension = "firefoxExtension" + TempFirefoxKey4 = "firefoxKey4" + TempFirefoxPassword = "firefoxPassword" + TempFirefoxCookie = "firefoxCookie" + TempFirefoxBookmark = "firefoxBookmark" + TempFirefoxHistory = "firefoxHistory" + TempFirefoxDownload = "firefoxDownload" + TempFirefoxLocalStorage = "firefoxLocalStorage" + TempFirefoxSessionStorage = "firefoxSessionStorage" + TempFirefoxCreditCard = "" + TempFirefoxExtension = "firefoxExtension" ) diff --git a/item/item.go b/item/item.go index 06bea3f..9d8576e 100644 --- a/item/item.go +++ b/item/item.go @@ -11,6 +11,7 @@ const ( ChromiumDownload ChromiumCreditCard ChromiumLocalStorage + ChromiumSessionStorage ChromiumExtension YandexPassword @@ -24,6 +25,7 @@ const ( FirefoxDownload FirefoxCreditCard FirefoxLocalStorage + FirefoxSessionStorage FirefoxExtension ) @@ -41,6 +43,8 @@ func (i Item) FileName() string { return fileChromiumDownload case ChromiumLocalStorage: return fileChromiumLocalStorage + case ChromiumSessionStorage: + return fileChromiumSessionStorage case ChromiumCreditCard: return fileChromiumCredit case ChromiumExtension: @@ -88,6 +92,8 @@ func (i Item) String() string { return TempChromiumDownload case ChromiumLocalStorage: return TempChromiumLocalStorage + case ChromiumSessionStorage: + return TempChromiumSessionStorage case ChromiumCreditCard: return TempChromiumCreditCard case ChromiumExtension: @@ -112,6 +118,8 @@ func (i Item) String() string { return TempFirefoxHistory case FirefoxLocalStorage: return TempFirefoxLocalStorage + case FirefoxSessionStorage: + return TempFirefoxSessionStorage case FirefoxCreditCard: return UnsupportedItem case FirefoxExtension: @@ -155,6 +163,7 @@ var DefaultFirefox = []Item{ FirefoxDownload, FirefoxCreditCard, FirefoxLocalStorage, + FirefoxSessionStorage, FirefoxExtension, } @@ -168,6 +177,7 @@ var DefaultYandex = []Item{ ChromiumExtension, YandexPassword, ChromiumLocalStorage, + ChromiumSessionStorage, YandexCreditCard, } @@ -181,5 +191,6 @@ var DefaultChromium = []Item{ ChromiumDownload, ChromiumCreditCard, ChromiumLocalStorage, + ChromiumSessionStorage, ChromiumExtension, }