First a little explanation of what I'm trying to do. I am writing a Java (1.7) application that will attempt to "fuzz" XML messages sent over ActiveMQ, using the OpenWire format from a producer to a target consumer. The intent is to gauge how the target responds to the fuzzed messages sent to it. I am using ActiveMQ version 5.12.1 on Linux CentOS 6.6.
There is an XML schema which defines the message types that will be sent. I have separate programs that generate sample instances of these messages and identifies where information is found in the wire format sent (OpenWire in this case). This information will be used in the fuzzing process to know the location of the data to change.
Part of the fuzzing process involves capturing the wire format message off the wire, making the change and forwarding the modified message on to the target. I have been able to successfully modify data and send it forward, as long as I have changed only content and not length. If the modification results in a change in length, the connection to the ActiveMQ server closes and the program fails.
Research indicates that the OpenWire messages all start with a 4 byte integer, representing the length of the following message data. I changed my code to adjust that length to reflect the change made to the test data. That did not work. After some more investigation, I discovered that just changing the length field was not the right thing to do - but it was not obvious what should (or could) be done.
I'm getting a strong impression, that the best thing to do would be to use the ActiveMQ API to re-marshal the modified message data and forward that on to the target. I have no idea if that's an option available to me.
I've tried to find information to help me determine the structure of the OpenWire messages involved so that I can know what I need to do when modifying the message. I started looking at the ActiveMQ javadocs and found the openwire packages. Perhaps I can utilize these to effect the changes I need to make and to have them successfully forwarded via ActiveMQ and received by the target.
Is there any documentation or sample code that provides instruction or examples of how to properly use this API to do what I need? Based on what I've described, is this something that is doable using the API? Any help would be appreciated. Thanks.
Have a look at http://camel.apache.org There is no need to interpret the wire format directly. Can even run in amq server.