坛友们,年轻就是资本,和我一起逆天改命吧,我的学习过程全部记录及学习资源:https://www.52pojie.cn/thread-1791705-1-1.html
立帖为证!--------记录学习的点点滴滴
0x1 第一题
1.jadx反编译题目看到关键比较:
public void onClick(View v) {
if (MainActivity.this.check()) {
Toast.makeText(this, "You got the flag!", 1).show();
} else {
Toast.makeText(this, "Sorry your flag is wrong", 1).show();
}
}
2.再去看check函数,可以看到就是先判断长度和数组s是否相等,在逐位比较与异或23之后的值是否相等。
private EditText editText;
private byte[] s = {113, 123, 118, 112, 108, 94, 99, 72, 38, 68, 72, 87, 89, 72, 36, 118, 100, 78, 72, 87, 121, 83, 101, 39, 62, 94, 62, 38, 107, 115, 106};
public boolean check() {
byte[] chars = this.editText.getText().toString().getBytes();
if (chars.length != this.s.length) {
return false;
}
for (int i = 0; i
3.写计算flag代码:
package test;
public class Test {
public static void main(String[] args) {
byte[] s = {113, 123, 118, 112, 108, 94, 99, 72, 38, 68, 72, 87, 89, 72, 36, 118, 100, 78, 72, 87, 121, 83, 101, 39, 62, 94, 62, 38, 107, 115, 106};
char[] chars = {113, 123, 118, 112, 108, 94, 99, 72, 38, 68, 72, 87, 89, 72, 36, 118, 100, 78, 72, 87, 121, 83, 101, 39, 62, 94, 62, 38, 107, 115, 106};
for (int i = 0; i
4.得到flag去验证:
0x2 第二题
1.这里我们jadx反编译后重命名一下,不然一会a.a能把自己看混,,还有方法名和变量名一样的也重命名一下,类似MyA这样命名
2.和前面那个差不多,关键还是在MyA.checkA方法
if (MyA.checkA(editText.getText().toString())) {
Toast.makeText(this, "You get it~", 1).show();
} else {
Toast.makeText(this, "Sorry its wrong", 1).show();
}
3.进来之后看到有四个初始化变量,然后checkA函数,我们先一个个看,第一步就是判断长度是否和b的长度一样,然后再将字符串中每一个byte类型提取出来赋值给iArr,最后就是一个复杂的for循环
private static int[] a = {0, 146527998, 205327308, 94243885, 138810487, 408218567, 77866117, 71548549, 563255818, 559010506, 449018203, 576200653, 307283021, 467607947, 314806739, 341420795, 341420795, 469998524, 417733494, 342206934, 392460324, 382290309, 185532945, 364788505, 210058699, 198137551, 360748557, 440064477, 319861317, 676258995, 389214123, 829768461, 534844356, 427514172, 864054312};
private static int[] b = {13710, 46393, 49151, 36900, 59564, 35883, 3517, 52957, 1509, 61207, 63274, 27694, 20932, 37997, 22069, 8438, 33995, 53298, 16908, 30902, 64602, 64028, 29629, 26537, 12026, 31610, 48639, 19968, 45654, 51972, 64956, 45293, 64752, 37108};
private static int[] c = {38129, 57355, 22538, 47767, 8940, 4975, 27050, 56102, 21796, 41174, 63445, 53454, 28762, 59215, 16407, 64340, 37644, 59896, 41276, 25896, 27501, 38944, 37039, 38213, 61842, 43497, 9221, 9879, 14436, 60468, 19926, 47198, 8406, 64666};
private static int[] d = {0, -341994984, -370404060, -257581614, -494024809, -135267265, 54930974, -155841406, 540422378, -107286502, -128056922, 265261633, 275964257, 119059597, 202392013, 283676377, 126284124, -68971076, 261217574, 197555158, -12893337, -10293675, 93868075, 121661845, 167461231, 123220255, 221507, 258914772, 180963987, 107841171, 41609001, 276531381, 169983906, 276158562};
/* JADX WARN: Multi-variable type inference failed */
/* renamed from: a */
public static boolean checkA(String str) {
if (str.length() != b.length) {
return false;
}
int[] iArr = new int[a.length];
iArr[0] = 0;
int i = 1;
for (byte b2 : str.getBytes()) {
iArr = b2;
i++;
}
for (int i2 = 0; i2
4.将i2重命名j,可以看到将数组a中的每一个元素满足下面的表达式:
for (int j = 0; j
5.如果想去逆推,乘法变除法,加法变减法,很麻烦,那么我们去爆破
package test;
public class Test {
public static void main(String[] args) {
int[] a = { 0, 146527998, 205327308, 94243885, 138810487, 408218567, 77866117, 71548549, 563255818, 559010506,
449018203, 576200653, 307283021, 467607947, 314806739, 341420795, 341420795, 469998524, 417733494,
342206934, 392460324, 382290309, 185532945, 364788505, 210058699, 198137551, 360748557, 440064477,
319861317, 676258995, 389214123, 829768461, 534844356, 427514172, 864054312 };
int[] b = { 13710, 46393, 49151, 36900, 59564, 35883, 3517, 52957, 1509, 61207, 63274, 27694, 20932, 37997,
22069, 8438, 33995, 53298, 16908, 30902, 64602, 64028, 29629, 26537, 12026, 31610, 48639, 19968, 45654,
51972, 64956, 45293, 64752, 37108 };
int[] c = { 38129, 57355, 22538, 47767, 8940, 4975, 27050, 56102, 21796, 41174, 63445, 53454, 28762, 59215,
16407, 64340, 37644, 59896, 41276, 25896, 27501, 38944, 37039, 38213, 61842, 43497, 9221, 9879, 14436,
60468, 19926, 47198, 8406, 64666 };
int[] d = { 0, -341994984, -370404060, -257581614, -494024809, -135267265, 54930974, -155841406, 540422378,
-107286502, -128056922, 265261633, 275964257, 119059597, 202392013, 283676377, 126284124, -68971076,
261217574, 197555158, -12893337, -10293675, 93868075, 121661845, 167461231, 123220255, 221507,
258914772, 180963987, 107841171, 41609001, 276531381, 169983906, 276158562 };
StringBuffer sb = new StringBuffer();
// 第一个for循环照抄,要找到这么多的字符
for (int j = 1; j
6.得到flag缺了一位右边花括号,根据flag格式也能推测最后面有个flag,补上:
0x3 第三题
1.先玩玩小游戏放松一下
2.太菜了,怎么变厉害呢?人民币战士你值得拥有,可是小菜鸟口袋空空怎么办呢?
3.通过搜索方法名找到与支付相关的方法:
4.在搜索代码中带这个方法名的位置:一共搜索到4个,过滤掉基础库和三方库,也可以一个个点开试,可以看到这里支付都是调用同一个方法,只是传递的参数不同。
5.听说手机上mt管理器好用,这里我用雷电模拟器测试,adb push 走出去正版.apk /将文件传到模拟器上,提示失败再打开一个cmd窗口,adb shell,mount -o rw,remount /重新再挂在分区即可
6.然后mt就打不开了,不知道是不是和模拟器有冲突,上传apk,mt就废了,直接Android killer里面打开,将payCancel和payFaild这两个函数传参也改成1,也就是两个方法里面v2的值。
6.然后重新安装,再去游戏里面看看,点击立即购买弹出支付宝和微信弹窗,点x取消,然后触发支付成功,接下来小菜鸟也是人民币战士了。
7.接下来继续玩游戏去了,继续我的旅程。
0x4 总结
1.简单的算法分析靠静态分析就差不多了。
2.像游戏这种代码量大,不好分析的就去改参数,改返回值,改逻辑实现我们的目的。
3.复习一下知识,温故而知新,让我们一起进步吧!!!