摘要:本文主要向大家介绍了C/C++知识点之CTF came(android 版),通过具体的内容向大家展示,希望对大家学习C/C++知识点有所帮助。
本文主要向大家介绍了C/C++知识点之CTF came(android 版),通过具体的内容向大家展示,希望对大家学习C/C++知识点有所帮助。
放到模拟器上运行是一个验证框
用工具反编译看看 有一个检查函数
找在那个函数
大概知道算法
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"";// }
本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注职坐标编程语言C/C+频道!
您输入的评论内容中包含违禁敏感词
我知道了
请输入正确的手机号码
请输入正确的验证码
您今天的短信下发次数太多了,明天再试试吧!
我们会在第一时间安排职业规划师联系您!
您也可以联系我们的职业规划师咨询:
版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
沪公网安备 31011502005948号