Featured image of post 脚本模板

脚本模板

PWN 入门常用的 pwntools 完整脚本模板,涵盖本地与远程连接及基础交互流程。

 · 约 89 字

完整脚本模板

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
from pwn import *
context.arch="amd64" # amd64(64位) i386(32位)
context.os="linux"
context.log_level="debug" #开启 debug 模式
elf=ELF("./lottery_debug")
libc=ELF("./libc.so.6") #如果有
def conn():
    if args.REMOTE:
       host=""
       port=
       return remote(host,port)
    else:
       return process("")
def exploit(io):
    io.recvuntil(b"")
    line=io.recvline().decode().split()
    payload=
    io.sendline(payload)
    io.interactive()
if __name__=='__main__':
    io=conn()
    exploit(io)
Built with Hugo · Theme Stack