Coder Social home page Coder Social logo

kooky's Introduction

kooky

PkgGoDev Go Report Card Lines of code No Maintenance Intended PRs Welcome MIT license

Reaching into browser-specific, vaguely documented, possibly concurrently modified cookie stores to pilfer cookies is a bad idea. Since you've arrived here, you're almost certainly going to do it anyway. Me too. And if we're going to do the Wrong Thing, at least let's try to Do it Right.

Package kooky contains routines to reach into cookie stores for Chrome, Firefox, Safari, ... and retrieve the cookies.

It aspires to be pure Go (I spent quite a while making go-sqlite/sqlite3 work for it).

It also aspires to work for all major browsers, on all three major platforms.

Status

Basic functionality works on Windows, MacOS and Linux. Some functions might not yet be implemented on some platforms. The API is currently not expected to be at all stable.

PRs more than welcome.

TODOs

  • Set up CI
  • Make it work on Windows. (Look at this and this to learn how to decrypt.)
  • Handle rows in Chrome's cookie DB with other than 14 columns (?)

Example usage

Any Browser - Cookie Filter Usage

package main

import (
	"fmt"

	"github.com/browserutils/kooky"
	_ "github.com/browserutils/kooky/browser/all" // register cookie store finders!
)

func main() {
	// uses registered finders to find cookie store files in default locations
	// applies the passed filters "Valid", "DomainHasSuffix()" and "Name()" in order to the cookies
	cookies := kooky.ReadCookies(kooky.Valid, kooky.DomainHasSuffix(`google.com`), kooky.Name(`NID`))

	for _, cookie := range cookies {
		fmt.Println(cookie.Domain, cookie.Name, cookie.Value)
	}
 }

Chrome on macOS

package main

import (
	"fmt"
	"log"
	"os"

	"github.com/browserutils/kooky/browser/chrome"
)

func main() {
	dir, _ := os.UserConfigDir() // "/<USER>/Library/Application Support/"
	cookiesFile := dir + "/Google/Chrome/Default/Cookies"
	cookies, err := chrome.ReadCookies(cookiesFile)
	if err != nil {
		log.Fatal(err)
	}
	for _, cookie := range cookies {
		fmt.Println(cookie)
	}
}

Safari

package main

import (
	"fmt"
	"log"
	"os"

	"github.com/browserutils/kooky/browser/safari"
)

func main() {
	dir, _ := os.UserHomeDir()
	cookiesFile := dir + "/Library/Cookies/Cookies.binarycookies"
	cookies, err := safari.ReadCookies(cookiesFile)
	if err != nil {
		log.Fatal(err)
	}
	for _, cookie := range cookies {
		fmt.Println(cookie)
	}
}

Thanks/references

kooky's People

Contributors

adamdecaf avatar barnardb avatar kenshaw avatar srlehn avatar werelord avatar zellyn avatar zippoxer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kooky's Issues

Publish an unstable module branch

Looks like there was a lot of new functionality added that allows me refactor some existing code (cookie jars) for some of my projects. I would assume these changes are experimental, so best left for a branch stated as such.

However, go mod will still only resolve to [email protected] where in certain functionality isn't available, this means I either have to look at vendoring, which even then is still iffy, and annoying to implement.

Would be good to actually just republish the module to the new namespace properly too, rather than rely on any redirecting, might be confusing for new comers of the package, where they will get errors like:

go: finding module for package github.com/browserutils/kooky/firefox
go: finding module for package github.com/browserutils/kooky
go: found github.com/browserutils/kooky in github.com/browserutils/kooky v0.2.0
go: found github.com/browserutils/kooky/firefox in github.com/browserutils/kooky v0.2.0
go: github.com/myproject/myproject/pkg/cookiepilf imports
        github.com/browserutils/kooky: github.com/browserutils/[email protected]: parsing go.mod:
        module declares its path as: github.com/zellyn/kooky
                but was required as: github.com/browserutils/kooky

Thanks!

Thank you, very helpful project!

Hi, @zellyn and @srlehn

I just wanted to take a moment to express my gratitude for this project. Although it is no longer actively maintained, I wanted to let you know that it is still working well and has been a great help to me. I appreciate the time and effort you guys put into creating and maintaining it, and your contributions to the open source community are truly appreciated. Thank you.

MacOSX deprecated warning

github.com/keybase/go-keychain

cgo-gcc-prolog:53:11: warning: 'SecKeychainItemDelete' is deprecated: first deprecated in macOS 10.10 - SecKeychain is deprecated [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Headers/SecKeychainItem.h:257:10: note: 'SecKeychainItemDelete' has been explicitly marked deprecated here

panic: crypto/cipher: input not full blocks

windows 10,go1.16.12,chrome 98.

try to get cookies from %UserProfile%\AppData\Local\Google\Chrome\User Data\Default\Network\Cookies.
return error.

panic: crypto/cipher: input not full blocks

goroutine 1 [running]:
crypto/cipher.(*cbcDecrypter).CryptBlocks(0xc00004e190, 0xc0000127c0, 0x3c, 0x3c
, 0xc000012483, 0x3c, 0x3c)
        C:/Go/src/crypto/cipher/cbc.go:119 +0x4e9
github.com/zellyn/kooky/internal/chrome.decryptAESCBC(0xc000012480, 0x3f, 0x3f, 
0xc00000e400, 0x20, 0x20, 0x3eb, 0x0, 0x0, 0x0, ...)
        C:/Users/xxx/go/pkg/mod/github.com/zellyn/[email protected]
87b89e95f98f/internal/chrome/chrome.go:306 +0x20e
github.com/zellyn/kooky/internal/chrome.(*CookieStore).decrypt.func2(0xc00001248
0, 0x3f, 0x3f, 0xc00000e400, 0x20, 0x20, 0x0, 0x0, 0x0, 0xccc060, ...)
        C:/Users/xxx/go/pkg/mod/github.com/zellyn/[email protected]
87b89e95f98f/internal/chrome/chrome.go:223 +0x7d
github.com/zellyn/kooky/internal/chrome.(*CookieStore).decrypt(0xc00010fbc0, 0xc
000012480, 0x3f, 0x3f, 0x0, 0x0, 0x0, 0xc000012480, 0x3f)
        C:/Users/xxx/go/pkg/mod/github.com/zellyn/[email protected]
87b89e95f98f/internal/chrome/chrome.go:261 +0x38b
github.com/zellyn/kooky/internal/chrome.(*CookieStore).ReadCookies.func1(0xc0000
19018, 0xc000142900, 0xc00004e140, 0x6e, 0x6e)
        C:/Users/xxx/go/pkg/mod/github.com/zellyn/[email protected]
87b89e95f98f/internal/chrome/chrome.go:104 +0x506
github.com/zellyn/kooky/internal/utils.VisitTableRows.func1(0xc000019018, 0x13, 
0xc000000700, 0x12, 0x20, 0xc00014a0a4, 0x6e, 0x6e, 0xc000178000, 0x12, ...)    
        C:/Users/xxx/go/pkg/mod/github.com/zellyn/[email protected]
87b89e95f98f/internal/utils/visittablerows.go:25 +0x9c
github.com/go-sqlite/sqlite3.(*btreeTable).visitRecordsInorder.func1(0x0, 0xc000
019018, 0xc00014a090, 0x82, 0x82, 0x0, 0x82, 0x0)
        C:/Users/xxx/go/pkg/mod/github.com/go-sqlite/[email protected]
5335-53dd8e640ee7/btree.go:431 +0x175
github.com/go-sqlite/sqlite3.(*btreeTable).visitRawInorder(0xc00004c300, 0xc0001
0f740, 0xc000172000, 0x1000)
        C:/Users/xxx/go/pkg/mod/github.com/go-sqlite/[email protected]
5335-53dd8e640ee7/btree.go:395 +0x17b
github.com/go-sqlite/sqlite3.(*btreeTable).visitRawInorder(0xc00004c2a0, 0xc0001
0f740, 0x5000000000000, 0x2e08c700f50c92)
        C:/Users/xxx/go/pkg/mod/github.com/go-sqlite/[email protected]
5335-53dd8e640ee7/btree.go:387 +0x2c9
github.com/go-sqlite/sqlite3.(*btreeTable).visitRecordsInorder(0xc00004c2a0, 0xc
00010f8f8, 0xc000167000, 0x1000)
        C:/Users/xxx/go/pkg/mod/github.com/go-sqlite/[email protected]
5335-53dd8e640ee7/btree.go:424 +0x68
github.com/go-sqlite/sqlite3.(*DbFile).VisitTableRecords(0xc00001d2b0, 0xc66b5f,
 0x7, 0xc00010f8f8, 0xc000055730, 0x0)
        C:/Users/xxx/go/pkg/mod/github.com/go-sqlite/[email protected]
5335-53dd8e640ee7/file.go:313 +0x2b8
github.com/zellyn/kooky/internal/utils.VisitTableRows(0xc00001d2b0, 0xc66b5f, 0x
7, 0xc00010f9f0, 0xc00010fa20, 0x0, 0x4c)
        C:/Users/xxx/go/pkg/mod/github.com/zellyn/[email protected]
87b89e95f98f/internal/utils/visittablerows.go:24 +0x266
github.com/zellyn/kooky/internal/chrome.(*CookieStore).ReadCookies(0xc00010fbc0,
 0x0, 0x0, 0x0, 0x9d0f69, 0x2, 0xcc69d8, 0x1, 0x1)
        C:/Users/xxx/go/pkg/mod/github.com/zellyn/[email protected]
87b89e95f98f/internal/chrome/chrome.go:37 +0x245
github.com/zellyn/kooky/chrome.ReadCookies(0xc0000163c0, 0x4c, 0x0, 0x0, 0x0, 0x
0, 0x0, 0x0, 0x0, 0x0)
        C:/Users/xxx/go/pkg/mod/github.com/zellyn/[email protected]
87b89e95f98f/chrome/chrome.go:24 +0x113

Error reading Safari cookies on Big Sur

Attempting to run the example safari script https://github.com/zellyn/kooky#safari on Big Sur.

Getting this error:

2020/11/19 11:46:05 open /Users/eric/Library/Cookies/Cookies.binarycookies: operation not permitted

Even as sudo doesn't work, also tried granting the binary full disk access in settings, no luck.

Has anyone been able to get this to work? Chrome works fine on Big Sur

chrome cookie is not work when using chrome browser

chrome.CookieJar(store.FilePath()) is not working, when using chrome browser an show error is

open C:\Users\dvgamerr\AppData\Local\Google\Chrome\User Data\Default\Network\Cookies: The process cannot access the file because it is being used by another process.

but working if close all chrome app

Cannot read cookies from Chrome 96

  • OS: Windows 10 21H1 (OS Build 19043.1348)
  • Browser: 96.0.4664.93 (Official Build) (64-bit)
  • Kooky Version: v0.0.0-20210408152652-87b89e95f98f

On windows, it seems Chrome 96+ has moved the cookie store to %LOCALAPPDATA%\Google\Chrome\User Data\Default\Network\Cookies, which is a SQLite database that seems to contain cookie metadata and encrypted cookie values. However, when I point kooky at this database file, it can't seem to decrypt the cookies stored here (I first noticed this a few days ago when my template generator for Advent of Code stopped being able to download input files):

package main

import (
	"fmt"
	"net/http"
	"os"
	"path/filepath"
	"runtime"

	"github.com/zellyn/kooky"
	"github.com/zellyn/kooky/chrome"
)

func chromeCookiePath() (string, error) {
	if p, set := os.LookupEnv("CHROME_PROFILE_PATH"); set {
		return filepath.Join(p, "Cookies"), nil
	}

	if runtime.GOOS == "windows" {
		localAppData, err := os.UserCacheDir()
		return filepath.Join(localAppData, "Google", "Chrome", "User Data", "Default", "Network", "Cookies"), err
	}

	return "", fmt.Errorf("chrome cookie path for GOOS %s not implemented, set CHROME_PROFILE_PATH instead", runtime.GOOS)
}
func main() {
	cookiePath, err := chromeCookiePath()
	if err != nil {
		panic(err)
	}

	cookies, err := chrome.ReadCookies(cookiePath, kooky.Valid, kooky.Name("session"), kooky.Domain(".adventofcode.com"))
	if err != nil {
		panic(err)
	}

	req, err := http.NewRequest(http.MethodHead, "https://adventofcode.com/2021/leaderboard/self", nil)
	if err != nil {
		panic(err)
	}

	sessionToken := cookies[0].HTTPCookie()
	req.AddCookie(&sessionToken)

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}

	fmt.Println(resp.Status)
}

This panics with:

C:\Users\Nathan\projects\kooky-test> go run main.go
panic: crypto/cipher: input not full blocks

goroutine 1 [running]:
crypto/cipher.(*cbcDecrypter).CryptBlocks(0x92cd20, {0xc00000c680, 0xc000018f30, 0xc000018f20}, {0xc00000c543, 0x9, 0x3eb})
        C:/Program Files/Go/src/crypto/cipher/cbc.go:119 +0x478
github.com/zellyn/kooky/internal/chrome.decryptAESCBC({0xc00000c540, 0x3f, 0x3f}, {0xa79798, 0xd, 0xd}, 0xb)
        C:/Users/Nathan/go/pkg/mod/github.com/zellyn/[email protected]/internal/chrome/chrome.go:306 +0x182
github.com/zellyn/kooky/internal/chrome.(*CookieStore).decrypt.func2({0xc00000c540, 0x1, 0x3f}, {0xa79798, 0x65676f, 0xaf6380})
        C:/Users/Nathan/go/pkg/mod/github.com/zellyn/[email protected]/internal/chrome/chrome.go:223 +0x29
github.com/zellyn/kooky/internal/chrome.(*CookieStore).decrypt(0xc00011bc50, {0xc00000c540, 0x8c8ecf, 0xf})
        C:/Users/Nathan/go/pkg/mod/github.com/zellyn/[email protected]/internal/chrome/chrome.go:261 +0x924
github.com/zellyn/kooky/internal/chrome.(*CookieStore).ReadCookies.func1(0x20, {0xc00014cf30, 0xc00006a140})
        C:/Users/Nathan/go/pkg/mod/github.com/zellyn/[email protected]/internal/chrome/chrome.go:104 +0x43c
github.com/zellyn/kooky/internal/utils.VisitTableRows.func1(0xc000068240, {{0x13, {0xc000000600, 0x12, 0x20}}, {0xc00015a014, 0x6d, 0x6d}, {0xc00015e000
, 0x12, ...}})
        C:/Users/Nathan/go/pkg/mod/github.com/zellyn/[email protected]/internal/utils/visittablerows.go:25 +0x97
github.com/go-sqlite/sqlite3.(*btreeTable).visitRecordsInorder.func1({0x0, 0xc000018e68, {0xc00015a000, 0x81, 0x81}, 0x0})
        C:/Users/Nathan/go/pkg/mod/github.com/go-sqlite/[email protected]/btree.go:431 +0x135
github.com/go-sqlite/sqlite3.(*btreeTable).visitRawInorder(0xc0000682a0, 0xc00011b7f8)
        C:/Users/Nathan/go/pkg/mod/github.com/go-sqlite/[email protected]/btree.go:395 +0x232
github.com/go-sqlite/sqlite3.(*btreeTable).visitRawInorder(0xc000068240, 0xc00011b7f8)
        C:/Users/Nathan/go/pkg/mod/github.com/go-sqlite/[email protected]/btree.go:387 +0x1dc
github.com/go-sqlite/sqlite3.(*btreeTable).visitRecordsInorder(0x5, 0x8)
        C:/Users/Nathan/go/pkg/mod/github.com/go-sqlite/[email protected]/btree.go:424 +0x45
github.com/go-sqlite/sqlite3.(*DbFile).VisitTableRecords(0xc00001f110, {0x8c6630, 0xc000156711}, 0xd)
        C:/Users/Nathan/go/pkg/mod/github.com/go-sqlite/[email protected]/file.go:313 +0x20d
github.com/zellyn/kooky/internal/utils.VisitTableRows(0xc00001f110, {0x8c6630, 0x7}, 0x8, 0xc00011baa0)
        C:/Users/Nathan/go/pkg/mod/github.com/zellyn/[email protected]/internal/utils/visittablerows.go:24 +0x1ef
github.com/zellyn/kooky/internal/chrome.(*CookieStore).ReadCookies(0xc00011bc50, {0xc00011bd90, 0x3, 0x3})
        C:/Users/Nathan/go/pkg/mod/github.com/zellyn/[email protected]/internal/chrome/chrome.go:37 +0x20e
github.com/zellyn/kooky/chrome.ReadCookies({0xc000016280, 0xc00011be38}, {0xc00011bd90, 0xa7d1c0, 0xc000053d30})
        C:/Users/Nathan/go/pkg/mod/github.com/zellyn/[email protected]/chrome/chrome.go:24 +0xdc
main.main()
        C:/Users/Nathan/projects/kooky-test/main.go:32 +0x106
exit status 2

implement chrome_darwin.go without the need of cgo

chrome_darwin.go currently needs a C compiler for the dependency github.com/keybase/go-keychain.
This makes cross compilation difficult.

I see 2 alternatives: the "security" command line tool which is installed by default (?) or querying the keychain with syscall.

I think the best way is to translate the cgo parts to syscall like https://github.com/jaraco/keyring/blob/master/keyring/backends/_OS_X_API.py.

Is this package secure?

I noticed that some packages with very low stars have been included. I think this repository should prioritize security.

Firefox support

When testing I could not find my cookie from Firefox. It might be due to the Multi-account container plugin. However I was testing without a container tab. It did work on Chrome for me.

Running Firefox version 92.0 (64-bits)

Maybe this has to do with the anti tracking features of Firefox.

Had an issue with chrome/edge specific cookie

Error was: Crypto/Cipher: input not full blocks

and it's tracing back to decrypt function when using edge.ReadCookies(fPath)/chrome.ReadCookies(fPath) for ubuntu and windows

function throwing the error: CryptBlocks @ if len(src)%x.BlockSize != 0

Help wanted, column index out of bound

OS: macOS 11.2.3 (20D91)
Browser: Google Chrome: Version 89.0.4389.114 (Official Build) (x86_64)
library version: github.com/zellyn/kooky v0.0.0-20201108220156-bec09c12c339

testing codes:

func TestBrowserCookiesReading(t *testing.T) {
	dir, _ := os.UserConfigDir() // "/<USER>/Library/Application Support/"
	cookiesFile := dir + "/Google/Chrome/Default/Cookies"
	cookies, err := chrome.ReadCookies(cookiesFile)
	if err != nil {
		log.Fatal(err)
	}
	for _, cookie := range cookies {
		fmt.Println(cookie)
	}
}

output:

=== RUN   TestBrowserCookiesReading
2021/04/08 16:57:05 column index out of bound

firefox ReadCookies: lengh of record value can be 15

The table of firefox cookies has 15 elements, here is the CREATE statements of moz_cookies:

CREATE TABLE moz_cookies (id INTEGER PRIMARY KEY, 
originAttributes TEXT NOT NULL DEFAULT '', 
name TEXT, 
value TEXT, 
host TEXT, 
path TEXT, 
expiry INTEGER, 
lastAccessed INTEGER, 
creationTime INTEGER, 
isSecure INTEGER, 
isHttpOnly INTEGER, 
inBrowserElement INTEGER DEFAULT 0, 
sameSite INTEGER DEFAULT 0, 
rawSameSite INTEGER DEFAULT 0, 
schemeMap INTEGER DEFAULT 0, 
CONSTRAINT moz_uniqueid UNIQUE (name, host, path, originAttributes));

firefox version:

Version 82.0.2 (64-bit)

so the code below should be modified:
https://github.com/zellyn/kooky/blob/808dae4f4a60b391c2f5ef187b09dfe8391a1cb8/internal/firefox/firefox.go#L59-L61

None of the Package Examples work with go mod tidy

Running go mod tidy for the first example, I get

go: finding module for package github.com/browserutils/kooky/browser/all
go: finding module for package github.com/browserutils/kooky
go: found github.com/browserutils/kooky in github.com/browserutils/kooky v0.2.0
go: test.test imports
        github.com/browserutils/kooky: github.com/browserutils/[email protected]: parsing go.mod:
        module declares its path as: github.com/zellyn/kooky
                but was required as: github.com/browserutils/kooky

For the second one, I get

go: finding module for package github.com/browserutils/kooky/browser/chrome
go: test.test imports
        github.com/browserutils/kooky/browser/chrome: module github.com/browserutils/kooky@latest found (v0.2.0), but does not contain package github.com/browserutils/kooky/browser/chrome

For the third one, I get

go: finding module for package github.com/browserutils/kooky/browser/safari
go: test.test imports
        github.com/browserutils/kooky/browser/safari: module github.com/browserutils/kooky@latest found (v0.2.0), but does not contain package github.com/browserutils/kooky/browser/safari

I suspect the recent changes to your go.mod file in #71 are incomplete have made this package unusable for new users.

go project test failed

--- FAIL: TestReadChromeCookies (0.00s)
    chrome_test.go:15: decrypting cookie &{news.ycombinator.com user / 2038-01-18 03:14:07.876554 +0800 CST true true 2017-12-01 23:16:48.876554 +0800 CST }: invalid last block padding length: 45: data: [179 253 56 38 169 34 115 145 202 140 207 229 191 230 98 155 41 248 116 150 242 39 244 189 255 159 8 141 94 139 239 34 28 248 166 22 55 181 236 211 85 244 95 72 159 124 136 45]
FAIL
exit status 1
FAIL	github.com/zellyn/kooky	0.003s

I have modified the error output of function aesStripPadding. So the value of data can be seen.

Prefix tag names with `v`

To play nice with go modules you need to prefix the version tags with v, e.g. v0.2.0, otherwise you have to pin to commits.

If interested, see golang/go#32945 for all the historical discussion.

Unable to read cookies form chrome for windows from 18/9/2023

cookies := kooky.ReadCookies(kooky.Valid, kooky.Name("ABC"))

fmt.Println("cookies", &cookies)
for _, cookie := range cookies {
	token_value = cookie.Value
	fmt.Println("Name " + cookie.Name + " :value " + cookie.Value)
}

Note : the same is working for Mac.
Till last week able to cookie from chrome, but from 18/09/2023 we are facing an issue with windows.
Can anyone Please help us that would be great.

Safari cookie file path is different in Ventura (MacOS 13).

When I was trying to read cookies from Safari, I got stuck. After searching, I found that the cookie file is different which is in ~/Library/Containers/com.apple.Safari/Data/Library/Cookies.

I have fixed this bug and I will create a PR with this issue.

Firfox cookies unable to be found with domain filter

Finding cookies via chrome was working but once I switched to firefox it no longer works.

The sites i'm reading cookies for will set these cookies at a sub-domain like .$env.$tld

When ReadCookies is called for chrome it uses the host_key as the domain which is that sub domain shown above
https://github.com/browserutils/kooky/blob/master/internal/chrome/chrome.go#L45

However in the Firefox implementation it's doing a tld domain lookup which only returns and sets the tld on the cookie, which fails the domain filter
https://github.com/browserutils/kooky/blob/master/internal/firefox/firefox.go#L51

This is also stored in firefox's sql lite at the sub domain level.

Why do the TLD look-up there? Should this not just return the host as the domain?

go.mod file still referencing github.com/zellyn/kooky

In go.mod file we are still referencing github.com/zellyn/kooky because of which a new go mod init followed with go mod tidy will fail when importing kooky project to the new project.
Will get error -
github.com/browserutils/kooky: github.com/browserutils/[email protected]: parsing go.mod:
module declares its path as: github.com/zellyn/kooky
but was required as: github.com/browserutils/kooky

This is due to in https://github.com/browserutils/kooky/blob/master/cmd/kooky/kooky.go#L11 we still refer to github.com/zellyn/kooky

Can't get cookies properly

I can't get cookies on both Win7 and Win10 platforms.

Os: windows 10
Chrome: 94

Test Code:

package main

import (
	"fmt"
	"github.com/zellyn/kooky/chrome"
	"log"
	"os"
	"runtime"
)

func UserHomeDir() string {
	if runtime.GOOS == "windows" {
		home := os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH")
		if home == "" {
			home = os.Getenv("USERPROFILE")
		}
		return home
	}
	return os.Getenv("HOME")
}

func main() {
	homeDir := UserHomeDir()
	cookiesFile := homeDir + "\\AppData\\Local" + "\\Google\\Chrome\\User Data\\Default\\Cookies"

	cookies, err := chrome.ReadCookies(cookiesFile)

	if err != nil {
		log.Fatal(err)
	}
	for _, cookie := range cookies {
		fmt.Println(cookie)
	}
}

win10 error message :

2021/10/16 16:41:12 expected column [encrypted_value] to be []byte; got string with value v104�ڥ 8��D�Vy������7( ��И?G; :�<х�f���JO�턻�|'�(J��_�

Os: windows 7
Chrome: 94

win7 error message :

panic: crypto/cipher: input not full blocks

goroutine 1 [running]:
crypto/cipher.(*cbcDecrypter).CryptBlocks(0x11c90150, 0x11cba3c0, 0x41, 0x41, 0x
11cba003, 0x41, 0x41)

But I can get cookies normally using python's browser_cookie3 package

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.