Commit Graph

1154 Commits

Author SHA1 Message Date
Tobias Faller 8b0595368d Fixed multiple alignment issues of compact register view 2021-12-06 14:56:48 +01:00
Samanta Navarro 38c38aacfa Fix typos
Typos found with codespell.
2021-12-05 13:37:10 +01:00
Tobias Faller 2616e7085c Updated permissions for Docker container 2021-12-05 00:41:56 +01:00
Tobias Faller 1cc12ad161 Added devcontainer configuration for VS Code to directly develop inside Docker container 2021-12-05 00:41:56 +01:00
Rivit 84e783a6fb Ignore printing vertical tabs in vis_heap_chunks command 2021-11-23 19:41:45 +01:00
Disconnect3d d348c74996 Update emulator.py 2021-11-13 13:36:23 +01:00
AnyKeyShik Rarity 9448cf5543 Fix error message on interrupts 2021-11-13 13:36:23 +01:00
Disconnect3d 5c0627d65b Update pwndbg/glibc.py 2021-10-18 10:33:40 +02:00
cnwangjihe e0e32dca79 fix ending of chain 2021-10-18 10:33:40 +02:00
cnwangjihe bd7c3aa2d2 add test for heap bins 2021-10-18 10:33:40 +02:00
cnwangjihe 94eea64307 safe-linking: use __libc_version when debug symbols loaded 2021-10-18 10:33:40 +02:00
cnwangjihe 09f2cb648b Add safe-linking support 2021-10-18 10:33:40 +02:00
Disconnect3d 95e3bb09df Fix lint 2021-10-10 23:45:52 +02:00
Disconnect3d 0ec31801a0 Hopefully fix windbg commands tests on CI 2021-10-10 23:45:52 +02:00
Disconnect3d 9636331504 CI: show installed packages 2021-10-10 23:45:52 +02:00
Disconnect3d 1d70e14418 Fix #932,#788: fix command parsing
When we moved to argparse command parsing we introduced `gdb_sloppy_parse` which wasn't perfect: e.g. for `gdb.parse_and_eval("__libc_start_main")` would return a `gdb.Value()` whose `.type.name` was `long long`.

As a result when code that used `gdb_sloppy_parse` then casted the result to `int(gdb_value)` it crashed because for some reason GDB errored.

This commit fixes the issues related to it by adding `AddressExpr` and `HexOrAddressExpr` functions.

It also adds tests for some of the windbg compatibility commands and fixes some nifty details here and there.
2021-10-10 23:45:52 +02:00
Disconnect3d d861d6e2fc Skip attachp tests when cant attach 2021-10-10 04:49:28 +02:00
Disconnect3d eee5dbcbf1 Remove Py2 class object inheritance
The `class T(object):` can just be `class T:` in Py3, so this commit just removes such inheritance.
2021-10-09 19:36:16 +02:00
Disconnect3d ef86a5ca3c Remove shebang and coding lines
Those lines are redundant in our case: pwndbg is not imported or launched directly.
Also, the coding lines were relevant in Py2 but are not really needed in Py3.
2021-10-09 19:34:56 +02:00
Disconnect3d 89b2df582a Remove incorrect i386 regs: dil/sil/spl/bpl
Those regs does not seem to work on i386: I can't do `i r dil` in i386 but I can do so in amd64 binaries.

Via https://www.tortall.net/projects/yasm/manual/html/arch-x86-registers.html :
```
The 64-bit x86 register set consists of 16 general purpose registers, only 8 of which are available in 16-bit and 32-bit mode. The core eight 16-bit registers are AX, BX, CX, DX, SI, DI, BP, and SP. The least significant 8 bits of the first four of these registers are accessible via the AL, BL, CL, and DL in all execution modes. In 64-bit mode, the least significant 8 bits of the other four of these registers are also accessible; these are named SIL, DIL, SPL, and BPL. The most significant 8 bits of the first four 16-bit registers are also available, although there are some restrictions on when they can be used in 64-bit mode; these are named AH, BH, CH, and DH.
```

and the table present there, it seems SIL, DIL, SPL and BPL are only available in 64-bit mode.
2021-10-09 04:17:38 +02:00
Disconnect3d 9a17798a5d Speedup emulator by disabling debug formatting when not debugging 2021-10-09 04:00:37 +02:00
Disconnect3d 270fef38e0 Remove redundant disasm.is_call function 2021-10-09 03:22:26 +02:00
Disconnect3d af4198660e Bump capstone to 4.0.2
We will e.g. have https://github.com/aquynh/capstone/pull/1625 which is useful for debugging Pwndbg capstone related features
2021-10-09 02:08:25 +02:00
Disconnect3d e239e9c1f6
Hopefully fix recursion error 2021-10-05 02:29:13 +02:00
patryk4815 c8c9e3f003 Add Codecov 2021-10-02 15:15:56 +02:00
Arusekk 9c8df00462 Add basic coverage testing 2021-10-02 15:15:56 +02:00
anthraxx 3583b5704e fix(tempdir): use safe and unpredictable cachedir location
The typeinfo module used a static global tempdir location of /tmp/pwndbg
that an attacker may control and prepare symlinks of the predictable
files that are then written to.
2021-10-02 12:17:48 +02:00
Arusekk 1c633829de Do not sort auxv, use the implicit order 2021-10-02 12:05:17 +02:00
Disconnect3d 526b3ea9c6
Hopefully fix CI tests 2021-10-02 11:15:40 +02:00
Przemysław Buczkowski b203d53b8a SLES/OpenSUSE: enable debugging repo before installing
Package glibc-debuginfo, which is a requirement,
requires repo-debug to be enabled, which is not enabled
by default.

This commit enables this repo when installing if it is
not already enabled.
2021-09-29 03:37:35 +02:00
Disconnect3d 6fd42dd5ab Add attachp command and tests for it 2021-09-21 03:20:08 +02:00
Disconnect3d 1e28920440 Stop skipping tests 2021-09-20 22:27:52 +02:00
Disconnect3d 34f9535c5f Fix isort 2021-09-20 16:55:27 +02:00
novafacing 44394463e0 Maintain backward compatibility with Python < 3.10 2021-09-20 16:50:57 +02:00
novafacing 07b7c754cd Migrate to 3.10 compatible abc usage. 2021-09-20 16:50:57 +02:00
Nicky Lim b73973392d fix typo in dd command 2021-09-19 17:30:28 +02:00
Disconnect3d f11afe2c68 Fix get_highlight_source line splitting
TL;DR: With .splitlines() we splitted over universal splitlines which did not correspond to GDB's target code line splitting...

As a result we got `context code` to produce bogus out of sync lines that didn't correspond to GDB's `line` command.

See also https://docs.python.org/3/library/stdtypes.html#str.splitlines
2021-09-16 00:39:53 +02:00
SecMeant 8cc218f0b8 Adding p2p command - pointer chain search
This command can be used to search for any length of pointer chains
in specified mappings. Pointer chain is set of pointers that point
to one another.
2021-09-15 00:48:35 +02:00
CptGibbon a7a554f3c4 Add square brackets to vmmap's anonymous map names
Addresses #957 by enclosing anonymous map names printed by vmmap in square brackets.
Search still works & xinfo plays nice, but please let me know if you find anything this breaks.
2021-09-15 00:02:18 +02:00
Disconnect3d 648c7f014e
Fix heap unprinted messages 2021-09-14 12:12:56 +02:00
Disconnect3d e2c899e4e5 Fix isort lint import issues 2021-09-14 01:59:40 +02:00
Disconnect3d 00e94a9b4a Fix unprinted 'Unknown register' context warning 2021-09-14 01:11:22 +02:00
Disconnect3d 8975d42c4d Better pwndbg.commands.OnlyWithFile error for QEMU targets
TL;DR: We don't work well with detecting QEMU targets file path so we better show a proper error message in those cases.
2021-09-14 01:06:20 +02:00
Disconnect3d c294ede7f9 pwndbg.file.get_file: better warning message 2021-09-14 01:06:20 +02:00
Disconnect3d 32cdc10442 piebase, breakrva: print error on failures 2021-09-14 01:04:44 +02:00
Disconnect3d 71291d85ba Fix vmmap_load on remote targets 2021-09-14 00:43:53 +02:00
Disconnect3d 790ba574c0 Refactor pwndbg.proc.exe and pwndbg.proc.get_file
Revert the change from 3e4ad60 and make the `pwndbg.proc.get_file` to strip the "target:" prefix instead of the `pwndbg.proc.exe`.

This way, we will prevent bugs when pwndbg code would use `pwndbg.proc.exe` on remote targets but not pass the returned path to `pwndbg.proc.get_file` to get the real remote file and instead use the local one (if it exists in the same path).

Additionally, we assert the `path` passed to `pwndbg.proc.get_file` so we prevent incorrect use of the function when an absolute path or not a remote path is passed to it.
2021-09-14 00:28:01 +02:00
Disconnect3d 933be39838 Extend pwndbg.proc.exe docs 2021-09-14 00:18:52 +02:00
Disconnect3d 3e4ad608af Fixes #955: don't return 'target:' prefix in pwndbg.proc.exe
Before this commit the `pwndbg.proc.exe` could return a "target:" prefix when `pwndbg.proc.exe` was executed on remote targets. This could be seen by:

1. Executing gdbserver in one terminal: gdbserver 127.0.0.1:1234 `which ps`
2. Executing `gdb -ex 'target remote :1234'` in another terminal and then invoking `pi pwndbg.proc.exe`.

This resulted in `checksec` (and some other) commands crashes which were using the `pwndbg.file.get_fille` functionality as it downloaded the remote file by using the `gdb.execute("remote get %s %s")` command passing it a path prefixed with `"target:"` which this GDB command does not support.
2021-09-14 00:11:54 +02:00
Disconnect3d 56e0ce4881 Remove reset_on_new_base_address decorator
The `pwndbg.memoize.reset_on_new_base_address` decorator is super problematic: its start event was called before `pwndbg.arch.update` event because the pwndbg/memoize.py file is executed faster than the pwndbg/arch.py file. This happens even if we import pwndbg/arch.py as first import because it imports regs.py and events.py and those import memoize.py and so on.

TL;DR: The decorator was quite redundant and made too many calls in the end which caused some problems when executing:
1. In one console: qemu-x86_64 -g 1234 `which ps`
2. In another, attaching to this via `gdb` -> `target remote :1234`
2021-09-13 23:37:20 +02:00