比较有意思的一道题目  提示是一个迷宫

链接: http://pan.baidu.com/s/1pLhINBt 密码:91bs

先运行程序,要求是输入字符串,错误会输出“Sorry you are wrong!”

先用ida载入,按程序运行流程首先会注意到_main_0函数,函数也与程序结构相符,但如果以此分析下去是错误的,

注意到ida中有如下结构:

  v6 = ;
v5 = ;
v7 = / ;
printf("Please input your key:\n");

v7=0/0明显是错误的,会跳到SE处理程序,这一点可以在od中得到验证

如图下断点的话,程序在0x0040140d输出字符串“Please input......”,输入字符串后也不能停住,实际上是0/0出错后调到SE处理程序,根据上图可以看到0x004013ed处压入SE处理程序安装地址,最终程序跳到sub_401020函数运行。

分析sub_401020函数:

可以得到如下信息:

1.输入字符串长度为22

2.输入字符串每个字符为h,j,k,l中的一个

3.主结构是个大循环,依次逐位检查每一个输入字符

4.v4= "********* *    ** * ** ** * ** ** * #* ** **** **      *********"

&v4=bp-c8

&v6=bp-88

&v5=bp-bf

初始时v3=&v5

5.主结构有四条分支,输入字符为h: v3--

j:  v3+=8

k: v3-=8

l:  v3++

6.对于v3 < &v4 || v3 > &v6判断条件,v4和v6分别是v4的上下界,这只是检查v3是否出界

7.对于 *v3 == 42是判断如果*v3为*则报错,

8.当字符为#时成功

所以思路即为由最初的v3通过运算到达#,这实际上就类似于走一个迷宫

迷宫如上图,第一个*即为v4起始点,最后一个空白格为v6检查点,第三行第一个空格为v3起始地址,

这样就容易得到了字符串:jjjjjlllllkkkkkhhhjjjl

REVERSE-DAILY(5)-rev2的更多相关文章

  1. HNU 13411 Reverse a Road II(最大流+BFS)经典

    Reverse a Road II Time Limit: 10000ms, Special Time Limit:25000ms, Memory Limit:65536KB Total submit ...

  2. LeetCode 7. Reverse Integer

    Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 Have you ...

  3. 【uwp】浅谈China Daily 中划词翻译的实现

    学习uwp开发也有一段时间了,最近上架了一个小应用(China Daily),现在准备将开发中所学到的一些东西拿出来跟大家分享交流一下. 先给出应用的下载链接:China Daily , 感兴趣的童鞋 ...

  4. js sort() reverse()

    数组中存在的两个方法:sort()和reverse() 直接用sort(),如下: ,,,,,,,,,,,]; console.log(array.sort());ps:[0, 1, 2, 2, 29 ...

  5. [LeetCode] Reverse Vowels of a String 翻转字符串中的元音字母

    Write a function that takes a string as input and reverse only the vowels of a string. Example 1:Giv ...

  6. [LeetCode] Reverse String 翻转字符串

    Write a function that takes a string as input and returns the string reversed. Example: Given s = &q ...

  7. [LeetCode] Reverse Linked List 倒置链表

    Reverse a singly linked list. click to show more hints. Hint: A linked list can be reversed either i ...

  8. [LeetCode] Reverse Bits 翻转位

    Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in ...

  9. [LeetCode] Reverse Words in a String II 翻转字符串中的单词之二

    Given an input string, reverse the string word by word. A word is defined as a sequence of non-space ...

  10. [LeetCode] Reverse Words in a String 翻转字符串中的单词

    Given an input string, reverse the string word by word. For example, Given s = "the sky is blue ...

随机推荐

  1. 深入浅出Mybatis系列(五)---TypeHandler简介及配置(mybatis源码篇)

    上篇文章<深入浅出Mybatis系列(四)---配置详解之typeAliases别名(mybatis源码篇)>为大家介绍了mybatis中别名的使用,以及其源码.本篇将为大家介绍TypeH ...

  2. 安装.Net Framework3.5

    Dism /online /enable-feature /featurename:NetFX3 /All /Source:V:\sources\sxs /LimitAccess

  3. 如何实现textarea中获取动态剩余字数的实现

    工作中遇到一个案例,之前没有写过,今儿啃了半个下午硬是给写出来,灰常又成就感!当然对于js大牛来说这根本不算啥,但是对于我自己的js能力又向前迈出一小步. 案例介绍:我们常见到有的网站有textare ...

  4. Windows 10系统更换Windows 7系统磁盘分区注意事项一

    新买的电脑预装系统是WIN10,考虑到兼容性问题,打算更换为WIN7,但在新机上不能直接装WIN7系统,需要在BIOS启动中做一点小改动. 原因分析:由于Windows 8采用的是UEFI引导和GPT ...

  5. jmeter 内存溢出解决方法

    执行“评论新鲜事”200并发就内存溢出 解决方法: [caozijuan@test09 bin]$ vi jmeter JVM_ARGS="-Xms1024m -Xmx4096m" ...

  6. guava学习--Function、Predicate

    Function用于同步转换. Predicate用于过滤. import java.util.Collection; import java.util.Iterator; import java.u ...

  7. mysql创建用户及授权相关命令

    移步: https://zhidao.baidu.com/question/1576368583039067980.html

  8. C# 怎么才能取到网卡的型号信息呢? 如: 博通 NetLink BCM57781 Gigabit Ethernet

    C# 怎么才能取到网卡的型号信息呢?  如: 博通 NetLink BCM57781 Gigabit Ethernet

  9. Javascript下拉导航

    1.右侧导航 tree.js function Toggle(e){ if(!document.getElementById) return; if(!e) var e = window.event; ...

  10. OC基础--self关键字

    Self的使用: 1 self不能离开类   离开类之后没有任何意义 2 self会自动区分类方法和对象方法 3 使用self的时候只需要关注self在哪一个方法中 如果在类方法中使用self   那 ...