Skip to content

Commit c96a0b9

Browse files
authored
Merge branch 'dev' into dev
2 parents 1e266d4 + f5a119f commit c96a0b9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+16161
-883
lines changed

.github/workflows/android.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ jobs:
1414
- uses: actions/checkout@v4
1515

1616
- name: Cache for pip
17-
uses: actions/cache@v3
17+
uses: actions/cache@v4
1818
id: cache-pip
1919
with:
2020
path: ~/.cache/pip
2121
key: ${{ matrix.os }}-cache-pip
2222

2323
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v4
24+
uses: actions/setup-python@v5
2525
with:
2626
python-version: ${{ matrix.python-version }}
2727

@@ -37,6 +37,7 @@ jobs:
3737
3838
- name: Install Android AVD
3939
run: |
40+
sudo usermod -aG kvm $USER
4041
source travis/setup_avd_fast.sh
4142
sed -i 's/skip_android = True/skip_android = False/' docs/source/conf.py
4243
set | grep ^PATH >.android.env

.github/workflows/ci.yml

+12-10
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ jobs:
2020
git log --oneline --graph -10
2121
2222
- name: Cache for pip
23-
uses: actions/cache@v3
23+
uses: actions/cache@v4
2424
id: cache-pip
2525
with:
2626
path: ~/.cache/pip
2727
key: ${{ matrix.os }}-cache-pip
2828

2929
- name: Set up Python ${{ matrix.python_version }}
3030
if: matrix.python_version != '2.7'
31-
uses: actions/setup-python@v4
31+
uses: actions/setup-python@v5
3232
with:
3333
python-version: ${{ matrix.python_version }}
3434

@@ -172,24 +172,26 @@ jobs:
172172
pwn constgrep -c freebsd -m ^PROT_ '3 + 4'
173173
pwn constgrep ^MAP_ 0
174174
pwn constgrep -e O_RDWR
175+
pwn constgrep C
175176
176177
pwn libcdb file /lib/x86_64-linux-gnu/libc.so.6
177178
pwn libcdb lookup puts 5f0 __libc_start_main_ret d0a
178179
pwn libcdb hash b229d1da1e161f95e839cf90cded5f719e5de308
179180
180181
- name: Build source and wheel distributions
181-
if: matrix.python_version > '2.7'
182+
if: matrix.python_version != '2.7'
182183
run: |
183184
python -m build
184185
185-
- uses: actions/upload-artifact@v3
186+
- uses: actions/upload-artifact@v4
187+
if: matrix.python_version != '2.7'
186188
with:
187189
name: packages
188190
path: dist/
189191

190-
- uses: actions/upload-artifact@v3
192+
- uses: actions/upload-artifact@v4
191193
with:
192-
name: coverage
194+
name: coverage-${{ matrix.python_version }}
193195
path: .coverage*
194196

195197

@@ -201,10 +203,10 @@ jobs:
201203
with:
202204
fetch-depth: 20
203205

204-
- uses: actions/download-artifact@v3
206+
- uses: actions/download-artifact@v4
205207
with:
206-
name: coverage
207-
path: .
208+
pattern: coverage-*
209+
merge-multiple: true
208210

209211
- name: Install coveralls
210212
run: |
@@ -243,7 +245,7 @@ jobs:
243245
needs: test
244246
steps:
245247
- name: Download artifacts
246-
uses: actions/download-artifact@v3
248+
uses: actions/download-artifact@v4
247249
with:
248250
name: packages
249251
path: dist

.github/workflows/lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414
- name: Cache for pip
15-
uses: actions/cache@v3
15+
uses: actions/cache@v4
1616
id: cache-pip
1717
with:
1818
path: ~/.cache/pip
1919
key: ${{ matrix.os }}-cache-pip
2020

2121
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v4
22+
uses: actions/setup-python@v5
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525

.github/workflows/pylint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414
- name: Cache for pip
15-
uses: actions/cache@v3
15+
uses: actions/cache@v4
1616
id: cache-pip
1717
with:
1818
path: ~/.cache/pip
1919
key: ${{ matrix.os }}-cache-pip
2020

2121
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v4
22+
uses: actions/setup-python@v5
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525

.readthedocs.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ build:
77
tools:
88
python: "3"
99

10+
sphinx:
11+
configuration: docs/source/conf.py
12+
1013
python:
1114
install:
1215
- requirements: docs/requirements.txt

CHANGELOG.md

+40-1
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,55 @@ The table below shows which release corresponds to each branch, and what date th
7070

7171
## 4.13.0 (`dev`)
7272

73+
- [#2242][2242] Term module revamp: activating special handling of terminal only when necessary
7374
- [#2277][2277] elf: Resolve more relocations into GOT entries
7475
- [#2281][2281] FIX: Getting right amount of data for search fix
7576
- [#2293][2293] Add x86 CET status to checksec output
7677
- [#1763][1763] Allow to add to the existing environment in `process` instead of replacing it
78+
- [#2307][2307] Fix `pwn libcdb file` crashing if "/bin/sh" string was not found
79+
- [#2309][2309] Detect challenge binary and libc in `pwn template`
80+
- [#2308][2308] Fix WinExec shellcraft to make sure it's 16 byte aligned
81+
- [#2279][2279] Make `pwn template` always set context.binary
82+
- [#2310][2310] Add support to start a process on Windows
83+
- [#2335][2335] Add lookup optimizations in DynELF
84+
- [#2334][2334] Speed up disasm commandline tool with colored output
85+
- [#2328][2328] Lookup using $PATHEXT file extensions in `which` on Windows
86+
- [#2189][2189] Explicitly define p64/u64 functions for IDE support
87+
- [#2339][2339] Fix: Allow setting attributes on gdb Breakpoints
88+
- [#2323][2323] Retry failed lookups after one week in libcdb
89+
- [#2325][2325] Match against local system libc first in libcdb
90+
- [#2336][2336] Add `ELF.stripped` and `ELF.debuginfo` properties
91+
- [#2161][2161] Add basic support for darwin shellcraft/asm/disasm/run_shellcode/run_assembly
92+
- [#2161][2161] Fix freebsd amd64 SyscallABI
93+
- [#2160][2161] Fix invalid shellcraft.mov on arm64
94+
- [#2284][2161] Fix invalid shellcraft.pushstr_array on arm64
95+
- [#2345][2345] Fix pwn constgrep when it matches a non-constant type
96+
- [#2338][2338] Fix: follow symlink for libs on ssh connection
97+
- [#2341][2341] Launch GDB correctly in iTerm on Mac
7798
- [#2268][2268] Add a `flatten` argument to `ssh.libs`
7899

100+
[2242]: https://github.com/Gallopsled/pwntools/pull/2242
79101
[2277]: https://github.com/Gallopsled/pwntools/pull/2277
80102
[2281]: https://github.com/Gallopsled/pwntools/pull/2281
81103
[2293]: https://github.com/Gallopsled/pwntools/pull/2293
82104
[1763]: https://github.com/Gallopsled/pwntools/pull/1763
105+
[2307]: https://github.com/Gallopsled/pwntools/pull/2307
106+
[2309]: https://github.com/Gallopsled/pwntools/pull/2309
107+
[2308]: https://github.com/Gallopsled/pwntools/pull/2308
108+
[2279]: https://github.com/Gallopsled/pwntools/pull/2279
109+
[2310]: https://github.com/Gallopsled/pwntools/pull/2310
110+
[2335]: https://github.com/Gallopsled/pwntools/pull/2335
111+
[2334]: https://github.com/Gallopsled/pwntools/pull/2334
112+
[2328]: https://github.com/Gallopsled/pwntools/pull/2328
113+
[2189]: https://github.com/Gallopsled/pwntools/pull/2189
114+
[2339]: https://github.com/Gallopsled/pwntools/pull/2339
115+
[2323]: https://github.com/Gallopsled/pwntools/pull/2323
116+
[2325]: https://github.com/Gallopsled/pwntools/pull/2325
117+
[2336]: https://github.com/Gallopsled/pwntools/pull/2336
118+
[2161]: https://github.com/Gallopsled/pwntools/pull/2161
119+
[2345]: https://github.com/Gallopsled/pwntools/pull/2345
120+
[2338]: https://github.com/Gallopsled/pwntools/pull/2338
121+
[2341]: https://github.com/Gallopsled/pwntools/pull/2341
83122
[2268]: https://github.com/Gallopsled/pwntools/pull/2268
84123

85124
## 4.12.0 (`beta`)
@@ -1081,4 +1120,4 @@ are mentioned here.
10811120
- Added a lots of shellcodes
10821121
- Stuff we forgot
10831122
- Lots of documentation fixes
1084-
- Lots of bugfixes
1123+
- Lots of bugfixes

docs/source/conf.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def __setattr__(self, name, value):
169169

170170
# The theme to use for HTML and HTML Help pages. See the documentation for
171171
# a list of builtin themes.
172-
html_theme = 'default'
172+
html_theme = 'sphinx_rtd_theme'
173173

174174
# Theme options are theme-specific and customize the look and feel of a theme
175175
# further. For a list of options available for each theme, see the
@@ -265,8 +265,8 @@ def __setattr__(self, name, value):
265265
u'2016, Gallopsled et al.', 'manual'),
266266
]
267267

268-
intersphinx_mapping = {'python': ('https://docs.python.org/3.8', None),
269-
'paramiko': ('https://paramiko-docs.readthedocs.org/en/2.1/', None)}
268+
intersphinx_mapping = {'python': ('https://docs.python.org/3/', None),
269+
'paramiko': ('https://docs.paramiko.org/en/2.1/', None)}
270270

271271
# The name of an image file (relative to this directory) to place at the top of
272272
# the title page.
@@ -382,8 +382,6 @@ def linkcode_resolve(domain, info):
382382
html_theme_path = [alabaster.get_path()]
383383
html_theme_options = { 'nosidebar' : True }
384384

385-
# otherwise, readthedocs.org uses their theme by default, so no need to specify it
386-
387385

388386
# -- Customization to Sphinx autodoc generation --------------------------------------------
389387
import sphinx.ext.autodoc

examples/options.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
from pwn import *
66

7-
opts = [string.letters[x] for x in range(10)]
7+
opts = [string.ascii_letters[x] for x in range(12)]
88
print('You choose "%s"' % opts[options('Pick one:', opts)])

pwnlib/abi.py

+39-6
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ def default():
4848
(32, 'mips', 'linux'): linux_mips,
4949
(32, 'powerpc', 'linux'): linux_ppc,
5050
(64, 'powerpc', 'linux'): linux_ppc64,
51+
(32, 'riscv32', 'linux'): linux_riscv32,
52+
(64, 'riscv64', 'linux'): linux_riscv64,
5153
(32, 'i386', 'freebsd'): freebsd_i386,
5254
(64, 'aarch64', 'freebsd'): freebsd_aarch64,
5355
(64, 'amd64', 'freebsd'): freebsd_amd64,
@@ -58,6 +60,8 @@ def default():
5860
(64, 'powerpc', 'freebsd'): freebsd_ppc64,
5961
(32, 'i386', 'windows'): windows_i386,
6062
(64, 'amd64', 'windows'): windows_amd64,
63+
(64, 'amd64', 'darwin'): darwin_amd64,
64+
(64, 'aarch64', 'darwin'): darwin_aarch64,
6165
}[(context.bits, context.arch, context.os)]
6266

6367
@staticmethod
@@ -76,6 +80,8 @@ def syscall():
7680
(64, 'aarch64', 'linux'): linux_aarch64_syscall,
7781
(32, 'powerpc', 'linux'): linux_ppc_syscall,
7882
(64, 'powerpc', 'linux'): linux_ppc64_syscall,
83+
(32, 'riscv32', 'linux'): linux_riscv32_syscall,
84+
(64, 'riscv64', 'linux'): linux_riscv64_syscall,
7985
(32, 'i386', 'freebsd'): freebsd_i386_syscall,
8086
(64, 'amd64', 'freebsd'): freebsd_amd64_syscall,
8187
(64, 'aarch64', 'freebsd'): freebsd_aarch64_syscall,
@@ -85,6 +91,8 @@ def syscall():
8591
(64, 'aarch64', 'freebsd'): freebsd_aarch64_syscall,
8692
(32, 'powerpc', 'freebsd'): freebsd_ppc_syscall,
8793
(64, 'powerpc', 'freebsd'): freebsd_ppc64_syscall,
94+
(64, 'amd64', 'darwin'): darwin_amd64_syscall,
95+
(64, 'aarch64', 'darwin'): darwin_aarch64_syscall,
8896
}[(context.bits, context.arch, context.os)]
8997

9098
@staticmethod
@@ -99,13 +107,18 @@ def sigreturn():
99107
(32, 'arm', 'linux'): linux_arm_sigreturn,
100108
(32, 'thumb', 'linux'): linux_arm_sigreturn,
101109
(64, 'aarch64', 'linux'): linux_aarch64_sigreturn,
110+
(32, 'riscv32', 'linux'): linux_riscv32_sigreturn,
111+
(64, 'riscv64', 'linux'): linux_riscv64_sigreturn,
102112
(32, 'i386', 'freebsd'): freebsd_i386_sigreturn,
103113
(64, 'amd64', 'freebsd'): freebsd_amd64_sigreturn,
104114
(32, 'arm', 'freebsd'): freebsd_arm_sigreturn,
105115
(32, 'thumb', 'freebsd'): freebsd_arm_sigreturn,
106116
(64, 'aarch64', 'freebsd'): freebsd_aarch64_sigreturn,
117+
(64, 'amd64', 'darwin'): darwin_amd64_sigreturn,
118+
(64, 'aarch64', 'darwin'): darwin_aarch64_sigreturn,
107119
}[(context.bits, context.arch, context.os)]
108120

121+
109122
class SyscallABI(ABI):
110123
"""
111124
The syscall ABI treats the syscall number as the zeroth argument,
@@ -115,6 +128,7 @@ def __init__(self, *a, **kw):
115128
super(SyscallABI, self).__init__(*a, **kw)
116129
self.syscall_register = self.register_arguments[0]
117130

131+
118132
class SigreturnABI(SyscallABI):
119133
"""
120134
The sigreturn ABI is similar to the syscall ABI, except that
@@ -132,6 +146,8 @@ class SigreturnABI(SyscallABI):
132146
linux_mips = ABI('$sp', ['$a0','$a1','$a2','$a3'], 4, 0)
133147
linux_ppc = ABI('sp', ['r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9', 'r10'], 4, 0)
134148
linux_ppc64 = ABI('sp', ['r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9', 'r10'], 8, 0)
149+
linux_riscv32 = ABI('sp', ['a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7'], 8, 0)
150+
linux_riscv64 = ABI('sp', ['a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7'], 8, 0)
135151

136152
sysv_i386 = linux_i386
137153
sysv_amd64 = linux_amd64
@@ -140,24 +156,33 @@ class SigreturnABI(SyscallABI):
140156
sysv_mips = linux_mips
141157
sysv_ppc = linux_ppc
142158
sysv_ppc64 = linux_ppc64
159+
sysv_riscv32 = linux_riscv32
160+
sysv_riscv64 = linux_riscv64
143161

162+
# Docs: https://man7.org/linux/man-pages/man2/syscall.2.html
144163
linux_i386_syscall = SyscallABI('esp', ['eax', 'ebx', 'ecx', 'edx', 'esi', 'edi', 'ebp'], 4, 0)
145164
linux_amd64_syscall = SyscallABI('rsp', ['rax', 'rdi', 'rsi', 'rdx', 'r10', 'r8', 'r9'], 8, 0)
146-
linux_arm_syscall = SyscallABI('sp', ['r7', 'r0', 'r1', 'r2', 'r3', 'r4', 'r5', 'r6'], 4, 0)
147-
linux_aarch64_syscall = SyscallABI('sp', ['x8', 'x0', 'x1', 'x2', 'x3', 'x4', 'x5', 'x6'], 16, 0)
165+
linux_arm_syscall = SyscallABI('sp', ['r7', 'r0', 'r1', 'r2', 'r3', 'r4', 'r5', 'r6'], 4, 0)
166+
linux_aarch64_syscall = SyscallABI('sp', ['x8', 'x0', 'x1', 'x2', 'x3', 'x4', 'x5'], 16, 0)
148167
linux_mips_syscall = SyscallABI('$sp', ['$v0','$a0','$a1','$a2','$a3'], 4, 0)
149-
linux_ppc_syscall = ABI('sp', ['r0', 'r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9'], 4, 0)
150-
linux_ppc64_syscall = ABI('sp', ['r0', 'r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9'], 8, 0)
168+
linux_ppc_syscall = SyscallABI('sp', ['r0', 'r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9'], 4, 0)
169+
linux_ppc64_syscall = SyscallABI('sp', ['r0', 'r3', 'r4', 'r5', 'r6', 'r7', 'r8'], 8, 0)
170+
linux_riscv32_syscall = SyscallABI('sp', ['a7', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5'], 4, 0)
171+
linux_riscv64_syscall = SyscallABI('sp', ['a7', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5'], 8, 0)
151172

152173
linux_i386_sigreturn = SigreturnABI('esp', ['eax'], 4, 0)
153-
linux_amd64_sigreturn = SigreturnABI('rsp', ['rax'], 4, 0)
174+
linux_amd64_sigreturn = SigreturnABI('rsp', ['rax'], 8, 0)
154175
linux_arm_sigreturn = SigreturnABI('sp', ['r7'], 4, 0)
155176
linux_aarch64_sigreturn = SigreturnABI('sp', ['x8'], 16, 0)
177+
linux_riscv32_sigreturn = SigreturnABI('sp', ['a7'], 4, 0)
178+
linux_riscv64_sigreturn = SigreturnABI('sp', ['a7'], 8, 0)
156179

157180
sysv_i386_sigreturn = linux_i386_sigreturn
158181
sysv_amd64_sigreturn = linux_amd64_sigreturn
159182
sysv_arm_sigreturn = linux_arm_sigreturn
160183
sysv_aarch64_sigreturn = linux_aarch64_sigreturn
184+
sysv_riscv32_sigreturn = linux_riscv32_sigreturn
185+
sysv_riscv64_sigreturn = linux_riscv64_sigreturn
161186

162187
freebsd_i386 = sysv_i386
163188
freebsd_amd64 = sysv_amd64
@@ -168,7 +193,7 @@ class SigreturnABI(SyscallABI):
168193
freebsd_ppc64 = sysv_ppc64
169194

170195
freebsd_i386_syscall = SyscallABI('esp', ['eax'], 4, 0)
171-
freebsd_amd64_syscall = SyscallABI('rsp', ['rax','rdi','rsi','rdx','rcx','r8','r9'], 8, 0)
196+
freebsd_amd64_syscall = SyscallABI('rsp', ['rax','rdi','rsi','rdx','r10','r8','r9'], 8, 0)
172197
freebsd_arm_syscall = SyscallABI('sp', ['r7', 'r0', 'r1', 'r2', 'r3'], 8, 0)
173198
freebsd_aarch64_syscall = SyscallABI('sp', ['x8', 'x0', 'x1', 'x2', 'x3'], 16, 0)
174199
freebsd_mips_syscall = SyscallABI('$sp', ['$v0','$a0','$a1','$a2','$a3'], 4, 0)
@@ -182,3 +207,11 @@ class SigreturnABI(SyscallABI):
182207

183208
windows_i386 = ABI('esp', [], 4, 0)
184209
windows_amd64 = ABI('rsp', ['rcx','rdx','r8','r9'], 32, 32)
210+
211+
darwin_aarch64 = sysv_aarch64
212+
darwin_aarch64_syscall = SyscallABI('sp', ['x16', 'x0', 'x1', 'x2', 'x3', 'x4', 'x5'], 16, 0)
213+
darwin_aarch64_sigreturn = SigreturnABI('sp', ['x16'], 16, 0)
214+
215+
darwin_amd64 = sysv_amd64
216+
darwin_amd64_syscall = SyscallABI('rsp', ['rax', 'rdi', 'rsi', 'rdx', 'r10', 'r8', 'r9'], 8, 0)
217+
darwin_amd64_sigreturn = SigreturnABI('rsp', ['rax'], 8, 0)

0 commit comments

Comments
 (0)