Hacking Java Bytecode for Programmers (Part 2)
acloudtree.com
acloudtree.com
1. How was I supposed to know 0x19 was the relevant byte to look at? I know there should be a load opcode somewhere, how do I know it was that 0x19?
2. What's going on between the load opcode, and the actual string data about 120 bytes apart?
3. Is looking up the definition of an opcode from a list really a mnemonic device?
Maybe that last bit was a bit facetious.
- Opcodes exist - Here is one of many - Don't squish them
Edit: I also should mention that my style is a show/do. I'm trying to balance how much to tell the reader, but not bog them down.
In my next post we can take a look at the disassembler javap and dive in a bit more.
Of course, that's not to say it's a bad article. I just think you could have expanded quite a bit more.
this is good, about byteman, JRebel, tools like that
http://arhipov.blogspot.ie/2012/09/javazone-2012-taming-java...
I think for anyone with minimal assembly experience or a desire to learn this is pretty straight forward.
>>For example, you explain what op-codes are, but then only cover one of them.
He gives you a link to the list of all of the op codes... Did you read it?
>>I think at least a basic overview of common op-codes and how they work together would have been great
Maybe this is going to be in a follow up article. But after explaining the concept, giving you toy example and giving you the opcode list, with the provided hexdump you should be able to start doing this yourself. Try it! Its fun.
>>Also, the "hacking" you demonstrate is simply replacing a string, which is certainly not Java-specific and rarely useful
Intro to concept examples are often toy examples....
I had looked at Soot some time ago because of Dava, the Java decompiler included with the project.
Also, for programatic manipulation of bytecode, ASM is a great tool:
It includes a Java source generator which, given a .class file as input, produces a Java source class which will regenerate the input via the ASM builder APIs. Obviously, the benefit is that you get a starting point for building various re-writers, analyzes, etc.
I've never heard of soot. Thanks I've now starred it.
"The second, and this probably goes without saying, is that data is actually stored in the compilation using hexadecimal. "
It's stored in binary, your just using an editor that displays the hexadecimal representation.