18#if defined(_WIN32) && !defined(__MINGW32__) && (!defined(_MSC_VER) || _MSC_VER < 1600) && \
22typedef unsigned __int32 uint32_t;
23typedef unsigned __int8 bool;
40#define bincookie_is_secure(cookie_ptr) (cookie_ptr->flags & secure)
45#define bincookie_domain_access_full(cookie_ptr) \
46 (((char *)cookie_ptr + cookie_ptr->domain_offset)[0] == '.')
51#define bincookie_iter_state_init(s) \
58#define bincookie_domain(c) ((char *)c + c->domain_offset)
63#define bincookie_path(c) \
71#define bincookie_name(c) \
79#define bincookie_value(c) ((char *)c + c->value_offset)
81#define APPLE_EPOCH_OFFSET 978307200
86#define bincookie_expiration_time(c) \
87 (c->expiry_date_epoch + APPLE_EPOCH_OFFSET)
92#define bincookie_creation_time(c) \
93 (c->create_date_epoch + APPLE_EPOCH_OFFSET)
105 uint32_t page_offset;
112 unsigned char unk1[4];
114 unsigned char unk2[4];
116 uint32_t domain_offset;
117 uint32_t name_offset;
118 uint32_t path_offset;
119 uint32_t value_offset;
121 unsigned char unk[8];
123 double expiry_date_epoch;
124 double create_date_epoch;
129 unsigned char unk1[4];
131 uint32_t num_cookies;
132 uint32_t cookie_offsets[];
137 unsigned char magic[4];
139 uint32_t page_sizes[];
148 const long last_pos = ftell(fin);
152 size_t read = fread(magic,
sizeof(magic), 1, fin);
153 bool is_cook = magic[0] ==
'c' && magic[1] ==
'o' && magic[2] ==
'o' && magic[3] ==
'k';
154 if (read != 1 || !is_cook) {
159 fseek(fin, 0, SEEK_END);
160 size_t num_bytes = (size_t)ftell(fin);
166 memset(cook, 0, num_bytes);
169 if (fread(cook, num_bytes, 1, fin) != 1) {
176 for (uint32_t i = 0; i < cook->
num_pages; i++) {
180 fseek(fin, last_pos, SEEK_SET);
188static inline bincookie_t *
const bincookie_init_path(
const char *file_path) {
189 FILE *binary_file = fopen(file_path,
"rb");
193 bincookie_t *ret = bincookie_init_file(binary_file);
224 if (*i < page->num_cookies) {
bincookie_flag
Security enabled for a cookie.
Definition bincookie.h:107
@ http_only
Definition bincookie.h:109
@ secure
Definition bincookie.h:108
Cookie data structure.
Definition bincookie.h:119
Keeps track of iteration state when iterating cookie file pages.
Definition bincookie.h:113
uint32_t page_offset
Definition bincookie.h:114
uint32_t page_index
Definition bincookie.h:115
Cookie page structure. A page can consist of 1 or more cookies.
Definition bincookie.h:137
uint32_t cookie_offsets[]
Definition bincookie.h:141
bincookie file structure.
Definition bincookie.h:145
uint32_t num_pages
Definition bincookie.h:147
uint32_t page_sizes[]
Definition bincookie.h:148