binarycookies

Crates.iobinarycookies
lib.rsbinarycookies
version0.1.2
sourcesrc
created_at2024-01-18 03:53:59.125216
updated_at2024-01-19 02:34:15.619118
descriptionA package reader for Mac os cookie file
homepage
repositoryhttps://github.com/findre/binarycookies-reader
max_upload_size
id1103779
size19,297
Johnny Leaf (findre)

documentation

README

About Binarycookies-Reader

binarycookies is a program for deocde .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.deocde().unwrap();
    for pages in d.origin_pages() {
        for cookie in pages.cookies() {
            println!("{} | {} | {} | {}", cookie.domian_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.deocde().unwrap();
    for pages in d.origin_pages() {
        for cookie in pages.cookies() {
            println!("{} | {} | {} | {}", cookie.domian_str(), cookie.name_str(), cookie.value_str(), cookie.http_only);
        }
    }
}
Commit count: 0

cargo fmt