Skip to content

Commit 5a79927

Browse files
committed
Add pwntools sigframe example
1 parent 9f55561 commit 5a79927

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

srop/sigframe.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python
2+
import os
3+
from pwn import *
4+
5+
# SigreturnFrame 要求 context.arch 必須被配置
6+
context.arch = 'amd64'
7+
8+
sigframe = SigreturnFrame()
9+
sigframe.rax = constants.SYS_read
10+
sigframe.rdi = 0
11+
sigframe.rsi = 0xaaaa
12+
sigframe.rdx = 0xbbbb
13+
sigframe.rip = 0xcccc
14+
sigframe.rsp = 0xdddd
15+
sigframe.r8 = 0x8888
16+
17+
# 透過 bytes 進行輸出
18+
bytes(sigframe)
19+
20+
# python3 ./sigframe.py | xxd -g 8 -e -c 8
21+
os.write(1, bytes(sigframe))
22+
23+

0 commit comments

Comments
 (0)