Tuesday, January 1, 2008

Simple look at the java bytecode through python.

Here is some python code for loading the java binary class format. It only returns the first couple of bytes and will only convert the bytecode format into a data structure. It won't parse the data. Maybe we can look at that in the future.

Some useful python libraries:

http://docs.python.org/lib/module-array.html

"struct -- Interpret strings as packed binary data"
http://docs.python.org/lib/module-struct.html

Source:
http://jvmnotebook.googlecode.com/svn/trunk/misc/bytecode/

http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc...

Another note, the java bytecode class is big-endian format and most of us work on little endian machines these days, just something to keep in mind.

No comments: