0.13.68 Library - ZIP Access - Transparently - SDLrwops Example - ext/io Customization xor/io Obfuscation zip/no Encryption (2) - Library API basics extras =Parsing ZIPs - 64on32 extras - Next To Come fseeko mmapped memdisk - Config Helpers - Making a zip/exe =Hints And Links - Referentials - Functions List.. - zziplib.* - zzipmmapped.* - zzipfseeko.* - unix man pages   faq notes zip-php Download Area Developer Area GitHub Project Old SF Project zziplib.sf.net Home ChangeLog LGPL/MPL license -sitemap-
generated 2018-02-05
formatted by mksite.sh as xml: Library - 64on32 extras - Next To Come |
Now hosted on github.com/gdraheim/zziplib
The EXT/IO callsYou really should read the section about the EXT/IO feature of the zziplib since the obfuscation routines are built on top of it. In order to use obfuscation, you will generally need to use all the three additional argument that can be passsed to _open_ext_io functions. For the XOR-example, only one IO-handler is modified being the read()-call that will simply xor each data byte upon read with a specific value. It two advantages - doing an xor twice does yield the same data, so as a developer you do not have to wonder about the encryption/decryption pair, and it is a stateless obfuscation that does not need to know about the current position within the zip-datafile or zippedfile-datatream. The examples provided just use a simple routine for xoring data that is defined in all the three of the example programs: static int xor_value = 0x55; static zzip_ssize_t xor_read (int f, void* p, zzip_size_t l) { zzip_size_t r = read(f, p, l); zzip_size_t x; char* q = p; for (x=0; x < r; x++) q[x] ^= xor_value; return r; } and place this routine into the io-handlers after initializing the structure: zzip_init_io (&xor_handlers, 0); xor_handlers.read = &xor_read; The examples
There are three example programs. The first one is
zzxorcopy.c which actually is not a zziplib
based program. It just opens a file via stdio, loops through all data bytes
it can read thereby xor'ing it, and writes it out to the output file. A
call like The zzxordir.c program will open such an obfuscated zip file and decode the central directory of that zip. Everything is still there in just the way it can be shown with the normal unzip programs and routines. And the zzxorcat.c program can extract data from this obfuscated zip - and print it un-obfuscated to the screen. These example programs can help you jumpstart with your own set of obfuscator routines, possibly more complex ones. By the way, just compare those with their non-xor counterparts that you can find in zzdir.c and zzxorcat.c. Notice that the difference is in the setup part until the _open_ call after which one can just use the normal zzip_ routines on that obfuscated file. This is great for developing since you can start of with the magic-wrappers working on real-files then slowly turning to pack-files that hold most of the data and finally ending with a zip-only and obfuscated dat-file for your project.
|