reverse-for-the-holy-grail-350   tu-ctf-2016

程序流程很简单,就一个检验函数:

 1 __int64 __fastcall stringMod(__int64 *a1)
2 {
3 __int64 length; // r9
4 char *c_str; // r10
5 __int64 i; // rcx
6 signed int v4; // er8
7 int *temp_2; // rdi
8 int *temp_3; // rsi
9 signed int t; // ecx
10 signed int j; // er9
11 int index; // er10
12 unsigned int tmp; // eax
13 int sign; // esi
14 int v12; // esi
15 int temp[24]; // [rsp+0h] [rbp-60h]
16
17 memset(temp, 0, 0x48uLL);
18 length = a1[1];
19 if ( length )
20 {
21 c_str = (char *)*a1;
22 i = 0LL;
23 v4 = 0;
24 do
25 {
26 v12 = c_str[i];
27 temp[i] = v12;
28 if ( 3 * ((unsigned int)i / 3) == (_DWORD)i && v12 != firstchar[(unsigned int)i / 3] )// 当i是3的倍数时,str=first[i/3]
29 // { 65, 105, 110, 69, 111, 97}
30 v4 = -1;
31 ++i;
32 }
33 while ( i != length );
34 }
35 else
36 {
37 v4 = 0;
38 }
39 temp_2 = temp;
40 temp_3 = temp;
41 t = 666;
42 do
43 {
44 *temp_3 = t ^ *(unsigned __int8 *)temp_3;
45 t += t % 5;
46 ++temp_3;
47 }
48 while ( &temp[18] != temp_3 ); // 异或操作
49 j = 1;
50 index = 0;
51 tmp = 1;
52 sign = 0;
53 do // 0,1,2 每三个数验证
54 {
55 if ( sign == 2 )
56 {
57 if ( *temp_2 != thirdchar[index] ) // { 751, 708, 732, 711, 734, 764, 0, 0 }
58 // temp[2]=
59 v4 = -1;
60 if ( tmp % *temp_2 != masterArray[index] )// { 471, 12, 580, 606, 147, 108 }
61 //
62 // temp[0]*temp[1]%temp[2]=
63 v4 = -1;
64 ++index;
65 tmp = 1;
66 sign = 0;
67 }
68 else // sign 0,1,
69 {
70 tmp *= *temp_2; // 0 tmp=temp[0]
71 // 1 tmp=temp[0]*temp[1]
72 if ( ++sign == 3 )
73 sign = 0;
74 }
75 ++j;
76 ++temp_2;
77 }
78 while ( j != 19 ); // 18循环
79 return (unsigned int)(t * v4);
80 }

wp:

 1 firstchar=[65, 105, 110, 69, 111, 97]
2 thirdchar=[751, 708, 732, 711, 734, 764]
3 masterArray=[471, 12, 580, 606, 147, 108 ]
4 t=[]
5 x=666
6 for i in range(18):
7 t.append(x)
8 x+=x%5
9 flag=[0 for i in range(18)]
10 index=0
11 for i in range(0,18,3):
12 flag[i]=firstchar[index] #0,3,6
13 index+=1
14 index=0
15 for i in range(2,18,3):
16 flag[i]=thirdchar[index]^t[i] #2 5,8
17 index+=1
18 index=0
19 for i in range(1,18,3):
20 for f in range(32,126): #常用可输入字符
21 if (flag[i-1]^t[i-1])*(f^t[i])%(flag[i+1]^t[i+1])==masterArray[index]:
22 flag[i]=f
23 index+=1
24 break;
25
26 print('tuctf{'+''.join(map(chr,flag))+'}')

tuctf{AfricanOrEuropean?}

攻防世界 reverse reverse-for-the-holy-grail-350的更多相关文章

  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. Flex: Holy Grail

    Flex:Holy Grail <html> <head> <style type="text/css"> body,div,header,ma ...

  6. CTF--web 攻防世界web题 robots backup

    攻防世界web题 robots https://adworld.xctf.org.cn/task/answer?type=web&number=3&grade=0&id=506 ...

  7. CTF--web 攻防世界web题 get_post

    攻防世界web题 get_post https://adworld.xctf.org.cn/task/answer?type=web&number=3&grade=0&id=5 ...

  8. 【CSS-flex】圣杯布局(Holy Grail Layout)、输入框的布局、悬挂式布局、固定的底栏

    1.圣杯布局(Holy Grail Layout) 其指的是一种最常见的网站布局.页面从上到下,分成三个部分:头部(header),躯干(body),尾部(footer).其中躯干又水平分成三栏,从左 ...

  9. 攻防世界 web进阶练习 NewsCenter

    攻防世界 web进阶练习 NewsCenter   题目是NewsCenter,没有提示信息.打开题目,有一处搜索框,搜索新闻.考虑xss或sql注入,随便输入一个abc,没有任何搜索结果,页面也没有 ...

  10. 【攻防世界】高手进阶 pwn200 WP

    题目链接 PWN200 题目和JarvisOJ level4很像 检查保护 利用checksec --file pwn200可以看到开启了NX防护 静态反编译结构 Main函数反编译结果如下 int ...

随机推荐

  1. SSH Keys vs GPG Keys

    SSH Keys vs GPG Keys SSH Keys SSH keys allow you to establish a secure connection between your compu ...

  2. js with All In One

    js with All In One 不推荐,要废弃 function f(x, o) { with (o) { console.log(x); } } function f(foo, values) ...

  3. vue动态添加当前事件下的class

    html部分<div class="star"> <span v-for="(item,index) in 5" @click="c ...

  4. PAUL ADAMS ARCHITECT:薪资追不上房价美一半家庭难买房

    尽管上一年度美国经济遭受重创,但美国房价依旧持续蹿扬,据最新调查显示,美国大部分地区的房价已经到了一般家庭无法负担的水准. 美国房价上涨持续强劲,主要受益美国人居家办公需求(受大环境影响,目前美国有7 ...

  5. C++算法代码——卡片游戏

    题目来自:http://218.5.5.242:9018/JudgeOnline/problem.php?cid=1397&pid=2 题目描述 桌上有一叠牌,从第一张牌(即位于顶面的牌)开始 ...

  6. vue中将分号去掉,将双引号变为单引号的配置

    在项目根目录下创建.prettierrc文件,文件内容如下: { "semi": false, "singleQuote": true } 实现vs code中 ...

  7. OSPF“孤儿”区域

    在多区域OSPF中,area0为主干区域,其他非主干区域都需要包含一个接口连接主干区域,那么当出现有的区域不和主干区域相连,成了"孤儿": 解决办法: 虚链路 在连接孤儿区域的路由 ...

  8. 死磕hyperledger fabric源码|Order节点概述

    死磕hyperledger fabric源码|Order节点概述 文章及代码:https://github.com/blockchainGuide/ 分支:v1.1.0 前言及源码目录 Orderer ...

  9. Docker 一键安装及Docker管理面板Portainer中文汉化

       前言 Docker接触了一段时间了,批量操作过程中感觉太繁琐,所以找到了好评率比较高的Portainer面板,使用后感觉的确不错所以准备拿出来精力来做个汉化版,过程中发现词条非常多,所以暂时先汉 ...

  10. Snort + Barbyard2 + Snorby环境搭建

    1.环境 ubuntu-14.04.5 daq-2.0.7 Snort-2.9.15.1 Barbyard2 snorby Mysql Docker 2.架构 3.安装步骤 Ubuntu配置 如果是刚 ...