Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] - Read contents of ZIP files

Author
Message
Phaelax
DBPro Master
16
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 29th Jan 2013 09:47
Still in early stages, but this will display the info of the archived files. And if the zip archive used no compression (store method) the it will extract the files.

I need a little more time studying the DEFLATE algorithm, but the whole concept for a zip extractor is here.



"You're not going crazy. You're going sane in a crazy world!" ~Tick
zeroSlave
9
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 5th Feb 2013 20:19
This is a great example of memblock usage! It's neat to see how a .zip file is compressed and stored. I assume with this method, one could theoretically find and/or remove a password for a zip file.

My guess at uncompressing a file would be to find the dictionary of redundant replacement data(an index at the beginning of the .zip?), catalogue all replacements into an array or memblock, make a memblock the size of the target file's uncompressed size, replace each instance of compressed data from the original memblock into the new one by reference, then save the memblock to file as it's filename. I'd assume the new file's header information would be possibly compressed, but still intact?

I know there is more to it, such as actually finding/storing all the information from the replacement index into arrays or memblocks, getting the size in bytes of each entry, then cross referencing the current compressed data with the replacement array, inserting the uncompressed data while keeping track of the memblock pointer, etc, etc, etc, etc. I dunno. Just my uneducated guess.

Plus, there is that whole thing about coding it.

Either way, this is neat. I can see it being turned into a pretty handy set of functions or a plugin for some user defined/compressed/encrypted .pak files and such.

Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.
Phaelax
DBPro Master
16
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 6th Feb 2013 03:01 Edited at: 12th Feb 2013 09:54
Quote: " I assume with this method, one could theoretically find and/or remove a password for a zip file."

I don't think it's quite that easy. I haven't looked at the passwords yet, but I believe they're coded into each file perhaps.
Update: As of zip 5.2, the format allows for AES encryption. And no I don't know how to crack it.


Quote: " find the dictionary of redundant replacement data(an index at the beginning of the .zip?),"

The index of all archived files is actually at the end of the file.


I've updated the code slightly. It should find the central directory more efficiently now. The time difference noticed is most likely negligible on smaller files.

V.2


"You're not going crazy. You're going sane in a crazy world!" ~Tick

Login to post a reply

Server time is: 2019-04-25 00:50:30
Your offset time is: 2019-04-25 00:50:30