Advertisement
blaize9

Fernflower Readme

Sep 27th, 2011
9,534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.33 KB | None | 0 0
  1. 1. About the decompiler
  2.  
  3. Fernflower is the first actually working analytical decompiler for Java and
  4. probably for a high-level programming language in general. Naturally it is still
  5. under development, please send your bug reports and improvement suggestions at
  6.  
  7.  
  8. 2. License
  9.  
  10. See license_en.txt
  11.  
  12.  
  13. 3. Running from the command line
  14.  
  15. java -jar fernflower.jar [-<option>=<value>]* [<source>]+ <destination>
  16.  
  17. * means 0 or more times
  18. + means 1 or more times
  19.  
  20. <source>: file or directory with files to be decompiled. Directories are recursively scanned. Allowed file extensions are class, zip and jar.
  21. Sources prefixed with -e= mean "library" files that won't be decompiled, but taken into account when analysing relationships between
  22. classes or methods. Especially renaming of identifiers (s. option 'ren') can benefit from information about external classes.
  23. <destination>: destination directory
  24. <option>,<value>: command line option with the corresponding value, see 4.
  25.  
  26. Examples:
  27.  
  28. java -jar fernflower.jar -hes=0 -hdc=0 c:\Temp\binary\ -e=c:\Java\rt.jar c:\Temp\source\
  29.  
  30. java -jar fernflower.jar -dgs=1 c:\Temp\binary\library.jar c:\Temp\binary\Boot.class c:\Temp\source\
  31.  
  32.  
  33. 4. Command line options
  34.  
  35. With the exception of mpm and urc the value of 1 means the option is activated, 0 - deactivated. Default
  36. value, if any, is given between parentheses.
  37.  
  38. Typically, the following options will be changed by user, if any: hes, hdc, dgs, mpm, ren, urc
  39. The rest of options can be left as they are: they are aimed at professional reverse engineers.
  40.  
  41. rbr (1): hide bridge methods
  42. rsy (0): hide synthetic class members
  43. din (1): decompile inner classes
  44. dc4 (1): collapse 1.4 class references
  45. das (1): decompile assertions
  46. hes (1): hide empty super invocation
  47. hdc (1): hide empty default constructor
  48. dgs (0): decompile generic signatures
  49. occ (0): ouput copyright comment
  50. ner (1): assume return not throwing exceptions
  51. den (1): decompile enumerations
  52. rgn (1): remove getClass() invocation, when it is part of a qualified new statement
  53. bto (1): interpret int 1 as boolean true (workaround to a compiler bug)
  54. nns (1): allow for not set synthetic attribute (workaround to a compiler bug)
  55. uto (1): consider nameless types as java.lang.Object (workaround to a compiler architecture flaw)
  56. udv (1): reconstruct variable names from debug information, if present
  57. rer (1): remove empty exception ranges
  58. fdi (1): deinline finally structures
  59. asc (0): allow only ASCII characters in string literals. All other characters will be encoded using Unicode escapes (JLS 3.3). Default encoding is UTF8.
  60. mpm (0): maximum allowed processing time per decompiled method, in seconds. 0 means no upper limit.
  61. ren (0): rename ambiguous (resp. obfuscated) classes and class elements
  62. urc : full name of user-supplied class implementing IIdentifierRenamer. It is used to determine which
  63. class identifiers should be renamed and provides new identifier names. For more information
  64. s. section 5
  65.  
  66. The default logging level is INFO. This value can be overwritten by setting the option 'log' as follows:
  67.  
  68. log (INFO): possible values TRACE, INFO, WARN, ERROR
  69.  
  70.  
  71. 5. Renaming identifiers
  72.  
  73. Some obfuscators give classes and their member elements short, meaningless and above all ambiguous names. Recompiling of such
  74. code leads to a great number of conflicts. Therefore it is advisable to let the decompiler rename elements in its turn,
  75. ensuring uniqueness of each identifier.
  76.  
  77. Option 'ren' (i.e. -ren=1) activates renaming functionality. Default renaming strategy goes as follows:
  78. - rename an element if its name is a reserved word or is shorter than 3 characters
  79. - new names are built according to a simple pattern: (class|method|field)_<consecutive unique number>
  80. You can overwrite this rules by providing your own implementation of the 4 key methods invoked by the decompiler while renaming. Simply
  81. pass a class that implements de.fernflower.main.extern.IIdentifierRenamer in the option 'urc' (e.g. -urc=com.mypackage.MyRenamer) to
  82. Fernflower. The class must be available on the application classpath.
  83.  
  84. The meaning of each method should be clear from naming: toBeRenamed determine whether the element will be renamed, while the other three
  85. provide new names for classes, methods and fields respectively.
  86.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement