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

posted @   opencoder  阅读(1323)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示