生活随笔
收集整理的這篇文章主要介紹了
安卓Crackme
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
接觸安卓逆向拿來練手的第一個小程序
分析程序鏈接: https://pan.baidu.com/s/18kWNe-IH26m5GpQnZOkiNw 密碼: jy2m
分析工具:Android Killer
模擬器:夜神模擬器
安裝后輸入隨機輸入密碼查看驗證提示
很顯然,可以搜索字符串”錯誤”、”O(jiān)K”來定位到關(guān)鍵代碼。不過Android Killer提供了檢索列出所有字符串的功能…,很方便的得到如下信息。
雙擊進入,看到錯誤分支在異常處理中
再上java源碼~
大致流程為獲取輸入字符串,傳入check方法中,如不拋出異常,則驗證成功。下面貼上check方法代碼:
package ctf.bobbydylan;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;
import ctf.bobdylan.R;
public class M extends T {public void check(String str) {
int i =
0;
if (str.length() !=
16) {
throw new RuntimeException();}String str2 =
"";
try {str2 = get?ey();}
catch (Exception e) {str2 = getKey();System.arraycopy(str2,
0, str,
5,
5);}
int[] iArr =
new int[
16];iArr[
0] =
0;iArr[
12] =
14;iArr[
10] =
7;iArr[
14] =
15;iArr[
15] =
42;
try {iArr[
1] =
3;iArr[
5] =
5;System.out.println();}
catch (Exception e2) {iArr[
5] =
37;iArr[
1] =
85;}iArr[
6] =
15;iArr[
2] =
13;iArr[
3] =
19;iArr[
11] =
68;iArr[
4] =
85;iArr[
13] =
5;iArr[
9] =
7;iArr[
7] =
78;iArr[
8] =
22;
while (i < str.length()) {
if ((iArr[i] &
255) != ((str.charAt(i) ^ str2.charAt(i % str2.length())) &
255)) {
throw new RuntimeException();}i++;}}
public String
getKey() {
return "bobbydylan";}
public void onCreate(Bundle bundle) {
super.onCreate(bundle);setContentView(R.layout.main);startService(
new Intent(
this, P.class));((Button) findViewById(R.id.button)).setOnClickListener(
new a(
this, (TextView) findViewById(R.id.et)));}
protected void onPause() {stopService(
new Intent(
this, P.class));
super.onPause();}
}
這里有個坑,如下圖,我們一開始搜索字符串的時候就能發(fā)現(xiàn)有兩個相似字符串,其實他們是不同類中的方法獲取得到的。但是check中調(diào)用的是T類中的getkey(),其返回的字符串為”bobdylan”。
逆向獲取key:
#include "stdafx.h"
#include <process.h>int main()
{
char nArray1[
16] = {
0,
3,
13,
19,
85,
5,
15,
78,
22,
7,
7,
68,
14,
5,
15,
42 };
char nArray2[
8] = {
'b',
'o',
'b',
'd',
'y',
'l',
'a',
'n' };
char nArray3[
16] = {
0};
for (
int i =
0; i <
16; i++){nArray3[i] = (nArray1[i] ^ nArray2[(i %
8) &
0xFF]);
printf(
"%c", nArray3[i]);}
printf(
"\n");system(
"pause");
return 0;
}
總結(jié)
以上是生活随笔為你收集整理的安卓Crackme的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。