从程序的任意位置开始可以大大的减少测试的时间,使用的方法是控制程序运行到某时刻的寄存器的值来进行的。asisctffinals2015_fake

     p = angr.Project("fake", auto_load_libs=False)

     state = p.factory.blank_state(addr=0x4004AC)
inp = state.solver.BVS('inp', 8*8)
state.regs.rax = inp simgr= p.factory.simulation_manager(state)
simgr.explore(find=0x400684)
found = simgr.found[0]

同样的,测试的结果也可以通过约束寄存器的值进行。

     flag_addr = found.regs.rdi
found.add_constraints(found.memory.load(flag_addr, 5) == int(binascii.hexlify(b"ASIS{"), 16)) # More constraints: the whole flag should be printable
flag = found.memory.load(flag_addr, 40)
for i in range(5, 5+32):
cond_0 = flag.get_byte(i) >= ord('')
cond_1 = flag.get_byte(i) <= ord('')
cond_2 = flag.get_byte(i) >= ord('a')
cond_3 = flag.get_byte(i) <= ord('f')
cond_4 = found.solver.And(cond_0, cond_1)
cond_5 = found.solver.And(cond_2, cond_3)
found.add_constraints(found.solver.Or(cond_4, cond_5)) # And it ends with a '}'
found.add_constraints(flag.get_byte(32+5) == ord('}')) # In fact, putting less constraints (for example, only constraining the first
# several characters) is enough to get the final flag, and Z3 runs much faster
# if there are less constraints. I added all constraints just to stay on the
# safe side. flag_str = found.solver.eval(flag, cast_to=bytes)
return flag_str.rstrip(b'\0')

angr进阶(4)从任意位置开始的更多相关文章

  1. angr进阶(5)内存操作

    angr也可以将符号写在内存里,控制内存中的值,结合任意位置开始有奇效,但就是慢sym-write p = angr.Project('./issue', load_options={"au ...

  2. C语言中链表任意位置怎么插入数据?然后写入文件中?

    链表插入示意图:(图是个人所画)因为链表指针指来指去,难以理解,所以辅助画图更加方便. 插入某个学号后面图: 定义的结构体: struct student { ]; //学生学号 ]; //学生姓名 ...

  3. iOS修改手机定位(非越狱任意位置)

    利用开发者的一些调试功能,我们可以修改非越狱的苹果手机定位,模拟任意位置. 经测试,此方法仅限开发者调试使用,并不能长时间修改手机定位. 1. 首先需要了解一些坐标系的知识 iOS,原生坐标系为 WG ...

  4. Android点击其他任意位置收起软键盘

    在Android应用开发中,经常出现这样的需求,用户在输入文字的过程中,可能不想继续输入了,通过滑动或者点击其他位置(除软键盘和EditText以外的任何位置),希望能够自动收回键盘,这个功能可能有些 ...

  5. Java swing 如何将一个按钮放置到弹出框框的任意位置?(Absolute layout 布局的使用)

    准备: Absolute layout 绝对布局,绝对布局中控件的可以在任意位置放置 如何制作下面那种样子的 弹出框? ---------------------------------------- ...

  6. 用O_APPEND标志open一个文件,能否用lseek在任意位置读写

    结论比较简单,用O_APPEND打开后,write操作是一个原子操作,所以每次都会自动把偏移量移到文件末尾,所以用lseek不能在任意位置write.但是可以用lseek在任意位置开始读.下面用代码测 ...

  7. Delphi XE7实现的任意位置弹出菜单

    Delphi XE7中目前还没有弹出菜单组件,这个弹出菜单应用很普遍,在JAVA开发的安卓程序中很简单就可以用上了,应该说是一个标准控件.看了一些例子,但是都不能满足我想在任意位置弹出菜单需求,于是自 ...

  8. 一个I/O线程可以并发处理N个客户端连接和读写操作 I/O复用模型 基于Buf操作NIO可以读取任意位置的数据 Channel中读取数据到Buffer中或将数据 Buffer 中写入到 Channel 事件驱动消息通知观察者模式

    Tomcat那些事儿 https://mp.weixin.qq.com/s?__biz=MzI3MTEwODc5Ng==&mid=2650860016&idx=2&sn=549 ...

  9. .Net Core如何在任意位置获取配置文件的内容

    前几天群里有人问,我想在程序里的任意位置读取appsetting.json里的配置,该怎么搞. 话不多说上源码 首先,要想读取配置文件我们要用到IConfiguration 接口,这个接口在Start ...

随机推荐

  1. ARTS Challenge- Week 1 (2019.03.25~2019.03.31)

    1.Algorithm - at least one leetcode problem per week(Medium+) 986. Interval List Intersections https ...

  2. Hive管理表,外部表及外部分区表的深入探讨

    Hive管理表,也叫内部表.Hive控制着管理表的整个生命周期,默认情况下Hive管理表的数据存放在hive的主目录:/user/hive/warehouse/下,并且当我们删除一张表时,这张表的数据 ...

  3. pytroch nn.Module源码解析(1)

    今天在写一个分类网络时,要使用nn.Sequential中的一个模块,因为nn.Sequential中模块都没有名字,我一时竟无从下笔.于是决定写这篇博客梳理pytorch的nn.Module类,看完 ...

  4. 记使用aliyun-log-logback-appender 报错no applicable action for [encoder], current ElementPath is [[configuration][appender][encoder]]

    依赖: <dependency> <groupId>com.aliyun.openservices</groupId> <artifactId>aliy ...

  5. 201771010126 王燕《面向对象程序设计(Java)》第九周学习总结

    实验九 异常.断言与日志 实验时间 2018-10-25 1.实验目的与要求 (1) 掌握java异常处理技术: 异常积极处理方法:使用try子句捕获异常 异常小计处理方法:抛出throw异常类 (2 ...

  6. SpringBoot+ Mybatis 搭建

    spring boot+mybatis整合   LZ今天自己搭建了下Spring boot+Mybatis,比原来的Spring+SpringMVC+Mybatis简单好多.其实只用Spring bo ...

  7. Web版需求征集系统所得1,servlet中获取checkbox复选框的值

    servlet中获取checkbox复选框的值 </tr> <tr> <td align="right">研究类型</td> < ...

  8. 如何在JSP中获得Cookie对象

    Cookie cookies[]=request.getCookies(); //读出用户硬盘上的Cookie,并将所有的Cookie放到一个cookie对象数组里面 Cookie sCookie=n ...

  9. [Swift]LeetCode90. 子集 II | Subsets II

    Given a collection of integers that might contain duplicates, nums, return all possible subsets (the ...

  10. [Swift]LeetCode106. 从中序与后序遍历序列构造二叉树 | Construct Binary Tree from Inorder and Postorder Traversal

    Given inorder and postorder traversal of a tree, construct the binary tree. Note:You may assume that ...