首页
社区
课程
招聘
[分享]angrctf题解 0 1 2 3 4
发表于: 2020-9-4 20:54 13731

[分享]angrctf题解 0 1 2 3 4

2020-9-4 20:54
13731

angrctf题解 0 1 2 3 4

题目地址 https://github.com/jakespringer/angr_ctf
00_angr_find

1
2
3
4
5
6
7
8
import angr
p=angr.Project("/home/pwn/Desktop/angr/angr_ctf/dist/00_angr_find")
init_state=p.factory.entry_state()
sm=p.factory.simulation_manager(init_state)
sm.explore(find=0x08048678,avoid=0x8048666)
print(sm.found[0])
found_state=sm.found[0]
print(found_state.posix.dumps(0))

01_angr_avoid

1
2
3
4
5
6
7
8
import angr
p=angr.Project("/home/pwn/Desktop/angr/angr_ctf/dist/01_angr_avoid")
init_state=p.factory.entry_state()
sm=p.factory.simulation_manager(init_state)
sm.explore(find=0x080485E0,avoid=0x080485F2)
print(sm.found[0])
found_state=sm.found[0]
print(found_state.posix.dumps(0))

02_angr_find_condition

1
2
3
4
5
6
7
8
9
10
11
import angr
p=angr.Project("/home/pwn/Desktop/angr/angr_ctf/dist/02_angr_find_condition")
init_state=p.factory.entry_state()
sm=p.factory.simulation_manager(init_state)
def good(state):
    return b'Good Job' in state.posix.dumps(1)
def bad(state):
    return b'Try again'in state.posix.dumps(1)
 
sm.explore(find=good,avoid=bad)
print(sm.found[0].posix.dumps(0))

03_angr_symbolic_registers

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import angr
import claripy
import sys
p=angr.Project("/home/pwn/Desktop/angr/angr_ctf/dist/03_angr_symbolic_registers")
start_address=0x08048980
initial_state=p.factory.blank_state(addr=start_address)
pass0=claripy.BVS('pass0',32)
pass1=claripy.BVS('pass1',32)
pass2=claripy.BVS('pass2',32)
initial_state.regs.eax=pass0
initial_state.regs.ebx=pass1
initial_state.regs.edx=pass2
sm=p.factory.simulation_manager(initial_state)
def good(state):
    return b'Good Job'in state.posix.dumps(1)
def bad(state):
    return b'Try again'in state.posix.dumps(1)
sm.explore(find=good,avoid=bad)
if sm.found:
    found_state=sm.found[0]
    password0=found_state.solver.eval(pass0)
    password1=found_state.solver.eval(pass1)
    password2=found_state.solver.eval(pass2)
    print(hex(password0),hex(password1),hex(password2))

04_angr_symbolic_stack

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import angr
import claripy
import sys
p=angr.Project("/home/pwn/Desktop/angr/angr_ctf/dist/04_angr_symbolic_stack")
start_address=0x08048697
initial_state=p.factory.blank_state(addr=start_address)
padding_size=8
initial_state.stack_push(initial_state.regs.ebp)
initial_state.regs.ebp=initial_state.regs.esp
initial_state.regs.esp-=padding_size
pass0=initial_state.solver.BVS('pass0',32)
pass1=initial_state.solver.BVS('pass1',32)
initial_state.stack_push(pass0)
initial_state.stack_push(pass1)
sm=p.factory.simgr(initial_state)
def good(state):
    return b'Good Job'in state.posix.dumps(1)
def bad(state):
    return b'Try again'in state.posix.dumps(1)
sm.explore(find=good,avoid=bad)
if sm.found:
    found_state=sm.found[0]
    password0=found_state.solver.eval(pass0)
    password1=found_state.solver.eval(pass1)
    print(password0,password1)

[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!

最后于 2020-10-10 11:53 被hml189编辑 ,原因:
收藏
免费 0
支持
分享
最新回复 (5)
雪    币: 5514
活跃值: (2254)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
能不能不要只是“分享”两个字,看起来有违和感。
2020-9-4 23:04
0
雪    币: 47147
活跃值: (20450)
能力值: (RANK:350 )
在线值:
发帖
回帖
粉丝
3
敏而好学 能不能不要只是“分享”两个字,看起来有违和感。
有道理的,原标题只有“分享”2字,编辑了一下楼主的帖子,建议楼主下次发帖使用含义丰富,描述准确的标题 
2020-9-5 09:54
1
雪    币: 233
活跃值: (6701)
能力值: ( LV7,RANK:105 )
在线值:
发帖
回帖
粉丝
4
第一次发,见谅见谅(还没怎么搞明白)
2020-9-5 21:49
0
雪    币:
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
5
题在哪儿
2020-9-24 10:47
0
雪    币: 233
活跃值: (6701)
能力值: ( LV7,RANK:105 )
在线值:
发帖
回帖
粉丝
6
mb_lnmwjdlz 题在哪儿
https://github.com/jakespringer/angr_ctf
2020-10-10 11:57
0
游客
登录 | 注册 方可回帖
返回
//