裁判文书网APP请求分析
2017-07-21 本文已影响0人
周兴杰
前言 && 声明
本次分析的是裁判文书网APP(V1.0.0902),请自行下载
本文分析仅供技术交流,请勿用于商业及非法用途,如产生法律纠纷与本人无关
抓包(抓包教程,自行百度)



主要的三种请求已经抓包回来了,通过请求参数来看,请求2和请求3均带有reqtoken参数,且每次请求数值不相同,reqtoken算法如下:
public class wenshuEn {
/**
* 加密请求reToken
* @param args
*/
public static void main(String[] args) {
System.out.println(getReToken());
}
public static String getReToken(){
return trans(transDate(new Date(),"yyyyMMddHHmm")+"lawyeecourtwenshuapp");
}
private static String trans(String str) {
try {
byte[] md5s = MessageDigest.getInstance("MD5").digest(str.getBytes());
return trans2(md5s);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return null;
}
private static String trans2(byte[] arg4) {
String v0_1;
if(arg4 == null || arg4.length == 0) {
v0_1 = "";
}
else {
StringBuffer v1 = new StringBuffer();
int v0;
for(v0 = 0; v0 < arg4.length; ++v0) {
int v2 = arg4[v0] & 255;
if(v2 < 16) {
v1.append("0");
}
v1.append(Integer.toHexString(v2));
}
v0_1 = v1.toString();
}
return v0_1;
}
private static String transDate(Date arg2, String arg3) {
String v0_1;
if(arg3 == null || (arg3.equals(""))) {
arg3 = "yyyy-MM-dd HH:mm:ss";
}
if(arg2 == null) {
arg2 = new Date();
}
try {
v0_1 = new SimpleDateFormat(arg3).format(arg2);
}
catch(Exception v0) {
v0_1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(arg2);
}
return v0_1;
}
}
请求2和请求3返回的数值也是加密的
public class wenshuDe {
public static void main(String[] args) {
String enStr="";//需要解密的字符串
String key1="lawyeecourtwensh";
String key2="lawyeecourtwensh";
String s = deStr(enStr, key1, key2);
System.out.println(s);
}
private static String deStr(String enStr, String key1, String key2) {
try {
SecretKeySpec sks=new SecretKeySpec(key1.getBytes("ASCII"),"AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(2,((Key)sks), new IvParameterSpec(key2.getBytes()));
//base64decode2bytes
return new String(cipher.doFinal(getFromBase64(enStr)),"utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (InvalidAlgorithmParameterException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (BadPaddingException e) {
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
}
return null;
}
public static byte[] getFromBase64(String s) {
byte[] b = null;
if (s != null) {
BASE64Decoder decoder = new BASE64Decoder();
try {
b = decoder.decodeBuffer(s);
} catch (Exception e) {
e.printStackTrace();
}
}
return b;
}