前言 && 聲明
本次分析的是裁判文書網(wǎng)APP(V1.0.0902),請自行下載
本文分析僅供技術(shù)交流,請勿用于商業(yè)及非法用途,如產(chǎn)生法律糾紛與本人無關(guān)
抓包(抓包教程,自行百度)
主要的三種請求已經(jīng)抓包回來了,通過請求參數(shù)來看,請求2和請求3均帶有reqtoken參數(shù),且每次請求數(shù)值不相同,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返回的數(shù)值也是加密的
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;
}
至此,結(jié)束!
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者