Matt
a25465f765
Add a command that tracks function calls through the Global Offset Table ( #1971 )
...
* Add initial implementation of Link Map parsing and draft Dynamic Segment parsing based on it
* Before changing into a better way to determine NN for ElfNN_Sym.
* Add support for reading relocation entries from the DYNAMIC segment
* Add initial infrastructure to implement the GOT tracker
* Non-coalesced watchpoints
* Finish initial draft implementation
* Update __init__.py
* Better diagnostics and move back to gdb.Breakpoint.stop() for most things
* Fixed the disabling procedure, and a bunch of cosmetics:
- Calling shellcode functions no longer force the context to show
- Better command to access the GOT tracker
* Disable broken r_brk hooks, for now.
* Mixed up the two columns
* Update pwndbg/commands/got_tracking.py
Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
---------
Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
2 years ago
ev1ger
c3ea5aca9d
fixes issue #930 : add support for iwmmxt architecture ( #1993 )
2 years ago
Niko
77516a2a0f
Remove docs and md files from workflows. ( #1990 )
2 years ago
Niko
e396922e79
Fix docs missing requirements. ( #1989 )
2 years ago
Disconnect3d
1132a64269
Create FUNDING.yml ( #1988 )
2 years ago
Niko
ed8cb5a264
New pwndbg banner. ( #1987 )
2 years ago
Akbar Fadiansyah
c21b4c3591
Update year in README ( #1986 )
2 years ago
Disconnect3d
11c9d166ac
ida.py: remove duplicated line ( #1985 )
2 years ago
Disconnect3d
69fd145cee
Optimize pwndbg.commands.ai import time ( #1984 )
...
Before:
```
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg.commands.ai'
import time: 5363 | 174096 | pwndbg.commands.ai
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg.commands.ai'
import time: 1885 | 154032 | pwndbg.commands.ai
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg.commands.ai'
import time: 2085 | 148208 | pwndbg.commands.ai
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg.commands.ai'
import time: 1903 | 146919 | pwndbg.commands.ai
```
After:
```
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg.commands.ai'
import time: 5522 | 105163 | pwndbg.commands.ai
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg.commands.ai'
import time: 1842 | 88943 | pwndbg.commands.ai
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg.commands.ai'
import time: 1780 | 85127 | pwndbg.commands.ai
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg.commands.ai'
import time: 1825 | 83504 | pwndbg.commands.ai
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg.commands.ai'
import time: 1806 | 87045 | pwndbg.commands.ai
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg.commands.ai'
import time: 1756 | 81687 | pwndbg.commands.ai
```
2 years ago
Disconnect3d
b549286626
Optimize pwndbg.exception import time ( #1983 )
...
* Optimize pwndbg.exception import time
Before:
```
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg\.exception'
import time: 557 | 127848 | pwndbg.exception
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg\.exception'
import time: 570 | 126656 | pwndbg.exception
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg\.exception'
import time: 506 | 120334 | pwndbg.exception
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg\.exception'
import time: 535 | 119497 | pwndbg.exception
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg\.exception'
import time: 504 | 119035 | pwndbg.exception
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg\.exception'
import time: 579 | 119783 | pwndbg.exception
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg\.exception'
import time: 499 | 123869 | pwndbg.exception
```
After:
```
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg\.exception'
import time: 1697 | 94657 | pwndbg.exception
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg\.exception'
import time: 430 | 83743 | pwndbg.exception
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg\.exception'
import time: 433 | 88847 | pwndbg.exception
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg\.exception'
import time: 474 | 93674 | pwndbg.exception
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg\.exception'
import time: 372 | 83209 | pwndbg.exception
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg\.exception'
import time: 529 | 83643 | pwndbg.exception
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg\.exception'
import time: 374 | 85408 | pwndbg.exception
root@pwndbg:~/pwndbg# PYTHONPROFILEIMPORTTIME=1 gdb --batch 2>&1 | grep 'pwndbg\.exception'
import time: 374 | 83411 | pwndbg.exception
```
* lazy import pkg_resources
2 years ago
Disconnect3d
c4b71af356
Typing fixes ( #1970 )
...
* FIX: updating type hints batch 1
* FIX: linter errors
* FIX: more type hints update
* FIX: more type hints update
* FIX: more type hints update
* FIX: more type hints update
* FIX: more type hints update
* FIX: revert gdb.execute fixes
* FIX: revert return pid
* FIX: revert gdb.execute fixes
* FIX: fixing suggestions
* FIX: reverting type changes
* FIX: reverting some logic changes that I did
* FIX: minor fixes
* FIX: more reverts
* FIX: revert logic fix
* FIX: revert logic fix
* FIX: revert changes
* FIX: temporarily silent the mypy error exit status
* Update proc.py
* Update config.py
Removing a redundant self.triggers key setting since its a defaultdict!
* Update lint.sh
* Fix some mypy lint issues
* fix mypy lints
* fix mypy lints
* fix mypy lints
* fix mypy lints
* fix mypy lint
* Fix mypy lint
* fix mypy lints
* fix mypy lint
* ignore mypy lint
* ignore mypy lint
* typing fixes
* reformat
---------
Co-authored-by: HackSys Team <ashfaq_ansari1989@hotmail.com>
2 years ago
Disconnect3d
d5182bd9f5
Fixes #1976 - vmmap read /proc/$tid/maps instead of $pid/maps ( #1982 )
...
It turns out that GDB's `info proc mappings` reads $PID instead of $TID and there are cases where the /proc/$pid/maps file renders no content, for example when the main thread of a process exitted.
This then causes us to fail to render memory mappings and falling back to memory maps exploration which is actually bugged.
This was found out by a flaky test which I reported initially as broken Arch Linux CI build: https://github.com/pwndbg/pwndbg/issues/1976 but it turned out it is two bugs:
1) us not taking `/proc/$tid/maps` into account instead of `$pid`
2) vmmap exploration having a recursion error
This commit fixes the former and the latter is still unfixed.
I also reported this GDB behavior to their bugzilla in https://sourceware.org/bugzilla/show_bug.cgi?id=31207 - not sure if this is going to be considered a bug or a "correct behavior" but lets see.
2 years ago
suhassuhas
eb3225162f
Add -i flag to stack command. ( #1978 )
...
* Add support for reverse stack growth
* Fix lint errors
* Updated rsp to be at zero
* updated index along with offset
2 years ago
Niko
40ed3a3bd1
[Docs] Add Docs to GH workflows ( #1980 )
...
* Add Docs to GH workflows
* Exclude docs/ from Docker build
2 years ago
xtex
91d1a044b5
Try repo-oss-debug if repo-debug is not present ( #1977 )
2 years ago
Niko
e1db7446be
[Docs] Fix vmmap docstring. ( #1981 )
...
* Fix vmmap docstring.
* Update vmmap.py
---------
Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
2 years ago
Disconnect3d
bd5148c9ca
README: Add cheatsheet link ( #1975 )
2 years ago
Disconnect3d
eaedb653ec
cymbol: fix cymbol show and remove run and arch restrictions ( #1974 )
...
* cymbol: fix cymbol show and remove run and arch restrictions
Before this PR the cymbol show command was crashingh due to some recent changes to caching.
Here is the exception stacktrace from that crash:
```
pwndbg> cymbol -s Point
╭─────────────────────── Traceback (most recent call last) ────────────────────────╮
│ /root/pwndbg/pwndbg/commands/__init__.py:190 in __call__ │
│ │
│ 187 │ │
│ 188 │ def __call__(self, *args: Any, **kwargs: Any) -> str | None: │
│ 189 │ │ try: │
│ ❱ 190 │ │ │ return self.function(*args, **kwargs) │
│ 191 │ │ except TypeError as te: │
│ 192 │ │ │ print(f"{self.function.__name__.strip()!r}: {self.function.__d │
│ 193 │ │ │ pwndbg.exception.handle(self.function.__name__) │
│ │
│ /root/pwndbg/pwndbg/commands/__init__.py:302 in _OnlyWithArch │
│ │
│ 299 │ │ @functools.wraps(function) │
│ 300 │ │ def _OnlyWithArch(*a: Any, **kw: Any) -> Optional[T]: │
│ 301 │ │ │ if pwndbg.gdblib.arch.name in arch_names: │
│ ❱ 302 │ │ │ │ return function(*a, **kw) │
│ 303 │ │ │ else: │
│ 304 │ │ │ │ arches_str = ", ".join(arch_names) │
│ 305 │ │ │ │ print( │
│ │
│ /root/pwndbg/pwndbg/commands/__init__.py:346 in _OnlyWhenRunning │
│ │
│ 343 │ @functools.wraps(function) │
│ 344 │ def _OnlyWhenRunning(*a: Any, **kw: Any) -> Optional[T]: │
│ 345 │ │ if pwndbg.gdblib.proc.alive: │
│ ❱ 346 │ │ │ return function(*a, **kw) │
│ 347 │ │ else: │
│ 348 │ │ │ print(f"{function.__name__}: The program is not being run.") │
│ 349 │ │ │ return None │
│ │
│ /root/pwndbg/pwndbg/commands/cymbol.py:265 in cymbol │
│ │
│ 262 │ elif load: │
│ 263 │ │ load_custom_structure(load) │
│ 264 │ elif show: │
│ ❱ 265 │ │ show_custom_structure(show) │
│ 266 │ else: │
│ 267 │ │ parser.print_help() │
│ 268 │
│ │
│ /root/pwndbg/pwndbg/commands/cymbol.py:70 in wrapper │
│ │
│ 67 │ │ if not os.path.exists(pwndbg_custom_structure_path): │
│ 68 │ │ │ print(message.error("No custom structure was found with the gi │
│ 69 │ │ │ return │
│ ❱ 70 │ │ return func(custom_structure_name, pwndbg_custom_structure_path) │
│ 71 │ │
│ 72 │ return wrapper │
│ 73 │
│ │
│ /root/pwndbg/pwndbg/commands/cymbol.py:201 in show_custom_structure │
│ │
│ 198 @OnlyWhenStructFileExists │
│ 199 def show_custom_structure(custom_structure_name: str, custom_structure_pat │
│ 200 │ # Call wrapper .func() to avoid memoization. │
│ ❱ 201 │ highlighted_source = pwndbg.pwndbg.commands.context.get_highlight_sour │
│ 202 │ │ custom_structure_path │
│ 203 │ ) │
│ 204 │ print("\n".join(highlighted_source)) │
╰──────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'function' object has no attribute 'func'
```
* Update pwndbg/commands/cymbol.py
2 years ago
Niko
d43d95cc21
Update README.md ( #1969 )
...
Project pronunciation update.
From poundbag to pown debug (pown-dee-bug).
2 years ago
HackSys Team
e230a853d3
FIX: pwndbg.gdblib.regs.frame is None ( #1966 )
...
This commit reverts a previous commit that removed check against the frame register.
* FIX: revert c37030633a as pwndbg.gdblib.regs.frame can be None
The reason for that is that when you debug Chrome on arm64 using a gdbserver, we may end up with a "Unknown register type: None" message printed out due to lack of this check.
The stacktrace for this message can be found below:
```
Unknown register type: None
Traceback (most recent call last):
File "/home/pwndbg/pwndbg/commands/__init__.py", line 181, in __call__
return self.function(*args, **kwargs)
File "/home/pwndbg/pwndbg/commands/__init__.py", line 328, in _OnlyWhenRunning
return function(*a, **kw)
File "/home/pwndbg/pwndbg/commands/telescope.py", line 197, in telescope
bp = pwndbg.gdblib.regs[pwndbg.gdblib.regs.frame]
File "/home/pwndbg/pwndbg/lib/cache.py", line 138, in decorator
value = func(*a, **kw)
File "/home/pwndbg/pwndbg/gdblib/regs.py", line 66, in __getitem__
```
---------
Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
2 years ago
HackSys Team
7d0cf3933a
Update DevContainer Configuration for Enhanced Development Experience ( #1964 )
...
* FIX: Upgraded devcontainer image to bookworm and added some useful extensions
* FIX: use ubuntu jammy image and add .gdbinit file in docker container user home folder not root
* FIX: Switch to root users as other tests are failing with permission denied
* FIX: update devcontainer file to remove unnecessary extensions, and unused dot files as we removed the extensions
* FIX: only add the .gdbinit file if it does not exists
* FIX: minor change
* Update Dockerfile
* Update .devcontainer/devcontainer.json
---------
Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
2 years ago
patryk4815
1507888a1f
arch.py: fix arch detection for riscv ( #1962 )
...
* arch.py: fix arch detection for riscv again
* arch.py: fix arch detection for riscv again
* arch.py: fix lint
2 years ago
Disconnect3d
fb2777c065
Update LICENSE.md ( #1963 )
2 years ago
dependabot[bot]
06a0c18fd8
Bump paramiko from 3.3.1 to 3.4.0 ( #1961 )
...
Bumps [paramiko](https://github.com/paramiko/paramiko ) from 3.3.1 to 3.4.0.
- [Commits](https://github.com/paramiko/paramiko/compare/3.3.1...3.4.0 )
---
updated-dependencies:
- dependency-name: paramiko
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years ago
Disconnect3d
9d0621c4d7
Fetch stacks from vmmap if they exist (also stacks.update -> stacks.get) ( #1959 )
...
Hopefully fixes #1947 by fetching stacks only when they are used instead
of doing it on each stop event. It will also first try to compute stacks
dictionary based on vmmap and if it fallbacks to exploring stacks if
vmmap is not present.
2 years ago
keymoon
03e97e9ea8
Implement a way to resolve multiple process in attachp ( #1956 )
...
* implement various resolve method to attachp
* add tests
* lint tests
* fix resolve_none test
* fix procps issue
* remove unused function
* Update pwndbg/commands/attachp.py
* Update pwndbg/commands/attachp.py
* first/last -> oldest/newest
* change default value to ask
* Provide informations about the config
* fix test
* fix lint
* catch eoferror
---------
Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
2 years ago
patryk4815
40b7928d9e
fix missing cryptography 41.0.6 dependency in "nix" + add "release" workflow on pull_requests ( #1955 )
...
* add checking if "releases" build successfully on pull requests
* flake.lock: fix missing cryptography 41.0.6 dependency
2 years ago
Disconnect3d
0c61ed5d27
mmap command: update return value message ( #1954 )
...
Updates the mmap return value message from just "0x1234" to "mmap syscall returned 0x1234"
2 years ago
Matt
dfd5f95b56
Add mmap command that executes the mmap syscall in the inferior ( #1952 )
...
* Initial implementation of the mmap command
- Additionally, moves syscall execution and general inferior-scoped code
execution facilities into a single, new file, in 'pwndbg/gdblib/shellcode.py'
* Add warnings and fix a few nits
* Lint
* Update pwndbg/commands/mmap.py
* Update pwndbg/commands/mmap.py
* Update pwndbg/commands/mmap.py
* Update pwndbg/commands/mmap.py
* Update pwndbg/commands/mmap.py
* Update pwndbg/gdblib/shellcode.py
* Update pwndbg/commands/mmap.py
* Update pwndbg/commands/mmap.py
* Make mmap faster for `--force`
* Add initial tests for `mmap`
* Update tests/gdb-tests/tests/test_mmap.py
* Add a testcase for fd-backed mmap calls
---------
Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
2 years ago
intrigus-lgtm
427bf8c96e
Port gdb-tests from bash to python ( #1916 )
...
* [WIP] Port gdb-tests from bash to python
* Use threads instead of processes
* Port gdb tests to python
* Linting
* Fix coverage "again"
* Remove bash tests
---------
Co-authored-by: intrigus <abc123zeus@live.de>
2 years ago
dependabot[bot]
13f467b024
Bump cryptography from 41.0.5 to 41.0.6 ( #1945 )
...
Bumps [cryptography](https://github.com/pyca/cryptography ) from 41.0.5 to 41.0.6.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst )
- [Commits](https://github.com/pyca/cryptography/compare/41.0.5...41.0.6 )
---
updated-dependencies:
- dependency-name: cryptography
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years ago
kotee4ko
bbfd109037
[heap] `hi` command -- feature to check if an address belongs to a chunk. ( #1938 )
...
* add hi -- heap_info
* add default return after first hit
* fix
* ready
* + Add __contains__ method of Chunk class
+ Update verbose output features
* heap_info: new chunk detection feature
* heap_info: new chunk detection feature (lint >_<)
* heap_info: new chunk detection feature (lint >_<) 2
* eap_info: new chunk detection feature (lint >_<) 3
---------
Co-authored-by: Administrator <admin@example.com>
Co-authored-by: Th3C4t <swagcat228@gmail.com>
2 years ago
psondej
05f0dbf9f9
releases.yml: add support for aarch64 packaging
2 years ago
OB
01e6657a43
sorted lists
2 years ago
OB
7eb09f6f23
lint
2 years ago
OB
80d83456a1
comment
2 years ago
OB
2393ccc155
add arm as well
2 years ago
OB
6b41c07e5b
Add sigreturn for i386 and aarch64
2 years ago
OB
209d2a9d77
lint
2 years ago
OB
e3c8cd3e87
Add --print flag to optionally print addresses of frame values
2 years ago
OB
34ddc89103
Clarifying comment
2 years ago
OB
8e77b8ce4a
Pull values from pwntools, make more architecture agnostic
2 years ago
OB
d0c3c764ad
comment additions
2 years ago
OB
d70b07830d
Implement --all flag
2 years ago
OB
380e4df03a
Print sigreturn frame, x86-64
2 years ago
psondej
68e53bcc56
README.md: add portable info
2 years ago
psondej
8a22162495
README.md: add portable info
2 years ago
Levente Polyak
139b7542cd
fix: allow site installation without enforcing a venv
...
Currently the only way to circumvent the venv checks is setting an
environment variable. However, this is not sufficient for distro site
packaging:
- if the variable is not set, its a rather bad and unexpected user
experience to somehow magically set PWNDBG_PLEASE_SKIP_VENV
- if the variable is set globally as login shell profile, this means
skipping venv is always enforced which means if gdb is loaded with a
pwndbg gdbinit.py from a git clone, its rather unexpected to skip the
venv
This patch checks for a `.skip-venv` file alongside the `gdbinit.py`
which means for site installations that use de-vendored dependencies
like during distro packaging, this file can simply be touched. It would
skip the venv when pwndbg is loaded from the site installation but at
the same time would not skip loading the venv when pwndbg is started
from a git clone.
2 years ago
Disconnect3d
61787b3597
Update pwndbg/commands/checksec.py
2 years ago
Disconnect3d
7498db42b4
Update pwndbg/commands/checksec.py
2 years ago