News for hackers. Stuff that matters.
Re:Static analysis of an unknown compression format by maximilianburke on Saturday April 07, 2012 @08:16PM (#3812555)
That's a fairly common compression technique on PS3 titles. Breaking the file into regularly sized chunks about 64kb (for lzma) permits decompression of the file in parallel on the SPUs as the dictionary and decompressed data can fit entirely in local store.

Since optical drives have terrible seek times and low bandwidth most assets are stored compressed on disc.

Re:Static analysis of an unknown compression format by aw3c2 on Saturday April 07, 2012 @12:31PM (#3811244)
Is there any tool to generate bitmaps from binary files? For example using each byte as grey value and letting the user specify the column width. Or with more than one byte and then using color.

Wouldn't this be a trivial and somewhat useful thing to see structure in binary files?

Re:Static analysis of an unknown compression format by someone13 on Saturday April 07, 2012 @02:53PM (#3811748)
Something I wrote a while back, using Python and PIL.

    import sys
    import math
    from PIL import Image

    def getSize(len, width):
        h = int(math.ceil(float(len) / width))
        return (width, h)
        
    def getImage(file, width=256):
        d = file.read()
        s = getSize(len(d), width)
        im = Image.new('L', s)
        im.putdata(d)
        return im
        
    def main():
        if len(sys.argv) < 2:
            print 'Usage: file2img.py <file> <output> [width]'
            return
            
        with open(sys.argv[1], 'rb') as f:
            if len(sys.argv) > 3:
                width = int(sys.argv[3])
                img = getImage(f, width)
            else:
                img = getImage(f)
            img.save(sys.argv[2])
        
    if __name__ == "__main__":
        main()
Here's a visualization of user32.dll on Windows. Notice how you can actually make out the images that are embedded in the resources!

http://i.imgur.com/7yEHR.png

Re:Static analysis of an unknown compression format by coderdude on Saturday April 07, 2012 @01:31PM (#3811454)
You might find this useful: http://corte.si/posts/visualisation/binvis/index.html

and related: http://corte.si/posts/visualisation/entropy/index.html (visualizing entropy in binary files)

I used his software on an unknown format from the 1988 game Circuit's Edge to find out if/where the file was encrypted or compressed. It works well and was able to give me a (very) general idea of where in the file I needed to look further.

Edit: Nope, I remembered incorrectly. I used it on the game's .exe to tell me if I was dealing with a compressed executable. It turned out that it was compressed and so I went on a search for an ancient unpacker.

See before and after:

edge.exe packed: http://imgur.com/PlHGl

edge.exe unpacked: http://imgur.com/jeFLb

Re:Static analysis of an unknown compression format by jof on Saturday April 07, 2012 @01:26PM (#3811435)
In my favorite static analysis toolset (Radare, http://radare.org/), there's a nice feature similar to this. It "zooms" out on a big file by summarizing portions of it into chunks and displaying colored ascii characters in a chart to represent the block.

With the entropy and ASCII printable filters setup, it makes repeating patterns and TEXT sections pretty clear.

Re:Static analysis of an unknown compression format by Someone on Saturday April 07, 2012 @03:21PM (#3811846)
It is very simple to create the binary versions of http://en.wikipedia.org/wiki/Netpbm_format from the command line, if you have that binary chunk in a file. Something like:

  echo P4 > file
  echo "640 480" >> file
  echo 255 >> file
  cat binaryBlob >> file
Re:Static analysis of an unknown compression format by frou_dh on Saturday April 07, 2012 @12:48PM (#3811283)
When doing simple graphics work at university, I would name files that contained nothing but pixel data foo.raw and IIRC some image editors would offer the options you mention when opening the files, then display them fine. Maybe that was before .raw got associated with cameras (and presumably more complex).
Re:Static analysis of an unknown compression format by throwaway64 on Saturday April 07, 2012 @01:07PM (#3811346)
raw (can be) interpreted from any stream of binary data, you can open EXEs in photoshop as RAW, save it as a PNG, transfer it, then resave it as a raw and it will run.
Re:Static analysis of an unknown compression format by tripzilch on Monday April 09, 2012 @02:33PM (#3818490)
Both GIMP and Photoshop can read any binary file as a "raw" file format, where you can specify the bit-depth (e.g. greyscale, RGB, RGBA, etc) and column width.
Re:Static analysis of an unknown compression format by fleitz on Saturday April 07, 2012 @02:58PM (#3811762)
Reminds me of reverse engineering an email archiving format used by EMC IIRC. It used an ancient PKZIP compression algorithm to compress COM IStream data and then wrapped the compressed data in what was essentially a proprietary linked list.
Re:Static analysis of an unknown compression format by ZephyrP on Saturday April 07, 2012 @07:34PM (#3812469)
I think this overlooks the classic technique of reverse engineers all over, IDA Pro!
Re:Static analysis of an unknown compression format by PaulHoule on Saturday April 07, 2012 @05:28PM (#3812181)
Funny, I was just about to start playing "Tales of Symphonia" when I read this...