吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

搜索
查看: 1915|回复: 8
收起左侧

[CTF] bugku上一道迷宫逆向题的分析

[复制链接]
YenKoc 发表于 2020-2-12 23:33
ConsoleApplication1.zip (262.08 KB, 下载次数: 4)
TIPS:是本人第一次在吾爱上发帖,也是个逆向的新手,虽然很菜,但是会一直坚持---------分析有哪些地方不对的,请大家指出,互相进步
1.第一步先拖入IDA分析一步,shift+F12,查找提示信息,进而找到我们需要的函数
图片.png
2.找到了有价值的线索字符串.rdata:00518068 00000013 C welcome to zsctf!\n,点击进入,并对字符串变量按x键,查看引用。

图片.png
3.再进入调用这个字符串的函数中,F5反编译一下
图片.png
4.分析一手
图片.png
5.跟进去关键函数
图片.png
发现了这个函数,一个控制方向,后一个字符控制走的步数。而且lrud字符不就是代表方向吗,典型的迷宫而且12行26列

不过并没有就此结束,个人觉得最坑的地方在于,四个方向的地图不一样。比如这上
图片.png
和下
图片.png
6.画出迷宫的图,才好解。IDC脚本安排上,这也是临时学的shift+F2
图片.png
7.其他方向类比。再用python写出脚本
up='0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0'.replace(',','')
tmp='~`-.'
res=""
for i in range(len(up)):
    if i%26==0:
        print(res)
        res=""
    if up=='1':
        tmp=tmp.replace('~','U')
    if down=='1':
        tmp=tmp.replace('`','D')
    if left=='1':
        tmp=tmp.replace('-','L')
    if right=='1':
         tmp=tmp.replace('.','R')
    res+=tmp+" "
    tmp='~`-.'

图片.png
8.得出我们的答案了,再异或(因为之前加密过了,而且用的是异或1,变回原样也是按位异或)
a = list("06360836063b0839073e0639")
flag=""
a[16] = chr(ord(a[16]) ^ 1)
for i in range(24):
    flag+=chr(ord(a)^i)
print(flag)
07154=518?9i<5=6!&!v$#%.


免费评分

参与人数 2威望 +1 吾爱币 +21 热心值 +2 收起 理由
Hmily + 1 + 20 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
windlin + 1 + 1 谢谢@Thanks!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

pizazzboy 发表于 2020-2-13 11:01
虽然对IDA一窍不通,还是顶你。
 楼主| YenKoc 发表于 2020-2-13 11:07
pizazzboy 发表于 2020-2-13 11:01
虽然对IDA一窍不通,还是顶你。

其实我也没有很精通,看各位大神的操作中,偷学了一点操作,多看多练,我也是菜鸟,感谢支持
yanghang_chou 发表于 2020-2-13 12:38
工程欧巴 发表于 2020-2-13 16:28
又学习喽
netsill 发表于 2020-2-14 15:24
学习ing。。
Sagitar2009 发表于 2020-2-14 16:36
这个就有点深奥了,可以说的再明白些。
 楼主| YenKoc 发表于 2020-2-14 22:40
Sagitar2009 发表于 2020-2-14 16:36
这个就有点深奥了,可以说的再明白些。

那天晚上被老妈赶着上床睡觉,有些地方写的不是很详细,哪里玄学的可以提出来
Hmily 发表于 2020-4-1 23:25
代码用代码框处理下,不然会被discuz识别成斜体。
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2022-5-21 04:17

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表