babymips   XCTF 4th-QCTF-2018

mips,ida中想要反编译的化需要安装插件,这题并不复杂直接看mips汇编也没什么难度,这里我用了ghidra,直接可以查看反编译。

 1 void FUN_004009a8(void)
2
3 {
4 int iVar1;
5 int i;
6 byte input [36];
7
8 setbuf(stdout,(char *)0x0);
9 setbuf(stdin,(char *)0x0);
10 printf("Give me your flag:");
11 scanf("%32s",input);
12 i = 0;
13 while (i < 0x20) {
14 input[i] = input[i] ^ 0x20U - (char)i; //这里将输入进行异或(0x20-i)
15 i = i + 1;
16 }
17 iVar1 = strncmp((char *)input,_fdata,5); //前5字节输入转换后为 "Q|j{g"
18 if (iVar1 == 0) {
19   f_5-end_004007f0((char *)input); //转换后的结果进行下一步处理
20 }
21 else {
22   puts("Wrong");
23 }
24 return;
25 }

[5:]部分处理:

 1 void f_5-end_004007f0(char *op_str)
2
3 {
4 size_t lens;
5 int iVar1;
6 uint i;
7
8 i = 5;
9 while (lens = strlen(op_str), i < lens) {
10 if ((i & 1) == 0) { //偶数时
11 op_str[i] = (byte)((uint)((int)op_str[i] << 0x1a) >> 0x18) | op_str[i] >> 6;//高2位右移6位成为低2位,低6位左移2位成为高6位 相当于一字节循环左移2位
12 }
13 else {//奇数时
14 op_str[i] = op_str[i] >> 2 | (byte)((uint)((int)op_str[i] << 0x1e) >> 0x18);//高6位右移2位成为低6位,低2位左移6位成为高2位 相当于循环右移2位
15 }
16 i = i + 1;
17 }
18 iVar1 = strncmp(op_str + 5,PTR_ARRAY_00410d04,0x1b);
19 if (iVar1 == 0) {
20 puts("Right!");
21 }
22 else {
23 puts("Wrong!");
24 }
25 return;
26 }

wp:

 1 part1=b'Q|j{g'
2 part2='52 fd 16 a4 89 bd 92 80 13 41 54 a0 8d 45 18 81 de fc 95 f0 16 79 1a 15 5b 75 1f'
3 part2=list(bytes.fromhex(part2))
4 for i in range(5,len(part2)+5):
5 t = part2[i-5]
6 if i&1==0: #偶数时&1 为0
7 part2[i-5]=(t&0x3)<<6|(t&0xfc)>>2 #低2位左移6位,高6位右移2位 相当于循环右移2位
8 else:
9 part2[i-5]=(t&0x3f)<<2|(t&0xc0)>>6 #低6位左移2位,高2位右移6位 相当于循环左移2位
10
11 temp=list(part1)+part2
12 flag=''
13 for i in range(len(temp)):
14 flag+=chr(temp[i]^0x20 -i)
15 print(flag)

qctf{ReA11y_4_B@89_mlp5_4_XmAn_}

攻防世界 reverse babymips的更多相关文章

  1. 攻防世界 reverse 进阶 10 Reverse Box

    攻防世界中此题信息未给全,题目来源为[TWCTF-2016:Reverse] Reverse Box 网上有很多wp是使用gdb脚本,这里找到一个本地还原关键算法,然后再爆破的 https://www ...

  2. 攻防世界 reverse evil

    这是2017 ddctf的一道逆向题, 挑战:<恶意软件分析> 赛题背景: 员工小A收到了一封邮件,带一个文档附件,小A随手打开了附件.随后IT部门发现小A的电脑发出了异常网络访问请求,进 ...

  3. 攻防世界 reverse tt3441810

    tt3441810 tinyctf-2014 附件给了一堆数据,将十六进制数据部分提取出来, flag应该隐藏在里面,(这算啥子re,) 保留可显示字符,然后去除填充字符(找规律 0.0) 处理脚本: ...

  4. 攻防世界 reverse 进阶 APK-逆向2

    APK-逆向2 Hack-you-2014 (看名以为是安卓逆向呢0.0,搞错了吧) 程序是.net写的,直接祭出神器dnSpy 1 using System; 2 using System.Diag ...

  5. 攻防世界 reverse Windows_Reverse2

    Windows_Reverse2   2019_DDCTF 查壳: 寻找oep-->dump-->iat修复   便可成功脱壳 int __cdecl main(int argc, con ...

  6. 攻防世界 reverse BabyXor

    BabyXor     2019_UNCTF 查壳 脱壳 dump 脱壳后 IDA静态分析 int main_0() { void *v0; // eax int v1; // ST5C_4 char ...

  7. 攻防世界 reverse parallel-comparator-200

    parallel-comparator-200 school-ctf-winter-2015 https://github.com/ctfs/write-ups-2015/tree/master/sc ...

  8. 攻防世界 reverse 进阶 8-The_Maya_Society Hack.lu-2017

    8.The_Maya_Society Hack.lu-2017 在linux下将时间调整为2012-12-21,运行即可得到flag. 下面进行分析 1 signed __int64 __fastca ...

  9. 攻防世界 reverse easy_Maze

    easy_Maze 从题目可得知是简单的迷宫问题 int __cdecl main(int argc, const char **argv, const char **envp) { __int64 ...

随机推荐

  1. 快速搞懂.NET 5/.NET Core应用程序的发布部署

    .NET Framework时代,.NET 应用程序大多直接部署运行在Windows服务器上,当然也可以通过Mono部署运行在Linux上.无论部署exe,还是IIS站点.或是Windows Serv ...

  2. js currying All In One

    js currying All In One 柯里化 refs https://juejin.im/post/6844903603266650125 xgqfrms 2012-2020 www.cnb ...

  3. js console.log color all in one

    js console.log color all in one console.log color Chrome console.log 语法 / grammar %c, %s, css style ...

  4. Virtual Reality In Action

    Virtual Reality In Action VR WebXR immersive 沉浸式 https://github.com/immersive-web/webxr https://imme ...

  5. free food icons

    free food icons food icons Chinese foods https://www.flaticon.com/categories/food-and-restaurant htt ...

  6. node.js & Unbuntu Linux & nvm & npm

    node.js & Unbuntu Linux & nvm & npm https://websiteforstudents.com/install-the-latest-no ...

  7. scrollTo & js auto scroll & scrollX & scrollY

    scrollTo & js auto scroll & scrollX & scrollY scrollX & scrollY 获取 scroll top height ...

  8. NGK.IO新一代高倍币BGV即将登陆交易所

    据悉NGK.IO新一代高倍币BGV已与全球前十大交易所进行深度恰谈,预计在不久的将来会完成上线计划.此次BGV的上线战略布局,将进一步扩大BGV生态,赋予BGV更多的便利性和发展空间.除此之外,NGK ...

  9. [转]自动驾驶平台Apollo 2.5环境搭建

    原文地址:https://blog.csdn.net/jinzhuojun/article/details/80210180,转载主要方便随时查阅,如有版权要求,请及时联系. 我们知道,自动驾驶在学界 ...

  10. SSL (Secure Sockets Layer)

    本文转载自SSL (Secure Sockets Layer) TLS简介 The Transport Layer Security (TLS) protocol aims primarily to ...