bincookie v0.1.7
A library to parse Apple's binarycookies format.
Loading...
Searching...
No Matches
bincookie.h File Reference

A parser for Apple's proprietary binary cookie storage format. More...

Go to the source code of this file.

Data Structures

struct  bincookie_iter_state_t
 Keeps track of iteration state when iterating cookie file pages. More...
 
struct  bincookie_page_t
 Cookie page structure. A page can consist of 1 or more cookies. More...
 
struct  bincookie_t
 bincookie file structure. More...
 

Macros

#define bincookie_is_secure(cookie_ptr)
 
#define bincookie_domain_access_full(cookie_ptr)
 Check if a cookie can be used on all subdomains of its original domain.
 
#define bincookie_iter_state_init(s)
 Initialise a bincookie_iter_state_t structure.
 
#define bincookie_domain(c)
 Get the domain of a cookie.
 
#define bincookie_path(c)
 Get the path of a cookie.
 
#define bincookie_name(c)
 Get the name of a cookie.
 
#define bincookie_value(c)
 Get the value of a cookie.
 
#define APPLE_EPOCH_OFFSET   978307200
 Difference between Apple's epoch (2001-01-01) and UNIX.
 
#define bincookie_expiration_time(c)
 Get the expiration time of a cookie.
 
#define bincookie_creation_time(c)
 Get the creation time of a cookie.
 

Enumerations

enum  bincookie_flag { secure , http_only }
 Security enabled for a cookie. More...
 

Functions

static bincookie_t *const bincookie_init_file (FILE *fin)
 Read a binarycookies file.
 
static bincookie_t *const bincookie_init_path (const char *file_path)
 Read a binarycookies file.
 
static bincookie_page_t *const bincookie_iter_pages (const bincookie_t *bc, bincookie_iter_state_t *const state)
 Iterate pages of a binarycookies file.
 
static bincookie_cookie_t *const bincookie_iter_cookies (const bincookie_page_t *page, unsigned int *i)
 Iterate cookies of a page.
 

Detailed Description

A parser for Apple's proprietary binary cookie storage format.

Based on the Python script by Satishb3 satis.nosp@m.hb3@.nosp@m.secur.nosp@m.ityl.nosp@m.earn..nosp@m.net

Definition in file bincookie.h.


Data Structure Documentation

◆ bincookie_iter_state_t

struct bincookie_iter_state_t

Keeps track of iteration state when iterating cookie file pages.

Definition at line 102 of file bincookie.h.

Data Fields
uint32_t page_index

Current page.

uint32_t page_offset

Current offset into the buffer.

◆ bincookie_cookie_t

struct bincookie_cookie_t

Cookie data structure.

Definition at line 108 of file bincookie.h.

Data Fields
double create_date_epoch

Creation date in Apple epoch format.

uint32_t domain_offset

Offset of the domain name.

double expiry_date_epoch

Expiry date in Apple epoch format.

bincookie_flag flags

Flags used with the cookie.

uint32_t name_offset

Offset of the name of the cookie.

uint32_t path_offset

Offset of the path.

uint32_t size

Size of the cookie data.

uint32_t value_offset

Offset of the value.

◆ bincookie_page_t

struct bincookie_page_t

Cookie page structure. A page can consist of 1 or more cookies.

Definition at line 126 of file bincookie.h.

Data Fields
uint32_t cookie_offsets[]

Cookie offset values.

uint32_t num_cookies

Number of cookies contained in this page.

◆ bincookie_t

struct bincookie_t

bincookie file structure.

Definition at line 134 of file bincookie.h.

Data Fields
unsigned char magic[4]

Magic: "cook"

uint32_t num_pages

Number of pages in this file

uint32_t page_sizes[]

Page sizes (same length as number of pages)

Macro Definition Documentation

◆ bincookie_creation_time

#define bincookie_creation_time ( c)

Get the creation time of a cookie.

Parameters
cPointer to a bincookie_cookie_t structure.

Definition at line 90 of file bincookie.h.

◆ bincookie_domain

#define bincookie_domain ( c)

Get the domain of a cookie.

Parameters
cPointer to a bincookie_cookie_t structure.

Definition at line 58 of file bincookie.h.

◆ bincookie_domain_access_full

#define bincookie_domain_access_full ( cookie_ptr)

Check if a cookie can be used on all subdomains of its original domain.

Parameters
cookie_ptrPointer to a bincookie_cookie_t structure.

Definition at line 45 of file bincookie.h.

◆ bincookie_expiration_time

#define bincookie_expiration_time ( c)

Get the expiration time of a cookie.

Parameters
cPointer to a bincookie_cookie_t structure.

Definition at line 84 of file bincookie.h.

◆ bincookie_is_secure

#define bincookie_is_secure ( cookie_ptr)

Check if a cookie has the secure bit enabled (only to be accessed over HTTPS).

Parameters
cookie_ptrPointer to a bincookie_cookie_t data structure.

Definition at line 40 of file bincookie.h.

◆ bincookie_iter_state_init

#define bincookie_iter_state_init ( s)

Initialise a bincookie_iter_state_t structure.

Parameters
sbincookie_iter_state_t structure.

Definition at line 51 of file bincookie.h.

◆ bincookie_name

#define bincookie_name ( c)

Get the name of a cookie.

Parameters
cPointer to a bincookie_cookie_t structure. \

Definition at line 70 of file bincookie.h.

◆ bincookie_path

#define bincookie_path ( c)

Get the path of a cookie.

Parameters
cPointer to a bincookie_cookie_t structure. \

Definition at line 63 of file bincookie.h.

◆ bincookie_value

#define bincookie_value ( c)

Get the value of a cookie.

Parameters
cPointer to a bincookie_cookie_t structure.

Definition at line 77 of file bincookie.h.

Enumeration Type Documentation

◆ bincookie_flag

Security enabled for a cookie.

A cookie can be either or these values or 2 or more values OR'd together.

Enumerator
secure 

Cookie can only be used with HTTPS

http_only 

Cookie cannot be accessed by JavaScript

Definition at line 96 of file bincookie.h.

Function Documentation

◆ bincookie_init_file()

static bincookie_t *const bincookie_init_file ( FILE * fin)
inlinestatic

Read a binarycookies file.

Parameters
finOpened file handle.
Returns
Pointer to a bincookie_t structure or NULL.

Definition at line 145 of file bincookie.h.

+ Here is the caller graph for this function:

◆ bincookie_init_path()

static bincookie_t *const bincookie_init_path ( const char * file_path)
inlinestatic

Read a binarycookies file.

Parameters
file_pathFile path string.
Returns
Pointer to a bincookie_t structure or NULL.

Definition at line 186 of file bincookie.h.

+ Here is the call graph for this function:

◆ bincookie_iter_cookies()

static bincookie_cookie_t *const bincookie_iter_cookies ( const bincookie_page_t * page,
unsigned int * i )
inlinestatic

Iterate cookies of a page.

Parameters
pagePointer to bincookie_page_t structure.
iPointer to an integer to keep track of index.
Returns
Pointer to a bincookie_cookie_t structure or NULL.

Definition at line 220 of file bincookie.h.

◆ bincookie_iter_pages()

static bincookie_page_t *const bincookie_iter_pages ( const bincookie_t * bc,
bincookie_iter_state_t *const state )
inlinestatic

Iterate pages of a binarycookies file.

Parameters
bcPointer to bincookie_t structure.
statePointer to bincookie_iter_state_t object.
Returns
Pointer to a bincookie_page_t structure or NULL.

Definition at line 201 of file bincookie.h.