Created
September 23, 2014 06:51
-
-
Save dacort/bd6a5116224c594b14db to your computer and use it in GitHub Desktop.
Simple script to extract (encrypted) cookies out of Chrome OS X cookie store. Usage: ./cookiemonster domain.com
Anything for windows?
Please give a license on this code. I would like to reuse it / improve it.
@dolmen - Apologies, just saw your comment. License is MIT.
https://github.com/zellyn/kooky has a version that works in Safari too. I think they used yours as the basis for the Chrome piece. Example app (same syntax/params as cookiemonster.go
):
package main
import (
"fmt"
"os/user"
"os"
"time"
"github.com/zellyn/kooky"
)
func usage() {
fmt.Fprintf(os.Stderr, "usage: %s [domain]\n", os.Args[0])
os.Exit(2)
}
func main() {
if len(os.Args) != 2 {
usage()
}
domain := os.Args[1]
var cookies []*kooky.Cookie
var err error
usr, _ := user.Current()
// safari first
cookiesFile := fmt.Sprintf("%s/Library/Cookies/Cookies.binarycookies", usr.HomeDir)
cookies, err = kooky.ReadSafariCookies(cookiesFile, domain, "", time.Time{})
if len(cookies) == 0 {
// safari had none, try chrome
cookiesFile := fmt.Sprintf("%s/Library/Application Support/Google/Chrome/Default/Cookies", usr.HomeDir)
cookies, err = kooky.ReadChromeCookies(cookiesFile, domain, "", time.Time{})
}
if err != nil {
return
}
for _, cookie := range cookies {
fmt.Printf("%s/%s: %s\n", cookie.Domain, cookie.Name, cookie.Value)
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this, very helpful. The imports need updating now that it's 2016. But this worked great.