Hi Monks-

I would like to be able to read my Chrome cookies on a Mac.

My understanding is that I can use HTTP::Cookies::Chrome to do this. The following is an example script I pulled from the git repository and modified it for my Chrome profile.

When I run it I get the attached failure messages with no other output. Any help or pointers are much appreciated.

Thanks

Craig

Script:

#!/opt/homebrew/bin/perl use v5.10; use strict; use warnings; use Mojo::Util qw(dumper); use HTTP::Cookies::Chrome; my $class = 'HTTP::Cookies::Chrome'; #my $path = $class->guess_path; my $path = '/Users/cmv/Library/Application Support/Google/Chrome/P +rofile 1/Cookies'; my $password = $class->guess_password; say <<~"HERE"; File: $path Pass: $password HERE my $cookies = HTTP::Cookies::Chrome->new( chrome_safe_storage_password => $password, ignore_discard => 0, ); $cookies->load( $path ); $cookies->scan( \&summary ); sub summary { state $previous_domain = ''; my( @cookie ) = @_; say $cookie[4] unless $cookie[4] eq $previous_domain; $previous_domain = $cookie[4]; printf "\t%-5s %-16s %s\n", map { $_ // '' } @cookie[3,1,2]; }

Errors:

$ ./chromecookie.pl File: /Users/cmv/Library/Application Support/Google/Chrome/Profile 1/C +ookies Pass: XXXXXXXXXXXXXX Encrypted value is unexpected type <1> at ./chromecookie.pl line 27. Encrypted value is unexpected type <1> at ./chromecookie.pl line 27. Encrypted value is unexpected type <1> at ./chromecookie.pl line 27. Encrypted value is unexpected type <1> at ./chromecookie.pl line 27. ... Argument "v10?M-\f??&#695;M-^EM-^T>^YM-^EdtM-^F^Y??kM-\0&dkYh!M-^Q??M- +^F..." isn't numeric in division (/) at /Users/cmv/perl5/lib/perl5/HT +TP/Cookies/Chrome.pm line 451. Argument "v108M-^Q-^D<-?^Z?^K?vM-\r%M-^[K?7%?M-^\^UM-^_?3&#1381;M-^[&# +1760;?..." isn't numeric in division (/) at /Users/cmv/perl5/lib/perl +5/HTTP/Cookies/Chrome.pm line 451. Argument "v10????BA^G^D?dM-^TM-^A^Z???$^H]\n0??^^?:F?g??"^[G?EM-^H..." + isn't numeric in division (/) at /Users/cmv/perl5/lib/perl5/HTTP/Coo +kies/Chrome.pm line 451. ...

In reply to HTTP::Cookies::Chrome fails with Chrome cookies by cmv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.