Bugku 逆向
2018-11-7 19:05:10
今天开始刷题了.
入门逆向
题目非常简单.用IDA直接看汇编代码,会发现printf函数后面有很多mov指令,这里就是flag.
建议不要直接F5,因为F5后看不到mov指令,找了半天.
flag{Re_1s_S0_C0OL}
Easy_vb
看题目就知道和vb有关.
- 先运行一下程序
一个确定按钮,猜测所有数字正确时弹出flag. - 用OD打开,先搜索字符串,然后得到flag.突然感觉好简单…
MCTF{ N3t_Rev_1s_E4ay}
虽然答案是这个但是平台提交的时候要把前面mctf改为flag
Easy_Re
OD打开搜索字符串.找到了flag.好水
DUTCTF{We1c0met0DUTCTF}
游戏过关
一个游戏,凭实力打出来了flag
zsctf{T9is_tOpic_1s_v5ry_int7resting_b6t_others_are_n0t}
Timer(阿里CTF)
因为是一道Android题目,所以要先反编译,试了很多工具,最后确定JEB2是最好用的.其他反编译出来源码是错误的.
- 下载运行
发现需要200000秒就会出现flag. - 反编译,定位关键点
if(MainActivity.this.beg - MainActivity.this.now <= 0) {
this.val$tv1.setText("The flag is:");
this.val$tv2.setText("alictf{" + MainActivity.this.stringFromJNI2(MainActivity.this.k) + "}");
}
可以看到beg-now的值<=0就会调用stringFromJNI2显示falg.
public native String stringFromJNI2(int arg1) {
}
native表名是调用so了,我们不需要反编译so文件,只要算出k的值就可以了.
3. 计算k的值
知道计算k值得地方.
if(MainActivity.is2(MainActivity.this.beg - MainActivity.this.now)) {
MainActivity.this.k += 100;
}
else {
--MainActivity.this.k;
}
这里其实是一个循环,将beg-now的值带入is2.每秒循环一次.
4. beg和now值分析
public MainActivity() {
super();
this.beg = (((int)(System.currentTimeMillis() / 1000))) + 200000;
this.k = 0;
this.t = 0;
}
MainActivity.this.t = System.currentTimeMillis();
MainActivity.this.now = ((int)(MainActivity.this.t / 1000));
beg的值就是**运行时的当前时间(毫秒)/1000(秒)+200000秒.
now的值就是当前时间的秒.
所以beg-now=200000+now-beg的程序执行时间(因为小于1秒可以忽略)
5. 计算k值
is2是代码中的源码,直接计算得到k=1616384
public class timer {
public static boolean is2(int arg4) {
boolean v1 = true;
if(arg4 > 3) {
if(arg4 % 2 != 0 && arg4 % 3 != 0) {
int v0 = 5;
while(true) {
if(v0 * v0 <= arg4) {
if(arg4 % v0 != 0 && arg4 % (v0 + 2) != 0) {
v0 += 6;
continue;
}
return false;
}
else {
return v1;
}
}
}
v1 = false;
}
else if(arg4 <= 1)<