起点 App 字段加密破解_java
仅用作学习用途,禁止用于其他用途!!!!!!!!!!!!
QDInfo:
package fistaa1;
import java.security.Key;
import java.security.spec.AlgorithmParameterSpec;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
//加密算法
public class abc3 {
private static char[] a;
private static byte[] b;
static {
abc3.a = new char[]{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'};
abc3.b = new byte[]{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 0x3F, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 0x1F, 0x20, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 0x2F, 0x30, 49, 50, 51, -1, -1, -1, -1, -1};
}
public static String a1(byte[] arg8) {
StringBuffer v1 = new StringBuffer();
int v2 = arg8.length;
int v0 = 0;
while(v0 < v2) {
int v3 = v0 + 1;
int v4 = arg8[v0] & 0xFF;
if(v3 == v2) {
v1.append(abc3.a[v4 >>> 2]);
v1.append(abc3.a[(v4 & 3) << 4]);
v1.append("==");
}
else {
int v5 = v3 + 1;
v3 = arg8[v3] & 0xFF;
if(v5 == v2) {
v1.append(abc3.a[v4 >>> 2]);
v1.append(abc3.a[(v4 & 3) << 4 | (v3 & 0xF0) >>> 4]);
v1.append(abc3.a[(v3 & 15) << 2]);
v1.append("=");
}
else {
v0 = v5 + 1;
v5 = arg8[v5] & 0xFF;
v1.append(abc3.a[v4 >>> 2]);
v1.append(abc3.a[(v4 & 3) << 4 | (v3 & 0xF0) >>> 4]);
v1.append(abc3.a[(v3 & 15) << 2 | (v5 & 0xC0) >>> 6]);
v1.append(abc3.a[v5 & 0x3F]);
continue;
}
}
break;
}
return v1.toString();
}
public static void main(String[] args) throws Exception {
String arg6 = "865166023547162|7.9.38|900|1600|1000031|7.1.2|1|V1923A|475|1000031|4|0|1597139835781|1|865166023547162|6f6f75a2132195c5"; //需要修改时间戳以及手机IMEI编码
String arg7 = "0821CAAD409B8402"; //key //IV 向量 IV= "90f257e492d40759"
String v0_2;
byte[] v0;
int v5 = 8;
int v4 = 16;
IvParameterSpec v2 = new IvParameterSpec(new byte[v5]);
byte[] v1 = arg7.getBytes("UTF-8");
v0 = new byte[24];
System.arraycopy(v1, 0, v0, 0, v4);
System.arraycopy(v1, 0, v0, v4, v5);
SecretKeySpec v1_1 = new SecretKeySpec(v0, "DESede");
Cipher v0_1 = Cipher.getInstance("DESede/CBC/PKCS5Padding");
v0_1.init(1, ((Key)v1_1), ((AlgorithmParameterSpec)v2));
v0_2 = abc3.a1(v0_1.doFinal(arg6.getBytes()));
System.out.println(v0_2); //结果
}
}
QDSign-----AegisSign 加密方式一致,传入参数不同
package test_1;
public class QDSign_info {
private static char[] a;
static {
QDSign_info.a = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
}
public QDSign_info() {
super();
if(Boolean.FALSE.booleanValue()) {
System.out.println("");
}
}
public static String a(byte[] arg9) {
//arg9为要加密的内容,
int v0;
int v4 = arg9.length;
StringBuilder v5 = new StringBuilder(arg9.length * 3 / 2);
int v6 = v4 - 3;
int v2 = 0;
int v3 = 0;
while(v3 <= v6) {
v0 = (arg9[v3] & 0xFF) << 16 | (arg9[v3 + 1] & 0xFF) << 8 | arg9[v3 + 2] & 0xFF;
v5.append(QDSign_info.a[v0 >> 18 & 0x3F]);
v5.append(QDSign_info.a[v0 >> 12 & 0x3F]);
v5.append(QDSign_info.a[v0 >> 6 & 0x3F]);
v5.append(QDSign_info.a[v0 & 0x3F]);
v3 += 3;
v0 = v2 + 1;
if(v2 >= 14) {
v5.append(" ");
v0 = 0;
}
v2 = v0;
}
if(v3 == -2 + v4) {
v0 = (arg9[v3] & 0xFF) << 16 | (arg9[v3 + 1] & 0xFF) << 8;
v5.append(QDSign_info.a[v0 >> 18 & 0x3F]);
v5.append(QDSign_info.a[v0 >> 12 & 0x3F]);
v5.append(QDSign_info.a[v0 >> 6 & 0x3F]);
v5.append("=");
}
else if(v3 == -1 + v4) {
v0 = (arg9[v3] & 0xFF) << 16;
v5.append(QDSign_info.a[v0 >> 18 & 0x3F]);
v5.append(QDSign_info.a[v0 >> 12 & 0x3F]);
v5.append("==");
}
//返回QDSign或AegisSign加密后的值
return v5.toString();
}
public static void main(String[] args) {
、 //这里是要传入的byes[] 值(要加密的参数明文),因为这个值是在native中进行了编码设置,暂时没法知道这个编码方式是哪个
byte[] bytes = new byte[] {71, -76, -62, -77, -92, -24, -69, 101, 8, 96, -122, 69, 82, -5, 65, -27, 85, -44, 0, -122, 73, -43, -72, 120, 76, -94, -63, -13, 85, -102, 1, 37, 39, 33, -21, -40, 28, 44, 19, 31, 59, 60, 27, -113, -63, -57, -78, -38, 90, -83, -31, -25, -68, 102, -58, 9, -96, 40, -93, 66, 40, -72, -4, -18, -78, 10, -104, 42, 85, -95, 70, 107, -69, 43, -58, -64, 93, 22, 0, 80, 33, 68, -24, -3, 55, 3, -67, 9, -27, -124, -50, -85, -51, -55, -39, 23, -100, -41, -99, 75, -58, -9, -88, -93, 114, -35, 62, -20, -79, -122, -25, -45, 75, 8, -78, 118, 9, 106, 93, 57, 73, 40, -20, 55, -26, 53, -20, 52};
String res = a(bytes);
System.out.println(res);
}
}
QDSign解决方案firda-rpc
function main() {
console.log("Enter the Script!");
var result;
function getQDSign(input_str,timestr) {
Java.perform(function () {
console.log("Inside Java perform");
//加密方法
var res_sign = Java.use("com.qidian.QDReader.core.util.d");
//格式算法
var c = Java.use("a.c");
var currentApplication = Java.use('android.app.ActivityThread').currentApplication();
var context = currentApplication.getApplicationContext();
//创建实例
var a_sign = c.signParams(context, input_str, timestr, '0', '867820921279017', '1', 1, false);
console.log("Inside signParams");
//返回加密结果
result= res_sign.a(a_sign);//加密结果
//send('加密结果::'+res_sign);
});
return result;
}
rpc.exports = {
qdsign : getQDSign
};
}
setImmediate(main);
本文章仅供学习参考,如有版权侵犯,请联系作者修改,转载请注明出处!
浙公网安备 33010602011771号