Kali Linux的Pwn環境搭建

ljnljnljn發表於2024-11-28

連結指北:
1、安裝pwntools、gdb等外掛
參考連結:https://blog.csdn.net/Bossfrank/article/details/130213456
2、途中出現以下問題解決方案
連結:https://blog.csdn.net/2202_75762088/article/details/134625775#/

error: externally-managed-environment
 
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.
    
    See /usr/share/doc/python3.11/README.venv for more information.
 
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

3、簡易快速入門
連結:https://blog.csdn.net/weixin_45004513/article/details/117332121
匯入Pwntools

from pwn import *

連結

r = remote("目標地址str型別", 目標埠int型別)#與伺服器互動
r = process("目標程式位置")#與本地程式互動

構造playload之打包

p64(int)#將int型別打包成64位儲存
p32(int)#將int型別打包成32位儲存

傳送

r.sendline(playload)#傳送playload為一行(自動在尾部加上\n)

接收

r.recv()#接收到結束
r.recvuntil(end, drop=True)end(str)#接受到end之後截至,drop=True時不包括end,drop=False時包括end

開啟互動

r.interactive()#一般在末尾都要加

相關文章