Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does anybody know what a zbook file is? Or how I can open it?

Tags:

file

sqlite

unzip

I heard that it is a sqlite table just zipped up, but I cannot find anyway to open it up and access it contents. The file I'm needing to crack open is a book, and it's filename is book.zbook...

If you have any ideas, let me know please!

like image 506
Stephen J. Avatar asked Jul 24 '11 04:07

Stephen J.


1 Answers

I've never worked with zbook files before, but I do have a fair bit of experience with "just compressed" file formats and SQLite and you're in luck. They could've been using the commercial SQLite Compressed and Encrypted Read-Only Database (CEROD) extension, but they're not.

.zbook is an SQLite3 database packed by raw zlib compression. (Gzip without a header, basically)

Here's some minimal code to unpack it in Python:

import zlib

infile = open('AntiguoTestamento.zbook', 'rb')
outfile = open('AntiguoTestamento.sqlite3', 'wb')

outfile.write(zlib.decompress(infile.read()))

infile.close()
outfile.close()

I'm actually a bit surprised at that. "Just zipped up" usually means the base format of the file is XML or HTML or something custom like bytecode or binary blobs since SQLite isn't really designed to be loaded from an archive that way.

like image 166
ssokolow Avatar answered Nov 08 '22 13:11

ssokolow