Commit Graph

1280 Commits

Author SHA1 Message Date
Disconnect3d a00ba56872
small refactor of vmmap module (#1078) 2022-08-20 01:46:56 +02:00
Disconnect3d 51bc5e2245
Fixes #1068 2022-08-18 00:46:01 +02:00
Disconnect3d 87114367c1
Revert "Remove shell commands registration (#1064)" (#1073)
This reverts commit 06cc17b6b4.
2022-08-18 00:37:14 +02:00
Takumi Akiyama 19d59d521f
Replace with IDA 7.x API (#1024)
* Replace with IDA 7.x API

* Drop support for IDA 6.x to clean up code

* Disable logging to speed up IDA integration
2022-08-17 23:10:58 +02:00
Disconnect3d 6dd25c3617
Improve search --next speed and add --trunc-out flag (#1066)
This commit improves the `search --next ...` speed by making it so that
only the saved addresses are checked. Previously, the command performed
a full search even in the presence of `--next` flag and only afterwards
filtered the results. That resulted in extremely slow execution e.g.
when debugging processes with gigabytes of allocated memory.

The commit also adds a `--trunc-out` argument which makes it so that
only 20 results are displayed. This is helpful when performing a
CheatEngine-style search when we try to locate a given field/value
address in memory by first finding its known value, then changing its
value in the program and then re-searching the space.

The `--trunc-out` argument could further be improved by enabling it
default and making users aware that the results were truncated.
2022-08-17 22:59:41 +02:00
Disconnect3d 06cc17b6b4
Remove shell commands registration (#1064)
This PR removes ~40 commands that could be used to run shell programs.

I am removing this since GDB has the support for running shell programs
with either `shell <command...>` or `<!command...>` and so we do not
need this feature in Pwndbg anymore.

This feature also bloated Pwndbg a little bit and made more interesting
commands harder to find e.g. through the `pwndbg` command.
2022-08-14 23:32:10 +02:00
Lukasz Taczuk d99e15985c
Adds documentation for debugging with PyCharm (#1058) 2022-08-14 22:34:36 +02:00
Alan Li 2c15d03899
Add support to use heap commands without debug symbols (#1029)
* Add support to use heap commands without debug symbols

* Fix a possible bugs when getting heap boundaries via heuristic

See https://github.com/pwndbg/pwndbg/pull/1029#issuecomment-1189841299

* Fix typo causing issues in `c_malloc_par_2_25`

See https://github.com/pwndbg/pwndbg/pull/1029#issuecomment-1189841299

* Fix a bug for `tcache_perthread_struct` and refactor some codes in `structs.py`

* The bug: `tcache_perthread_struct` for GLIBC < 2.30 is using `char` instead of `uint16_t` for `counts` field

* Fix some bugs about handling `thread_arena` and `tcache` with multithreaded

* Re-initialize the heap when the process stop or the file changed

By doing this, we can attach to another architecture in GDB without any bugs.

* Add guard code for unsupported architectures

* Support heuristic for arm and aarch64

Note: thread_arena and thread_cache for arm still can not work

* Update .pylintrc

* Ignore `import-error` error for `import gdb`
* Ignore `no-member` error for `pwndbg.typeinfo.*`, because most of its members are dynamically generated.
* Ignore `protected-access` warning for `_fields_`, `_type_`, `_length_`, because ctypes don't have other ways to access them.

* Refactor some code and comment to fit pep8 and lint check

* Add a feature to enable users set symbol addresses manually

For example, by using `set main_arena 0xdeadbeaf`, pwndbg will try to find main_arena at 0xdeadbeaf when using heuristic

* Use `__errno_location` to find TLS base for arm

By doing this, we can get `thread_arena` and `tcache` address

* Block other thread before `__errno_location()`

* Fix a bug for arm32 and a typo-caused bug

* Some wrong field names inside `c_heap_info` may cause some bugs in the future if we want to access it

* `pad` size of `heap_info` for arm32 is 0 byte, only i386 is 8 bytes, so I fixed it in a hard-coded way temporary

* Fix #1044 related issues

* Refactor the code about heap related config

* Use `int(address_str, 0)` to auto determine the format (https://github.com/pwndbg/pwndbg/pull/1029#discussion_r939569382)

* Use `OnlyWithResolvedHeapSyms` instead of `OnlyWithLibcDebugSyms` (https://github.com/pwndbg/pwndbg/pull/1029#discussion_r939568687)

* Use `resolve-heap-via-heuristic` instead of `resolve-via-heuristic` (https://github.com/pwndbg/pwndbg/pull/1029#discussion_r939569076)

* Update the description of `resolve-heap-via-heuristic` config (https://github.com/pwndbg/pwndbg/pull/1029#discussion_r939569069)

* Move heap related config into `heap` scope, and add a new command, `heap_config`, to show the config in that scope (https://github.com/pwndbg/pwndbg/pull/1029#discussion_r939569260)

* Refactor code about the config of heap related symbols

* Fix the logic when thread_arena is not found

* Use errno trick as a fallback for i386 and x86-64

* Update pwndbg/heap/ptmalloc.py

Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
2022-08-14 22:33:52 +02:00
Artur Czepiel a4eb1e6610
Fix xor and memfrob (#1057)
* added basic xor and memfrob tests

* refactor xor and memforb + add more tests
2022-08-11 12:15:12 +02:00
Artur Cygan f2e5c98f23
Fix context args crash on missing instruction (#1055) 2022-08-11 00:00:48 +02:00
Gulshan Singh 214f993047
Add tip about $heap_base to tips.py (#1053) 2022-08-10 23:57:20 +02:00
Artur Cygan b27a59729f
Fix aarch64 regs display (#1054) 2022-08-10 23:11:19 +02:00
Lonny Wong 23b5ab0380
fix context showing unexpectedly on first command (#1042) 2022-08-10 22:53:51 +02:00
Gulshan Singh 9f5c514d3f
Add $heap_base variable after running the heap command (#1051) 2022-08-10 22:47:52 +02:00
Janusz Kamieński 4a7f9ada3d
Remove Python 2 legacy code (#1052)
* remove py2 coding notations from files

* remove six package use and replace with proper py3 code

* remove py2 futures use

* replace unicode string literals with string literals

* remove python2 urlparse import in favor of python3 urllib.parse

* keep ida_script in py2 version

* remove hashbang python lines as the files are never ran directly
2022-08-10 22:47:09 +02:00
egoism 5e78222d50
nearpc: convert pc to pointer (#1048)
* nearpc: convert pc to pointer

* misc: soothe isort
2022-08-08 15:59:22 +02:00
Disconnect3d e867d1db0c
colorful tip of the day & more tips (#1046) 2022-08-06 23:22:15 +02:00
disconnect3d ee6e9f7526 Merge branch 'dev' of github.com:pwndbg/pwndbg into dev
* 'dev' of github.com:pwndbg/pwndbg:
  Aarch64 regs: add X30
2022-08-06 22:30:42 +02:00
disconnect3d a9b4aa205c tips: add a tip about command 2022-08-06 22:29:41 +02:00
disconnect3d 3d7d2bed4f tips: add a tip about `vmmap` 2022-08-06 22:27:14 +02:00
disconnect3d dbdda35c94 tips: add a tip about Pwndbg instruction emulation for better ctx display 2022-08-06 22:26:17 +02:00
disconnect3d efeb90579d tips: add a tip about context display 2022-08-06 22:24:03 +02:00
disconnect3d 26d90e8f97 tips: inform about the `procinfo` command 2022-08-06 22:20:44 +02:00
disconnect3d 5b7202ed2f tips: inform about the `canary` command 2022-08-06 22:19:30 +02:00
disconnect3d a66b95e7d2 tips: add tip about how we resolve kernel memory maps 2022-08-06 22:14:56 +02:00
Disconnect3d d2b2523695
Aarch64 regs: add X30
Add missing X30 register to the aarch64 register set.

Note that we do not list X29 because it is the SP (stack frame pointer)
2022-08-06 22:09:48 +02:00
disconnect3d 641ee5f5a0 Fix #1045: dont dump kernel vmmaps out of qemu kernel debug 2022-08-06 21:36:18 +02:00
Lonny Wong 52d30e2a72 vmmap supports qemu aarch64 and riscv64 2022-07-28 04:10:07 +02:00
Your Name f8860ec936 fix path 2022-07-28 04:10:07 +02:00
Your Name 9105946b8b hack-pt-dump 2022-07-28 04:10:07 +02:00
disconnect3d 5943c5e16e Fix #1020: do not show syscall name/args for non-syscall interrupt instructions on x86/x64 2022-07-19 14:07:57 -07:00
disconnect3d 695011385c nearpc: don't create list in a .extend([ ... ]) call 2022-07-19 13:20:19 -07:00
Disconnect3d 8cc0ab8b48 Update tips.py 2022-07-16 17:45:32 +01:00
Hubert Bryłkowski 3d90b2916d tip is picked at random 2022-07-16 17:45:32 +01:00
Hubert Bryłkowski 417215fada show tip of the day is default 2022-07-16 17:45:32 +01:00
Hubert Bryłkowski c8f1dbc1de run tip of the day only on startup 2022-07-16 17:45:32 +01:00
Hubert Bryłkowski 1027ff2055 Added tip of the day 2022-07-16 17:45:32 +01:00
disconnect3d 34f6cb2800 Make virtualenv warning more robust 2022-07-16 09:25:15 -07:00
Wiktor f21d568576 [#1035] Use virtualenv when available 2022-07-16 17:00:26 +01:00
disconnect3d ee1f0e493c update unicorn to 2.0.0 2022-07-16 15:43:14 +01:00
disconnect3d 71219361f5 refactor the _fs_gs_helper code 2022-07-16 07:42:23 -07:00
lebr0nli afbe6f0c6f Try fs/gs_base registers before ptrace'ing 2022-07-16 15:38:28 +01:00
Hubert Bryłkowski f7e107c1d7 fix isort 2022-07-16 15:29:12 +01:00
Hubert Bryłkowski cf7917c64b freeze requirements 2022-07-16 15:29:12 +01:00
Bet4 34a5847f04 Add gp register to MIPS 2022-07-16 15:20:03 +01:00
disconnect3d 748f4ce401 fix isort 2022-07-16 07:17:43 -07:00
Hubert Bryłkowski 5c9bd146c8 added docker-compose and instructions how to run tests there 2022-07-16 15:16:25 +01:00
disconnect3d a53abc8376 test attachp with inexistent pid: add timeout proper handling 2022-07-16 07:00:50 -07:00
disconnect3d dbd55e650f test attachp with inexistent pid: add timeout 2022-07-16 06:57:52 -07:00
disconnect3d d49b29d150 improve setflags command 2022-07-16 06:49:50 -07:00