bb_mug a Java class obfuscator

Overview

bb_mug is a simple, tiny and fast Java class obfuscator.
This software is published under our NON COMMERCIAL LICENSE. If you plan to use any of this software in a commercial product, contact the author for conditions and permissions.
Read, understand and accept the disclaimer before download and using bb_mug.
It is simple since there are not many options
It is tiny because it was coded smart
It is fast due to efficient algorithms

Download &

dateinfodownload
2011-08-31version v1.7.1 fixed package rename with inner classesde.bb.product.bb_mug-1.7.1.jar
2011-08-30version v1.7.0 added package renaming and log file supportde.bb.product.bb_mug-1.7.0.jar
2006-02-28version v1.5 fixes issues with mangled referenced membersbb_mugV1.5.zip

What does bb_mug do?

  1. Where applicable bb_mug replaces class, method and field names with shorter names.
  2. It removes all informations which are not required for execution.
  3. If specified, packages are renamed
This means that you MUST apply tools like a verifier to the classes created by bb_mug.

Usage of bb_mug

USAGE: java -jar bb_mug.jar [-?] [-l <logfile>] [-p <package>=<newpackage>] <inpath> <outpath>
  -?            display this message
  -l <logfile>  write mapping info into file
  -p <package>=<newpackage>  rename <package> to <newpackage>
bb_mug.jar $Revision: 1.6 $ (c) 2002-2011 by Stefan Bebbo Franke

There are not many options since it follows the default visibility paradigm:
  1. public elements are not obfuscated
  2. protected elements are not obfuscated, since they might be visible to external derived classes
  3. package local and private members are always obfuscated
  4. specifed packages are renamed to new names.
If you believe that a public method should be obfuscated you should reconsider why it is public.

Usage from command line

My command line looks like
java -jar /tools/bb_mug.jar <inpath> <outpath>

Usage from ANT

My ANT targets look like
    <target name="mug" depends="init" >
        <mkdir dir="${class.final}"/>
        <java classname="de.bb.mug.Main" fork="yes">
          <arg value="${class.src}"/>
          <arg value="${class.final}"/>
          <classpath>
            <pathelement path="${java.class.path}"/>
            <pathelement location="tools/bb_mug.jar" />
          </classpath>
        </java>
    </target>

Usage from BNM (or Maven)

I am using the exec-plugin to run the tool while accessing the de.bb.tools.mug artifact from the repository.
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-exec-plugin</artifactId>
	<dependencies>
		<dependency>
			<groupId>de.bb.tools</groupId>
			<artifactId>mug</artifactId>
			<version>1.7.1</version>
		</dependency>
	</dependencies>
	<executions>
		<execution>
			<id>mug</id>
			<phase>compile</phase>
			<goals>
				<goal>java</goal>
			</goals>
			<configuration>
				<arguments>
					<argument>-l</argument>
					<argument>${project.build.directory}/mug.log</argument>
                             <argument>-p</argument>
                             <argument>de.bb.util=de.bb.tools.mug.u</argument>
					<argument>${project.build.directory}/used</argument>
					<argument>${project.build.directory}/classes</argument>
				</arguments>
				<includePluginDependencies>true</includePluginDependencies>
				<includeProjectDependencies>false</includeProjectDependencies>
				<mainClass>de.bb.tools.mug.Main</mainClass>
			</configuration>
		</execution>
	</executions>
</plugin>

legal info

Disclaimer of Warranty

Software is provided "AS IS," without a warranty of any kind. You may use it on your own risk.

Limitation of Liability

I SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY YOU OR ANY THIRD PARTY AS A RESULT OF USING OR DISTRIBUTING SOFTWARE. IN NO EVENT WILL I BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF I HAVE ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

Copyright

(c) 2002-2011 by BebboSoft, Stefan "Bebbo" Franke, all rights reserved
rev: 1.6