Skip to content

Instantly share code, notes, and snippets.

View ricardo-heightshq's full-sized avatar

Ricardo Silva ricardo-heightshq

  • Dublin, Ireland
View GitHub Profile
@ricardo-heightshq
ricardo-heightshq / unwebarchive.rb
Created January 27, 2016 23:01 — forked from ktym/unwebarchive.rb
Extract contents of a .webarchive file.
#!/usr/bin/env ruby
#
# Mac OS X webarchive is a binary format of a plist file. You can extract the contents manually:
# 1. convert the plist file into XML by "plutil -convert xml1 file.webarchive"
# 2. parse the resulted XML file by some XML parser
# 3. decode "WebResourceData" by Base64.decode64(data) in each key
# 4. save the decoded content into a file indicated by "WebResourceData"
# Thankfully, the plist library can take care of annoying steps 2 and 3.
#
# Preparation: