Skip to content

Latest commit

 

History

History
66 lines (56 loc) · 2.38 KB

README.md

File metadata and controls

66 lines (56 loc) · 2.38 KB

Disclaimer

This project is intended solely for educational and technical research purposes. It is strictly prohibited to use this tool for illegally obtaining others' data. Users must ensure they have legitimate access rights to the relevant files. The developer shall not be held responsible for any misuse or illegal activities resulting from the use of this project.

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 Address

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);
        }
    }
}

Reference