seven  hctf2018

这是一个驱动文件

ida载入,查找字符串

根据字符串来到函数:sub_1400012F0

__int64 __fastcall sub_1400012F0(__int64 a1, __int64 a2)
{
__int64 v2; // rbx
_KEYBOARD_INPUT_DATA *KEYBOARD_input; // rsi
unsigned __int64 v4; // rdx
int index; // ecx
__int16 *k_ipt; // rdi
__int64 v7; // rbp
__int16 k; // dx
char next_c; // dl
CHAR *v10; // rcx v2 = a2;
if ( *(_DWORD *)(a2 + 48) >= 0 )
{
KEYBOARD_input = *(_KEYBOARD_INPUT_DATA **)(a2 + 24);
v4 = (unsigned __int64)(*(unsigned __int64 *)(a2 + 56) * (unsigned __int128)0xAAAAAAAAAAAAAAABui64 >> 64) >> 3;
if ( (_DWORD)v4 )
{
index = dword_1400030E4;
k_ipt = (__int16 *)&KEYBOARD_input->MakeCode;
v7 = (unsigned int)v4;
while ( KEYBOARD_input->Flags )
{
LABEL_30:
k_ipt += 6;
if ( !--v7 )
goto LABEL_31;
}
aO[index] = '.';
k = *k_ipt;
if ( *k_ipt == 17 )//对应按键w
{
if ( index & 0xFFFFFFF0 ) // 大于等于16
{
index -= 16; // 向上移动
goto LABEL_13;
}
index += 208;
dword_1400030E4 = index;
}
if ( k != 31 )//对应按键s
goto LABEL_14;
if ( (index & 0xFFFFFFF0) == 208 )
index -= 208;
else
index += 16; // 向下移动
LABEL_13:
dword_1400030E4 = index;
LABEL_14:
if ( k == 30 )//对应按键a
{
if ( index & 0xF )
--index; // 向左
else
index += 15; // 最右端0位置时,+15,向左移动到最右端
dword_1400030E4 = index;
}
if ( k == 32 )//对应按键d
{
if ( (index & 0xF) == 15 ) // 右,一行0-15,16个,在最右端时,移到0位置
index -= 15;
else
++index; // 右
dword_1400030E4 = index;
}
next_c = aO[index];
if ( next_c == '*' )
{
v10 = "-1s\n";
}
else
{
if ( next_c != '7' )
{
LABEL_29:
aO[index] = 'o';
goto LABEL_30;
}
v10 = "The input is the flag!\n";
}
dword_1400030E4 = 16;
DbgPrint(v10);
index = dword_1400030E4;
goto LABEL_29;
}
}
LABEL_31:
if ( *(_BYTE *)(v2 + 65) )
*(_BYTE *)(*(_QWORD *)(v2 + 184) + 3i64) |= 1u;
return *(unsigned int *)(v2 + 48);
}

简单的迷宫题,输入是通过KEYBOARD_INPUT_DATA结构体,其第二项表示按键的扫描码

17-->w; 31-->s; 30-->a; 32-->d

分别对应上,下,左,右。

迷宫:

对应输入:ddddddddddddddssaasasasasasasasasas

hctf{ddddddddddddddssaasasasasasasasasas}

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

  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. Kconfig 配置文件编码规则

    最早接触到Kconfig是在u-boot的移植过程中.所今天来好好学习一下如何编写一个符合Kconffigde 配置文件.Kbuild或者是Kconfig的中文翻译意思是内核配置/构建系统.他最早出自 ...

  2. rm -rf .git/gc.log

    rm -rf .git/gc.log ➜ test git:(abc) gp Auto packing the repository in background for optimum perform ...

  3. code screenshot beautify plugin & 代码截图美化插件

    code screenshot beautify plugin & 代码截图美化插件 代码截图美化 codesnap 微信分享代码截图 https://github.com/kufii/Cod ...

  4. CSS will-change All In One

    CSS will-change All In One CSS animation effect live demo https://nextjs.org/conf/ https://nextjs.or ...

  5. awesome youtube programming video tutorials

    awesome youtube programming video tutorials youtube programming tutorials https://www.youtube.com/fe ...

  6. TypeScript & React & Jest

    TypeScript & React & Jest create-react-app Jest ``tsx import React from 'react'; import { re ...

  7. App Store Previewer

    App Store Previewer App Store 模拟器 https://www.storepreviewer.com/ xgqfrms 2012-2020 www.cnblogs.com ...

  8. Angular 2020

    Angular 2020 https://angular.io/start https://angular.io/guide/browser-support "@angular/core&q ...

  9. 微信小程序 API

    微信小程序 API https://developers.weixin.qq.com/miniprogram/dev/component/cover-view.html demo https://de ...

  10. css 设置多行文本的行间距

    css 设置多行文本的行间距 block element span .ticket-card-info{ line-height:16px; display: inline-block; } .tic ...