Skip to content
This repository was archived by the owner on Oct 22, 2019. It is now read-only.

Repository files navigation

BinaryCookies

Read and write Apple's .binarycookies files


Includes the BinaryCookies library and the dumpcookies executable.

Install dumpcookies with brew install interstateone/formulae/dump-cookies or build from source.

I've tested the BinaryCookies library with real-world .binarycookies files and generated files using the HTTPCookieStorage APIs. It's able to decode and re-encode these files with full fidelity, although there are currently two flags with unknown meanings.

File Format

File

FieldEndiannessTypeSizeDescription
MagicBEUTF-84"cook", no terminator
Number of pagesBEUnsigned Int4
Page N sizeBEUnsigned Int4Repeat for N pages
Page NPage N sizePage N content
ChecksumBEUnsigned Int4Sum every 4th byte for each page
FooterBE80x071720050000004b
MetadataBinary Property ListContains NSHTTPCookieAcceptPolicy value

Page

FieldEndiannessTypeSizeDescription
HeaderBE40x00000100
Number of cookiesLEUnsigned Int4
Cookie N offsetLEUnsigned Int4Repeat for N cookies
Footer40x00000000
Cookie NCookie N sizeCookie N content

Cookie

FieldEndiannessTypeSizeDescription
SizeLEUnsigned Int4Size in bytes
VersionLEUnsigned Int40 or 1
FlagsLEBit field4isSecure = 1, isHTTPOnly = 1 << 2, unknown1 = 1 << 3, unknown2 = 1 << 4
Has portLEUnsigned Int40 or 1
URL OffsetLEUnsigned Int4Offset from the start of the cookie
Name OffsetLEUnsigned Int4Offset from the start of the cookie
Path OffsetLEUnsigned Int4Offset from the start of the cookie
Value OffsetLEUnsigned Int4Offset from the start of the cookie
Comment OffsetLEUnsigned Int4Offset from the start of the cookie, 0x00000000 if not present
Comment URL OffsetLEUnsigned Int4Offset from the start of the cookie, 0x00000000 if not present
ExpirationLEDouble8Number of seconds since 00:00:00 UTC on 1 January 2001
CreationLEDouble8Number of seconds since 00:00:00 UTC on 1 January 2001
PortLEUnsigned Int2Only present if the "Has port" field is 1
CommentLEStringNull-terminated, optional
Comment URLLEStringNull-terminated, optional
URLLEStringNull-terminated
NameLEStringNull-terminated
PathLEStringNull-terminated
ValueLEStringNull-terminated

Reference

About

Read and write Apple's .binarycookies files

Topics

Resources

Stars

26 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages