拿到app,第一件事,随便抓了个包,看看里面是什么造型。。。
POST https://****.**********.com/resource/m/user/login HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 563
Host: ****.**********.com
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/3.10.0
q=D--WfGoKRf-ehIELY4hxZfe5e8JoO9ypPJFQBISTjUQT9FpQ6_MvzBobksXdFndvafubHhCxZRGWl8ERBOk9SQYvCILZdd6227nJ_nweZ0ikAp4OkH86s8x-jsxBP5bKES1XKNCwPhzPhbxVSu_hwZoYSvQOan3eyCqhSuWY_jipeY3DakPVYz2dOYk4WZVXSIwQSfpCQDbH0mwLqiB1cbYQAacUFSTfv9tiqUN0n5-t7_cng06zEsNIk9osZFh9NCEcF6mmoFZ__5Wxx_e4HhvheoLzUz5RMQkuDKVEUj-i7ZIiW4BYqKHBJ9pkwbO6v1j73NrQ9ZGgLlNJeiwQHEROxqGPSSBJmQo_9q6A4whwryrZFfs20zGMp6NtwEc3PXOqTDgyw3K6uVDwMVaw3hXafEySPWPREsOIEZFrQWI%3D&cid=210101&uid=fb6c2569-fc5e-441c-b30e-0d4f2dcd16f01531017003058&sign=1200200831733062862662787061182468686&event_id=1531019410031
HTTP/1.1 200
Server: openresty
Date: Sun, 08 Jul 2018 03:10:10 GMT
Content-Type: text/html;charset=UTF-8
Content-Length: 256
Connection: keep-alive
F8Xh2r65jF-2uZCIyIB8Fr9W-5UzJX1sBUt_GRh22cUORpY8U8m8UfkwfUwVymLwS2g0jSVV_kXPBFE79NI4BuxJCC2oDt7tIUsIEvirxdSL76cvuvQf7iJbntzrh_2qBrIFDw9WS8cGoIt1LqhautB65iRBpsZx9ksTb5hdWWgk7530Kfp3wIBfaujye-lLX5kvfK-DnDu53opmrLHhUhO33klPz5ip_amuPgtgIVl5ZE8LLI2ccFpHzC6G0YJL
好吧,看来不把它拆开是不行的了。。结果有TX壳子,暴力脱掉。。。反编译。。
搜索sign
跟进f.a看看,原来是个变形的md5,它得到的结果,与我们平时看到的32位hex字符不同
public static String a(String str) {
byte[] bArr = new byte[0];
try {
bArr = MessageDigest.getInstance("MD5").digest(str.getBytes("UTF-8"));
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e2) {
e2.printStackTrace();
}
if (bArr.length != 16) {
throw new IllegalArgumentException("MD5加密结果字节数组错误");
}
return Integer.valueOf(Math.abs(a(bArr, 0))).toString() + Integer.valueOf(Math.abs(a(bArr, 4))).toString() + Integer.valueOf(Math.abs(a(bArr, 8))).toString() + Integer.valueOf(Math.abs(a(bArr, 12))).toString();
}
private static int a(byte[] bArr, int i) {
return ((((bArr & 255) << 24) | ((bArr[i + 1] & 255) << 16)) | ((bArr[i + 2] & 255) << 8)) | (bArr[i + 3] & 255);
} 看到请求正文中的q生成方法也在这里
public class a {
public static final String a = e.h().f();
private static final int b = 128;
private static final Charset c = Charset.forName("utf-8");
private static final String d = "AES/ECB/PKCS7Padding";
static {
Security.addProvider(new BouncyCastleProvider());
}
public static String a(String str) {
try {
Cipher instance = Cipher.getInstance(d);
instance.init(1, c(a));
return new String(Base64.encodeBase64(instance.doFinal(str.getBytes(c)), false), c).replace('+', '-').replace('/', '_');
} catch (Exception e) {
b.a("数据加密异常:" + e.toString());
return "";
}
}
public static String a(String str, boolean z) throws Exception {
return !z ? str : b(str);
}
public static String b(String str) throws IOException {
try {
Cipher instance = Cipher.getInstance(d);
instance.init(2, c(a));
return new String(instance.doFinal(Base64.decodeBase64(str.replace('-', '+').replace('_', '/').getBytes(c))), c);
} catch (Exception e) {
b.a("数据解密异常:" + e.toString());
b.a("返回密文:" + str);
return "";
}
}
private static SecretKeySpec c(String str) {
byte[] bytes = str.getBytes(c);
byte[] bArr = new byte[16];
for (int i = 0; i < bArr.length; i++) {
if (bytes.length > i) {
bArr = bytes;
} else {
bArr = (byte) 0;
}
}
return new SecretKeySpec(bArr, "AES");
}
} 进行到这里,就已经没啥悬念了。懒得调试,hook出它的key,调用上面的方法,OK,正确。。
哎,感觉就像撸完一发,一切都那么嗦然无味了
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
评分
查看全部评分