Menu

Issue while obfuscated using Proguard

2010-11-25
2016-11-28
  • Jawahar Nayak

    Jawahar Nayak - 2010-11-25

    Hi,

    I faced the problem while using proguard which is 3rd limitation for proguard. Given at link

    http://proguard.sourceforge.net/index.html#/manual/usage.html#obfuscationoptions

    Suggested solution is that use -classobfuscationdictionary  option with filename.

    I want to know, how many words should I supply in filename. If I supplied less names than the no. of class, then what would happened. Is any options to just append a prefix before the autogenerated names.

    Thanks

     
  • Jawahar Nayak

    Jawahar Nayak - 2010-11-25

    Currently I fixed this issue by changing in the Proguard Code.

    Package name: proguard\obfuscate
    Class name:- SimpleNameFactory

    I changed method:-
    Old Method:-

    public String nextName() {        
            return name(index++);;
        }
    

    AFTER changes:-

    public String nextName() {
            String sname=name(index++);
            if ("aux".equalsIgnoreCase(sname) || "aux.class".equalsIgnoreCase(sname)) {
                sname=name(index++);
            }
            return sname;
        }
    
     
  • Eric Lafortune

    Eric Lafortune - 2010-11-26

    If ProGuard runs out of names from the specified obfuscation dictionary, it starts with a, b, c, etc. I could consider using the words in the dictionary as prefixes, so that a dictionary with a single word would effectively become a prefix.

    Your fix for Windows should work indeed (although the "aux.class" part is not necessary).

    Eric.

     
  • Ned Twigg

    Ned Twigg - 2013-12-02

    Thanks very much Jawahar for this fix, and thanks very much Eric for this great software!

    I just applied the same patch, and I think it would be great if this patch made it into the default release.

    The fix which is suggested by the manual - "it's generally better to write the output to a jar" works great for most use-cases. However, in my case, I am using a tool (Obclipse) which uses the obfuscation mapping to modify a bunch of project metadata which gets zipped-up inside the jar.

    I would imagine that Obclipse isn't the only tool which is based on Proguard and needs to make further modifications to the jars after Proguard is done. It would be possible to author such tools in a way that they operate entirely within jar-land, but it's much easier to operate on folders and files and jar them up at the end.

    I would love it if SimpleNameFactory in 4.11 skipped all of the Windows forbidden filenames (here's a list.).

    I bet there are many more Windows users with more than 1200 classes in their project than there are users with scripts that rely on names being contiguously allocated from a to bbb. I might be wrong in that bet - Eric would know better than me :)

     
    • Eric Lafortune

      Eric Lafortune - 2013-12-03

      Thanks for your enthusiastic thoughts. I won't let ProGuard skip Windows forbidden filenames by default; affecting everyone's output just because of Windows doesn't feel right to me. In some contexts, it's actually a nice feature. I'm also reluctant to add yet another option. Let me ponder on it some more. For the time being, you could try using UNC paths, if the other tools allow it.

      Eric

       
  • Eric Gavaldo

    Eric Gavaldo - 2016-11-28

    Hi Eric,
    I have the same issue as discussed above: an obfuscated class is renamed aux.class while this is forbidden by Windows. Actually there are a complete list of forbidden names:

    CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9.

    What do you suggest to workaround this issue? I don't want to patch your code as I'm trying to update regularly.
    Thanks,

     
  • Eric Gavaldo

    Eric Gavaldo - 2016-11-28

    Nevermind I think I'm gonna go with the -classobfuscationdictionary option
    I've just generated 8000 random strings with lower and upper case characters.
    Let's see how it works with that
    Thanks,