to Home Page CafeBabe (JDK1.1.x + Swing 1.1 or JDK1.2). This program will say you all about contents of complied code for JVM. It works as a graphical disassembler and displays full information about any sort of information enclosed in bytecode: field, methods, attributes, exceptions, synthetic members, method body, additional information inside code and so on. While virtual machine misses unknown attributes, CafeBabe displays all of them. Pay attention how progam works with archives - it interpret them as a directories and how it uses advanced features of JFileChooser from Jeff Dinkins. For information view I use a modern component - TreeTable2 from Philip Milne, Scott Violet and Kathy Walrath -- a Swing developers.
 

Main interface of CafeBabe

cafe_screen1.jpg (74902 bytes)

Description

The main goal of CafeBabe project is to offer for developers complete and convenient suite of tools that operate directly with bytecodes.

The core of CafeBabe project is ClassFile library that allows reading, modification and writing of bytecodes.

Main features of CafeBabe project are:

  • program represents bytecodes "as is" - following the class file format specification: magic number, minor and major version, constant pool, access flags, this class, super class, interfaces, fields, methods and class attributes;
  • program can read class files directly from archive (*.zip or *.jar) and it interprets them as directories, thereby you can travel inside archive for selecting desired file;
  • program contains abilities for searching string inside bytecode;
  • user can edit information inside constant pool (UTF8-string);
  • ability to remove some optional information from bytecodes: inside methods body, source file attribute, unknown attributes;
  • ability to perform migration of bytecodes disposed inside package from old to new namespace;
  • ability to perform obfuscation of bytecodes disposed inside packages;
  • ability to show/hide partitions of classfile.
  • user can use this program as a tutorial - tooltips will explain to user what each byte (short, integer) inside bytecode means;
  • user can quickly change its own location among installed classes and observe hierarchy tree (see Class-Hound Service);

Solving tasks: today and future

CafeBabe will be useful for solving the following tasks:

1. Tutorial task

Any new tool should teach user -- otherwise it becomes meaningless tool. CafeBabe's main window represents bytecode structure directly, following the class file format specification.

CafeBabe supports tutorial mode -- in this case user can see tooltips for any branch/leaf/cell of main tree-table. Tooltips discover sense of each byte/short/int inside bytecode.

You can receive another tutorial issue playing with Class-Hound service. Like a wise dog, this service is quickly talking you all about installed archives and including with these archives classes, it will show memberships (list of fields and methods) and hierarchy tree for selected class and by your request will load selected class to main tree-table window.

Class-Hound service has a great educational importance because it proposes live information about really existing classes, fields and methods vs. information, presented in documentation. Also this service produces short information without any extra unwanted info.

2. Optimization task

You can optimize your product from command line (javac -O or javac -g:none) but for that you must recompile whole project. Sometimes it can be undesired solution - f.e. you have no sources. Just run strip task from CafeBabe (for selected file or for group of files) and select what do you want to remove: "SourceFile" attribute, unknown attribute or debugging information inside method body. Some tools add own labels to bytecode when processing it (f.e. SourceGuard from 4thpass) -- try to remove unwished tags.

Other task for optimization is to find all methods that can be declared as final and set up method modifier to final value on bytecode level. We can name such task as finalize task and it will be realized in nearest future.

3. Hacker task

CafeBabe gives you an ability to edit constant pool entries - now UTF8 only. It is not limit -- only author's flavour. I can add an ability to edit other types of entries, but I think it is meaningless - all they ultimately refer to UTF8 strings.

4. Obfuscation task

User have an ability to protect application's codes from easy understanding for outer developers. CafeBabe analyzes proposed classes, find dependencies between them and solves obfuscation task. You can select what items you want to obfuscate: packages, classes, fields or methods. In addition you can move all classes from different packages to anonymous package. This approach is greatly decreases size of project.

5. Migration Task

If you have Swing program (bytecodes only), written with old namespace conventions (com.sun.java.swing) and now you work with new namespace conventions (javax.swing), migration tool will help you. Just run migration task from CafeBabe (for selected file or for group of files) and you'll receive desired results.

Author think that migration is a sort of obfuscation when you don't change names for classes, fields and methods, only for packages by using information from specified migration table. Exactly this way is realized in Cafebabe.

Note: this task works on bytecode level, thereby you can solve such task without a presence of sources.

6. Creational task - in future

User will have an ability to create new bytecodes "from scratch", add new fields, methods, attributes, constant pool entries and test created class. It can be useful for persons who like VM but hate Java :-).

7. Decompilation task - in future

User will have an ability to decompile entire class or selected method only.

Class-Hound Service in action...


cafe_screen2.jpg (95717 bytes)

 

Copyright (c) 1999 All rights reserved

1