binarycookies

Crates.iobinarycookies
lib.rsbinarycookies
version
sourcesrc
created_at2024-01-18 03:53:59.125216
updated_at2025-02-12 01:53:18.092489
descriptionA package reader for Mac os cookie file
homepage
repositoryhttps://github.com/findre/binarycookies-reader
max_upload_size
id1103779
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Johnny Leaf (findre)

documentation

README

About Binarycookies-Reader

binarycookies is a library for decoding .binarycookies files from Safari or WebKit.

The Safari cookies file, also known as the Safari binary cookies file (Cookies.binarycookies) format

More info: https://github.com/libyal/dtformats/blob/main/documentation/Safari%20Cookies.asciidoc

Github

https://github.com/findre/binarycookies-reader

About Errors

  • InvalidIndexOverBounds: cover index out of bounds, format error, cookie version invalid?
  • InvalidSignature: cookie file must start with 'cook'
  • InvalidStartCode: start code start with '[0x00, 0x00, 0x00, 0x00]'
  • EndCodeError
  • EndHeaderCodeError
  • DataOverSize
  • SystemIOError: when use 'new' fuction, cover io error

How to use

1. use 'from_vec' function

use std::{fs::File, io::Read};
use binary_cookies::BinaryCookiesReader;

fn main() {
    let mut target = File::open("/Users/foo/Library/HTTPStorages/boo.binarycookies").unwrap();
    let mut data = Vec::new();
    let _ = target.read_to_end(&mut data).unwrap();
    let mut d = BinaryCookiesReader::from_vec(&data);
    let _ = d.decode().unwrap();
    for pages in d.origin_pages() {
        for cookie in pages.cookies() {
            println!("{} | {} | {} | {}", cookie.domain_str(), cookie.name_str(), cookie.value_str(), cookie.http_only);
        }
    }
}

2. use 'new' function

use binary_cookies::BinaryCookiesReader;

fn main() {
    let target = String::from("/Users/foo/Library/HTTPStorages/boo.binarycookies");
    let mut dec = BinaryCookiesReader::new(&target).unwrap();
    let _ = d.decode().unwrap();
    for pages in d.origin_pages() {
        for cookie in pages.cookies() {
            println!("{} | {} | {} | {}", cookie.domain_str(), cookie.name_str(), cookie.value_str(), cookie.http_only);
        }
    }
}
Commit count: 21

cargo fmt