zoukankan      html  css  js  c++  java
  • How to Effectively crack .JAR Files?

    Author: http://www.cnblogs.com/open-coder/p/3763170.html

    With some external tools, we could crack a Java program without any difficult. For some big Java program that obfuscates it’s byte code, we could even restore it’s source code with a little effort.

    1) With JD-GUI, you could review java source code from .jar file:

    1
    In JD-GUI, we could search class (with full package name), review Uni-code constat string. But it is a older tool that could not catch the latest Java features.

    2) Remapping obfuscated class in Jar file

    Maybe you already notice that the package names and class names display like a, b, c. Because some one obfuscated this Jar file, the readable symbol replaced by confusion single characters. Such exported source code even will make eclipse confusion, and cause a lots of compiling error need to solve. One way to handle such problem is remapping those classes. You could do this with d2j-jar-remap.
    d2j-jar-remap -f -c init.txt -o a-deobf.jar a.jar
    init.txt is the configure that remap rules:
    # rename class to some unique name!
    c a/a/a/q/i=C1_i
    c a/a/a/q/g=C2_g
    c a/a/a/q/c=C3_c
    c a/a/a/q/d=C4_d
    c a/a/a/q/b=C5_b
    c a/a/a/q/e=C6_e

    Then, you open the new jar file with JD-GUI:
     2
    With such a remapping process, we could avoid some many compile errors in Eclipse, and save a lots of time for us. 

    3) Export .java with some tools

    a) JAD (Good at handling inner classes)

        jad -sjava example.class                                                                  # de-compile single file
        jad -o -r -sjava -dsrc tree/**/*.class                                                # de-compile a whole folder

    b) JD-GUI (a bit old tool, some latest Java 7 features missing)

    c) procyon (Java 7 required, latest java features provided)
       java -jar procyon-decompiler-0.5.24.jar AutoCloseableExample.class     # de-compile single file
       java -jar procyon-decompiler.jar -jar myJar.jar -o out                          # de-compile a whole jar

    d) cfr (much latest tool, not so good as procyon but better than JAD and JD-GUI for some features)
       java -jar cfr_0_59.jar SwitchTest.class                                               # de-compile single file
       java -jar cfr_0_61.jar java7_jar.jar --outputdir D:/Java/tmp                 # de-compile a whole jar

    A package with all tools included could be download from here.

    4) Refrence

    http://53873039oycg.iteye.com/blog/2015192
    http://blog.csdn.net/fireofjava/article/details/8586799
    http://blog.sina.com.cn/s/blog_437ff56b010166qb.html
    https://code.google.com/p/dex2jar/wiki/DeObfuscateJarWithDexTool

  • 相关阅读:
    Python列表、元组、字典、集合的方法
    Python字符串方法总结
    进程、线程、协和的对比
    案例:图片下载器
    使用gevent实现多任务
    使用greenle完成多任务
    使用yield完成多任务
    生成器总结
    生成器send函数
    生成器yield关键字
  • 原文地址:https://www.cnblogs.com/open-coder/p/3763170.html
Copyright © 2011-2022 走看看