×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    20

    Fixing a bug in an already obfuscated midlet (no source code) ?

    Hello.

    I have some little questions for java gurus

    That is a story: I am using a midlet (not mine, but 3rd partie's) - namely it is an instant messenger which works with series40. The midlet is not commercical, it is avaivble for free from the developer website.

    And there are two bugs in it (not only I notice them, but everyone who uses it) - it has troubles with backlight (swithes off on incoming message and does not turn it on any more), and it does not support Russian characters encoding at all.

    I tried to write to developers, but they keep silent.

    So I decided to correct these bugs myself

    Evidently, the midlet was obfuscated - its class names are a, b, c, e t.c.

    The first I did was downloading a java disassembler - DJ Java Disassembler v3.55.

    Then I had some hours of pleasure of reading well-obfuscated code

    But despite the obfuscation, I found the code which caused the backlight bug, removed it (it was a small class, which did nothing but turnging backlight, vibrating and playing sound with Nokia UI -specific code). And I just removed any code assotiated with backlight (If I do not want to have my backlight turned off forever, I should not try to turn it on/off manually, should I?). Then I compiled this class, verifyed, and inserted back into Jar.

    For my pleasure, the backlight bug now is totally fixed

    And our Russian laws do prohibit disassembling, decompilation and making changes in any way in a copyrighted software, but except the cases when this is requred in minimal volumes to correct the evident errors in the software, or to adaptate it to user's hardware platform or other users software. So I do not think I am breaking any laws But anyway...




    There is the second bug, the russian charset encoding. When instant message arrives and contains russian letters, on the phone it is displayed with a kind of hierogliphs But these hierogliphs are different, each corresponding with its letter, so there should be way to correct the situation

    I read the code again, and I found some points in the code, where evidently I can see the message received to be held in the String variable, and so I can easily process it with my code injected there. If I could process that String with my code, I think I will be able to solve the problem (If not manage to deal with different encodings, I could simply process the entire string, and replace all the russian letters (inbyte values) to their English equivalents - that would be quite acceptable solution).

    But there is a big problem. All the points where I see I could inject my code are placed in two big classes. But both java decompilers I used (dj java decompiler and cavaj), when decompiling these big classes, produced, in some places, an evidently erroneus code, which does not compile back (>100 errors...). It seems to me that this is also because of the obfuscator...

    I can recompile back small classes (there are no errors), but I can not recompile big ones. The erroneus code is really totally erroneus java code, and sometines there is a lot of it, and I can not correct it manually.

    I seeked for the ways for injecting my code in the "small classes", but found no way to reach the desired string from out there... Maybe I missed something, of course...

    So first question is:

    1) Is there any tool to replace only one method code in the .class file, without its total decompilation/recompilation?

    Then. In these two "big" classes, my desired strings are, sometines, beeing held in standart java classes like java.util.Vector or java.util.HashMap. If I could replace these classes with my own ones, I could also process the strings there and solve the problem.

    2) Is there a way to replace basic java classes with my own ones? Maybe only placing them into jar in \java\util folder will help?

    3) When opening a .class file in the text viewer (notepad for example), we can see strings there like "java/lang/object", "java/util/Vector", e t.c.

    If replace these strings with my own ones (for example I replace "java/util/Vector" with "fuck/util/Vector"), and write my own fuck.util.Vector class, will it still work?



    Thank you for reading my long message I'll be glad to recieve any advices
    Last edited by SPGremlin; 2004-01-12 at 16:50.

  2. #2
    Registered User
    Join Date
    Oct 2003
    Posts
    20
    No one can help me?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×