Patch Example - RetroGuard Documentation
The generation of obfuscated patch files is easiest to understand through
an example. We consider the case where a company ships an initial
release (version 1.0) of its product, called "JTool", to its customers
through a website download.
To discourage reverse engineering of the product, the company obfuscates
their Jar file, called
The company then posts the obfuscated Jar jtool-1.0.jar
to its website, where it is downloaded by customers. The log-file
jtool-1.0.log contains all of the obfuscation mappings,
and so is archived carefully and securely by the company. This log-file will
be vital during the creation of future patches to the software.
Several weeks later, a customer reports a problem with the JTool product. It is found that fixing the problem requires only a small change to one class and to an associated resource file. While it would be possible to recompile and obfuscate the fixed software, and repost the whole Jar to the website, this is not an attractive option for JTool's customers because the whole Jar is several Mbytes in size and takes some time to download. A better alternative is to create a small patch file containing only the
modified class and resource. To do this, the whole JTool application is
first compiled and packaged into a Jar
Notice that instead of using the script file jtool-1.0.rgs
as input to this obfuscation, we have used the log-file from the
original (v1.0) obfuscation process. This log-file was generated in an
extended form of the RGS script format, and contains the original entry from
jtool-1.0.rgs as well as all the name mappings from the
first obfuscation process. Obfuscating in this way means that the
v1.1 code can be binary compatible with the originally shipped
v1.0 code.
All that remains is to extract the modified class and resource from the
The command to create the patch is then:
This utility works in two stages: first the log-file
jtool-1.1.log is used to convert the entries in
jtool-patch-1.0-1.1.txt to obfuscated form;
these converted entries are then extracted from
jtool-1.1.jar and used to create the file
jtool-patch-1.0-1.1.jar .
Once again, the log-file
they could now take advantage of the bug-fix by using the patch file:
(Note: a colon ':' is used to separate classpath entries in the example above.
This is correct on Unix systems - on Windows systems a semi-colon ';' should
be used instead.)
|
|