放到模擬器上運行是一個驗證框
用工具反編譯看看 有一個檢查函數
找在那個函數
大概知道算法
1.它先去獲取 key
2.然創建一個數組
3.然後計算
要注意的是它有倆個 getkey()函數
看看反編譯的源碼發現讀不通其中就有:
可能是工具的問題 換個就清析了
找到關鍵點 他是把密碼一個個字符計算
if ((iArr[i] & 255) != ((str.charAt(i) ^ str2.charAt(i % str2.length())) & 255)) {
// throw new RuntimeException();
// }
那好辦我就暴力求解(當前類中的key 是錯的)
key : bobdylan
密碼:blow,in the winD
源碼
public class allen {
//正確 key
public static String getKey() {
return "bobdylan";
}
public static void main(String[] args){
check("allen");
// System.out.println("allenboy");
}
public static void check(String str) {
int i = 0;
if (str.length() != 16) {
//throw new RuntimeException();
}
String str2 = "";
try {
str2 = getKey();
} catch (Exception e) {
System.out.println("allenboy");
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;
System.out.println(str2);
while (i < 16) { //str爲參數 str2爲 key
for(int j=0;j<128;j++){
char c=(char)j;
if ((iArr[i] & 255) == ((c^ str2.charAt(i % str2.length())) & 255)) {
System.out.print(c);
}
}
i++;
}
}
}
// public void check(String str) {
// int i = 0;
// if (str.length() != 16) {
// throw new RuntimeException();
// }
// String str2 = "";
// try {
// str2 = getKey();
// } 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";
// }