charles破解

如果从事Server、App端开发,抓包工具是必不可少的,之前在Windows上抓包用的是Fiddler,它是基于.Net开发的,在Mac上使用需要安装Nano,同时对Retina屏幕的支持不是很好。
所以就换为这个工具了。用了一段时间觉得这个工具还是很不错的,它对请求是按照树形结构归类的,如果只关注某个域名下的请求,那就只需要关注这个目录就好了,便于查找。
附上程序启动截图:
 

工具准备
1. 反编译字节码工具
        1. cfr
        2. procyon
        3. Luyten
        4. Fernfolower
        5. BytecodeViewer
        6. JD-gui

2. 搜索文本工具
       1. Linux系统grep命令
        2. 或其他文本搜索工具

3. javassist (字节码修改工具)http://jboss-javassist.github.io/javassist/

破解思路

由于代码混淆的只是类名,通过反编译找到对应的注册类,修改掉几行代码可以了。反编译工具哪个能解析出来就用哪个。

1. 执行反编译命令,这里我用的是[procyon-decompiler](https://bitbucket.org/mstrobel/procyon/wiki/Java%20Decompiler)
[Shell]  纯文本查看  复制代码
?
1
java -jar procyon-decompiler-0.5.30.jar -o output ~ /Desktop/charles .jar


2. 在生成output文件夹搜索未注册的关键字
[Shell]  纯文本查看  复制代码
?
1
2
3
grep -R 'Unregistered' output
output /com/xk72/charles/oFTR .java:        this.ecCn = "Unregistered" ;
output /com/xk72/charles/oFTR .java:        this.ecCn = "Unregistered" ;


此时已经找到对应的注册类:/com/xk72/charles/oFTR.java(反编译文件在文章末尾)
注册的话肯定要调这个类里的某个public方法,搜public stataic关键字,得到4个方法,这几个方法用到了两个变量:
private boolean lktV;
private String ecCn;
根据反编译的代码猜测,第一个变量代表注册是否成功,第二个变量代表注册用户名。

3.修改反编译字节码
这里利用开源的javassist工具来完成修改某个方法的内容,这恰好是我们需要的。感兴趣的可以自行搜下相关资料,这里就不细说了,直接附上修改字节码的代码:

[Java]  纯文本查看  复制代码
?
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import javassist.*;
 
import java.io.IOException;
 
/**
  * Created by fengyiwei on 2017/11/26.
  */
public class CrackCharles421 {
     public static ClassPool pool = ClassPool.getDefault();
 
     public static void main(String[] args) throws NotFoundException, CannotCompileException, IOException, ClassNotFoundException {
         pool.insertClassPath( "/Users/fengyiwei/Desktop/charles.jar" );
         CtClass oFTR = pool.get( "com.xk72.charles.oFTR" );
         try {
             CtMethod ct = oFTR.getDeclaredMethod( "lktV" );
             ct.setBody( "return \"By.Freeway   https://www.52pojie.cn\";" );
 
             CtConstructor[] cca = oFTR.getDeclaredConstructors();
             cca[ 0 ].setBody( "{this.ecCn = \"Cracked By Freeway www.58pojie.com\";\nthis.lktV = true;}" );
             cca[ 1 ].setBody( "{this.ecCn = \"Cracked By Freeway www.58pojie.com\";\nthis.lktV = true;}" );
             oFTR.writeFile( "/Users/fengyiwei/Desktop/" );
 
         } catch (Exception e) {
             e.printStackTrace();
         }
     }
}


4. 将修改后的字节码更新至jar中
[Shell]  纯文本查看  复制代码
?
1
jar -uvf charles.jar com


破解后的jar文件
链接: https://pan.baidu.com/s/1dEYWhd3 密码: jbxr

附:反编译的注册文件
[Java]  纯文本查看  复制代码
?
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
//
// Decompiled by Procyon v0.5.30
//
 
package com.xk72.charles;
 
import java.io.UnsupportedEncodingException;
 
public final class oFTR
{
     private static String Yuaz = "Thanks for looking at the source. Please register Charles if you use it." ;
     private static oFTR knIQ;
     private boolean lktV;
     private String ecCn;
     
     // 为了减少页面篇幅,省略若干行无用代码......
 
     public oFTR() {
         this .lktV = false ;
         this .ecCn = "Unregistered" ;
     }
     
     private oFTR( final String s, final String s2) {
         this (s, s2, 4 );
     }
     
     private oFTR( final String ecCn, final String s, final int n) {
         this .lktV = false ;
         this .ecCn = "Unregistered" ;
         try {
             final int n2 = 4 ;
             final String replaceAll = ecCn.replaceAll( "[ \u1680\u180e\u2000\u200a\u202f\u205f\u3000]" , " " );
             if (! this .Yuaz( this .knIQ(replaceAll, s, n2)) && (replaceAll.equals(ecCn) || ! this .Yuaz( this .knIQ(ecCn, s, n2)))) {
                 throw new LicenseException( this .Yuaz( 2 ));
             }
         }
         catch (NumberFormatException ex) {
             throw new LicenseException( this .Yuaz( 1 ));
         }
         this .ecCn = ecCn;
         this .lktV = true ;
     }
     
     // 为了减少页面篇幅,省略若干行无用代码......
 
     public static boolean Yuaz() {
         return oFTR.knIQ.lktV;
     }
     
     public static void knIQ() {
         oFTR.knIQ = new oFTR();
     }
     
     public static String lktV() {
         final oFTR knIQ = oFTR.knIQ;
         switch (VSCw.Yuaz[knIQ.RvLX.ordinal()]) {
             case 1 : {
                 return knIQ.ecCn;
             }
             case 2 : {
                 return knIQ.ecCn + " - Site License" ;
             }
             case 3 : {
                 return knIQ.ecCn + " - Multi-Site License" ;
             }
             default : {
                 return knIQ.ecCn;
             }
         }
     }
     
     public static String Yuaz( final String s, final String s2) {
         oFTR knIQ;
         try {
             knIQ = new oFTR(s, s2);
         }
         catch (LicenseException ex) {
             return ex.getMessage();
         }
         oFTR.knIQ = knIQ;
         return null ;
     }
     
     private boolean ecCn() {
         return this .lktV;
     }
     
     private String dnGU() {
         switch (VSCw.Yuaz[ this .RvLX.ordinal()]) {
             case 1 : {
                 return this .ecCn;
             }
             case 2 : {
                 return this .ecCn + " - Site License" ;
             }
             case 3 : {
                 return this .ecCn + " - Multi-Site License" ;
             }
             default : {
                 return this .ecCn;
             }
         }
     }
 
     // 为了减少页面篇幅,省略若干行无用代码......
}

518909E39FF7C2022C3E6F59297EC119.jpg (158.21 KB, 下载次数: 8)

518909E39FF7C2022C3E6F59297EC119.jpg
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值