667481 members! Sign up to stay informed.

Sponsored Links


Resources

Enterprise Java
Research Library

Get Java white papers, product information, case studies and webcasts

News News News Messages: 17 Messages: 17 Messages: 17 Printer friendly Printer friendly Printer friendly Post reply Post reply Post reply XML XML XML

ProGuard 1.5: Open Source Class File Shrinker / Obfuscator

Posted by: Dion Almaer on January 13, 2003 DIGG
A new version, 1.5, of ProGuard has been released on SourceForge. ProGuard is a Java class file shrinker and obfuscator, that can detect and remove unused classes, fields, methods, and attributes. It can then rename the remaining classes, fields, and methods using short meaningless names.

Changes for Version 1.5:

Fixed processing of retrofitted library interfaces
Fixed processing of .class constructs in internal classes targeted at JRE1.2 (the default in JDK1.4)
Fixed -dump option when -outjar option is not present
Updated documentation and examples

Check out ProGuard

Do many of you obfuscate your code?

What obfuscators do you use?

Threaded replies

·  ProGuard 1.5: Open Source Class File Shrinker / Obfuscator by Dion Almaer on Mon Jan 13 14:22:25 EST 2003
  ·  Yes by Arne Vajhøj on Tue Jan 14 07:11:14 EST 2003
  ·  Is it configurable? by James Birchfield on Tue Jan 14 09:31:15 EST 2003
    ·  Never by Arne Vajhøj on Tue Jan 14 10:05:37 EST 2003
      ·  Obscurity or Size? by Dave Wolf on Tue Jan 14 10:42:33 EST 2003
        ·  for obscurity by Raju Saripalli on Tue Jan 14 11:07:06 EST 2003
        ·  Why obfuscate ? by Arne Vajhøj on Wed Jan 15 02:56:07 EST 2003
      ·  Common Things can Foil Obfuscation by Craig Pfeifer on Thu Jan 16 09:31:01 EST 2003
        ·  Thanks for the Leasons Learned. by Mark Nuttall on Thu Jan 16 11:15:38 EST 2003
        ·  Not my experience by Arne Vajhøj on Thu Jan 16 12:37:53 EST 2003
        ·  Class.forName() by Marc Logemann on Thu Jan 23 08:00:37 EST 2003
    ·  Is it configurable? by Vlad Ender on Tue Jan 14 15:19:30 EST 2003
      ·  with a test suite ... by Domingo Sebastian on Wed Jan 15 03:04:10 EST 2003
  ·  J2ME can't breathe without an obfuscator! by Yuri Magrisso on Tue Jan 14 17:59:31 EST 2003
  ·  Proguard article by Yuri Magrisso on Tue Jan 14 18:12:54 EST 2003
  ·  Incremental Obfuscation by Arnaud Brochard on Wed Jan 15 03:54:11 EST 2003
  ·  Other obfuscators: Alphaworks JAX by David Hamilton on Wed Jan 15 04:53:25 EST 2003
  ·  ProGuard 1.5: Open Source Class File Shrinker / Obfuscator by Eric Lafortune on Sat Jan 18 12:13:51 EST 2003
  Message #70871 Post reply Post reply Post reply Go to top Go to top Go to top

Yes

Posted by: Arne Vajhøj on January 14, 2003 in response to Message #70775
Yes - I use an obfuscater whenever delivering jar files
to external customers.

I use an old piece of software called JMangle.

Old, but easy to use and apperently does the job well.

  Message #70885 Post reply Post reply Post reply Go to top Go to top Go to top

Is it configurable?

Posted by: James Birchfield on January 14, 2003 in response to Message #70775
One thing I would worry about with code chrinkers is the removal of methods it 'thinks' are unnecessary. I was using IDEA to inspect some code last night and found several methods in which the IDE thought could be removed. But we are using Digester for some of our code and relying upon reflection to invoke the methods when necessary. I would assume this software would think these methods were not used as well since they are never 'directly' called in code.

Any one have experience with similar situations?

Jim

  Message #70891 Post reply Post reply Post reply Go to top Go to top Go to top

Never

Posted by: Arne Vajhøj on January 14, 2003 in response to Message #70885
I would never let an obfuscator delete methods.

Too many things can go wrong.

  Message #70898 Post reply Post reply Post reply Go to top Go to top Go to top

Obscurity or Size?

Posted by: Dave Wolf on January 14, 2003 in response to Message #70891
Why are people using obfuscators? Is it for security through obscurity or for the size/performance impacts?

Dave Wolf

  Message #70902 Post reply Post reply Post reply Go to top Go to top Go to top

for obscurity

Posted by: Raju Saripalli on January 14, 2003 in response to Message #70898
I use them to prevent access to easily understandable source code. Size/performance is not one of the reasons.

  Message #70927 Post reply Post reply Post reply Go to top Go to top Go to top

Is it configurable?

Posted by: Vlad Ender on January 14, 2003 in response to Message #70885
I don't think anything should ever remove public classes and/or methods. You might be deploying your jar as a library and then.. Not to mention reflection etc.
Removing unused private methods is safe though. (if you're doing reflection on private methods I would say something is wrong with your code..)
All the rest is debatable and should be probably configurable.
Regards,
Vlad

  Message #70936 Post reply Post reply Post reply Go to top Go to top Go to top

J2ME can't breathe without an obfuscator!

Posted by: Yuri Magrisso on January 14, 2003 in response to Message #70775
I am currently developping J2ME applications and there I can surely say you can't deploy any serious application without obfuscation. And Proguard does a great job there!
In J2ME the main benefit of obfuscation is in shrinking the size of the code.

I have used Retroguard (www.retrologic.com) but from my experience Proguard produces about 5% smaller jars.

The security aspect is also important but it is not gonna be as easy to get the jar file of the J2ME application once OTA capable phones become available as it is with applets.

In J2ME the removal of unused methods and classes is of great help, because otherwise I would have to do it by hand. Without such a tool it won't be possible to write a descent J2ME library. I'll have to rip it off in every application and it will be just easier to write a lot of stuff a new.

Does anybody know if Proguard removes methods that are not called at all, or methods which call stacks are not invoked?

  Message #70937 Post reply Post reply Post reply Go to top Go to top Go to top

Proguard article

Posted by: Yuri Magrisso on January 14, 2003 in response to Message #70775
There is a useful article about Proguard and MIDlet obfuscation at
http://wireless.java.sun.com/midp/ttips/proguard/
that includes a class to integrate Proguard with Sun's Wireless Toolkit

  Message #70956 Post reply Post reply Post reply Go to top Go to top Go to top

Why obfuscate ?

Posted by: Arne Vajhøj on January 15, 2003 in response to Message #70898
To make reverse engineering sligthly more difficult !

  Message #70958 Post reply Post reply Post reply Go to top Go to top Go to top

with a test suite ...

Posted by: Domingo Sebastian on January 15, 2003 in response to Message #70927
Maybe if you have a good test suite for your application you can remove unused classes more safety.

  Message #70961 Post reply Post reply Post reply Go to top Go to top Go to top

Incremental Obfuscation

Posted by: Arnaud Brochard on January 15, 2003 in response to Message #70775
this software do not manage incremental obfuscation which is essential to incremental jar update in java web start for example (in fact a few does !)

  Message #70965 Post reply Post reply Post reply Go to top Go to top Go to top

Other obfuscators: Alphaworks JAX

Posted by: David Hamilton on January 15, 2003 in response to Message #70775
What does it do that JAX http://alphaworks.ibm.com/tech/JAX didn't do in 1998?!

I know that it hasn't been developed (at least in the Alphaworks version) since then, but IIRC, JAX also does method devirtualisation, class merging and other stuff...

I haven't needed to use it for a long time, but the only issue I remember having with it was that it took ages to work through all the features and work out what they did...

  /david

  Message #71072 Post reply Post reply Post reply Go to top Go to top Go to top

Common Things can Foil Obfuscation

Posted by: Craig Pfeifer on January 16, 2003 in response to Message #70891
I was taked with adding obfuscation to a medium-sized client/sever pair w/java 1.1 and here were my observations:

- any methods that are accesssed via reflection need to be excluded from obfuscation

- any classes that are loaded via Class.forName("foo") need to be excluded from obfuscation

- properly obfuscating swing applications is very difficult due to the dynamic nature of the swing components

- expect to spend several iterations of full regression sweeps to validate the obfuscated product

- if you are adding obfuscation late in the development cycle, expect to produce parallel builds (obfuscated and non obfuscated) so that QA can repro bugs. One big problem with debugging obfuscated code is the fact that you will not get a stack trace that's meaningful.

- obfuscation will drastically reduce your jarsize and your memory footprint

- good luck patching an obfuscated applicaiton in the field. You will probably have to redeliver a new jar instead of just the updated classes.

  Message #71079 Post reply Post reply Post reply Go to top Go to top Go to top

Thanks for the Leasons Learned.

Posted by: Mark Nuttall on January 16, 2003 in response to Message #71072
Thanks for sharing Craig.

  Message #71086 Post reply Post reply Post reply Go to top Go to top Go to top

Not my experience

Posted by: Arne Vajhøj on January 16, 2003 in response to Message #71072
A good obfuscater allows you to specify that public
class/member/method names are not to be mangled.

A good obfuscator produces a map of mangled names that can
be used to analyze a stacktrace.

My experience with JMangle is just run it and ship the
result and forget about it.

OK - it has also been our experience that we need
to distribute full jars. But we would have wanted to
do that anyway.

  Message #71239 Post reply Post reply Post reply Go to top Go to top Go to top

ProGuard 1.5: Open Source Class File Shrinker / Obfuscator

Posted by: Eric Lafortune on January 18, 2003 in response to Message #70775
Thank you all for your interest in ProGuard. Even when processor speeds and memory capacity are increasing all the time, I personally liked the idea of my code being made a bit leaner, without much effort. For simple applications or libraries, processing the code can be trivial. For code that uses a lot of introspection, shrinking and obfuscation can be more complicated.

In any case, ProGuard was designed to be easily configurable, so it can scale with increasingly complex code. For example, ProGuard accepts the following option:

-keep public class * extends java.applet.Applet

This would preserve all public applets, including other classes, methods, and fields that are required in the output jar. Note that ProGuard automatically recognizes Class.forName calls with constant string arguments. It also gives hints about other classes that you may want to keep because they might be created dynamically.

Similarly, one can preserve all applications in the input jars:

-keepclasseswithmembers public class * {
    public static void main(java.lang.String[]);
}

In some cases, one wants to preserve all classes that implement an interface:

-keep public class mypackage.** implements MyInterface

The templates allow to quickly specify entire groups of classes, methods, and fields, constraining them based on their access flags, names, interfaces or superclasses, and class members. The templates are more resilient against changes than, say, a fixed set of names. This simple and robust configuration is probably the chief advantage of ProGuard compared to other obfuscators. Please feel free to download it and report your experiences.

Eric (author of ProGuard).

  Message #71801 Post reply Post reply Post reply Go to top Go to top Go to top

Class.forName()

Posted by: Marc Logemann on January 23, 2003 in response to Message #71072
- any classes that are loaded via Class.forName("foo") need to be excluded from obfuscation

This is IMO not true for ProGuard.

New content on TheServerSide.comNew content on TheServerSide.comNew content on TheServerSide.com

Dependency Injection in Java EE 6 - Part 1

Reza Rahman explores the features of the proposed JSR 299, Contexts and Dependency Injection for Java EE (CDI). When approved, it promises to be a key feature of Java EE 6. (November 2, Article)

SAML: It's Not just for Web services

SAML is an XML-based standard for exchanging authentication and authorization data between security domains. The single most important problem that SAML was created to solve is the Web browser Single Sign-On problem. Many organizations are debating whether to stay with version 1.1 or move to 2.0. This article makes observations about both options. (September 28, Article)

Programming is Also Teaching Your Team

Joe Ottinger takes a look at how people learn, and applies it to the practice of programming. He notes that understanding how people learn is an essential part of working in a programming team. (September 22, Article)

Can Java EE Deliver The Asynchronous Web?

Stephen Maryka gave us an article about the Asynchronous Web and posed a number of questions that get examined like an approach to delivering Asynchronous Web capabilities through extensions to existing Java EE technologies. (July 14, Article)

JSF Flex

JavaServer Faces Flex goal is to provide users capability in creating standard Flex components, part of flexSDK which is open sourced through MPL license, as normal JSF components. This article by Ji Hoon Kim will provide an overview of creating a simple multilingual JSF page consisting of JSF Flex tags. (June 29, Article)

The Rules of SOA - A Road to a Successful SOA Implementation

In this session Jeff explores the key characteristics of successful SOA projects. He covers some of the patterns, and anti-patterns, tool sets, and strategies that he himself learned the hard way. Last, he provides a strategy and blueprint for achieving a high likelihood of success in your SOA project. (June 23, Tech Talk)

Ari Zilka Talks About Terracotta 3.1

Ari Zilka, CTO of Terracotta, Inc., talks about the new features in Terracotta 3.1, announced during JavaOne and available now. (June 15, Tech Talk)

Enterprise Application Integration, and Spring

In this Tech Talk, Josh Long explores an integration challenge using Spring Integration and walks through the implementation, employing and expanding on the basic patterns of Enterprise Application Integration to tie together components into a function integration solution, and then demonstrates how Spring Integration helps address the integration requirements. (June 15, Tech Talk)

Google Web Toolkit: An Introduction

In this Tech Talk, David Geary teaches you: The basics of Google Web Toolkit; How to implement Ajax-enabled applications in Java; Internationalization; Hooking into the browser history mechanism; Remote procedure calls. (June 4, Tech Talk)

Just Enough Early Architecture to Guide Development

Jon Kern discusses the best architecture/technical solutions and ensure that they are repeated by all developers. By tackling the architecture up-front in a serial manner, subsequent parallel development will be much more manageable and predictable. (May 28, Tech Talk)

Productive Programmer: On the Lam from the Furniture Police

This keynote describes the frustrations of modern knowledge workers in their quest to actually get some work done, and solutions for how to guard yourself against all those distractions. Neal Ford talks about environments, coding, acceleration, automation, and avoiding repetition as ways to defeat the misguided attempts to sap your ability to produce good work. (May 26, Tech Talk)

Auto-Scaling Your Existing Web Application

Gil demonstrates how new, aggressive uses of already abundant compute capacity by common applications offer competitive value for application designers. (May 21, Tech Talk)

Automating Hibernate Mapping and Queries For Java Web Development

Chris Keene introduces WaveMaker as a new way to automate the ability to generate Hibernate classes in order to more quickly bring OR mapping into an application. (May 19, Article)

Auto-Scaling Your Existing Web Application

In this session Nati Shalom demonstrates how to take a standard Java EE web application and scale it out or down dynamically without changes to the application code. Seeing as most web applications are over-provisioned to meet infrequent peak loads, this is a dramatic change because it enables growing your application as needed, when needed, without paying for unutilized resources. (May 19, Tech Talk)

Free Book: Jakarta-Struts Live

Download the entire book of Jakarta-Struts Live and learn about Struts MVC, Tiles, the Validator, DynaActionForms, plug-ins, internationalization, and more.
(Book PDF Download)

Application Server Matrix

The Application Server Matrix is a detailed listing of J2EE vendors and their application server products, with information on latest version numbers, J2EE spec support and licensing, pricing, platform support, and links to product downloads and reviews.
(Application Server Comparison Matrix)

News | Blogs | Discussions | Tech talks | Patterns | Reviews | White Papers | Downloads | Articles | Media kit | About
Java Solutions
All Content Copyright ©2007 TheServerSide Privacy Policy
Site Map