GEP (GDB Enhanced Prompt) is a GDB plug-in which make your GDB command prompt more con and flexibility.
GDB's original prompt is using hardcoded built-in GNU readline library, we can't add our custom function and key binding
easily. The old way to implement them is by patching the GDB's C source code and compiling it again.
But now, you can write your function in Python and use arbitrary key binding easily with GEP without any patching!
And also, GEP has some awesome features already, you can directly use it!
geprc.pyMake sure you have GDB 12.1+ (ideally GDB 14.1+ for the best experience) and compiled with Python3.10+ bindings, then:
1. Install git
2. Make sure you have installed
3. Install fzf: Installation (Optional, but GEP works better with fzf)
4. Install this plug-in by:
5. Enjoy!
<details>
<summary>For the users of portable pwndbg</summary>
After you installed git, fzf, and pwndbg, you can install GEP by:
</details>
> [!IMPORTANT]
> After the installation, the install.sh will automatically add source /path/to/GEP/gdbinit-gep.py to your ~/.gdbinit file if --skip-gdbinit is not specified.
> Please make sure this line is always in your ~/.gdbinit file during future modifications of your ~/.gdbinit. Otherwise, you need to manually source it via CLI options (See the GDB documentation for more information).
If your ~/.gdbinit is something like this: source ~/.local/share/GEP/gdbinit-gep.py, then you can update GEP by:
You can modify the configuration for history, auto-completion, and other GEP configurations in /path/to/GEP/gdbinit-gep.
You can also add your custom key bindings by modifying /path/to/GEP/geprc.py.
> [!NOTE]
> The example subdirectory houses samples and default configurations.
Since GDB doesn't have a good Python API to fully control and emulate its prompt, this plug-in has some side
effects.
However, the side effects are a, here are the guides to avoid them:
TUI modeSomehow, GEP breaks the TUI mode in GDB, so it's ad not to use GDB's built-in TUI when working with GEP (refer to issue #13).
Instead of using gdb TUI, I personally recommend trying pwndbg/pwndbg, hugsy/gef and cyrus-and/gdb-dashboard to enhance your debugging experience.
> If you have any ideas to resolve this issue, PRs are greatly appreciated. 🙏
gdb.event.before_promptThe GDB Python API event: gdb.event.before_prompt may be called only once.
So if you are using a GDB plug-in that is listening on this event, this plug-in will cause some bugs.
> [!NOTE]
> pwndbg, gef, and gdb-dashboard won't be affected by this side effect so far, but please open an issue if you find any plug-in that is affected by this side effect.
To avoid this, you can change the callback function by adding them to gdb.prompt_hook, gdb.prompt_hook has almost
the same effects with event.before_prompt, but gdb.prompt_hook can be directed invoke, so this plug-in still can
emulate that callback for you!
dont-repeatWhen your input is empty and directly press <kbd>ENTER</kbd>, GDB will execute the previous command from history if that command
doesn't have the property: dont-repeat.
As far as I know, there is no GDB API for checking a command's property.
So, I added some commonly used commands (for original GDB API and GEF) which have that property in a set to avoid
repeatedly executing them.
If you have some user-defined function that has dont-repeat property, add your command into the set manually, too.
> [!NOTE]
> The set of those user-defined commands are in geprc.py and the name for it is DONT_REPEAT.
>
> If you found some builtin commands which should or shouldn't be added by default, let me know on the issue page, thanks!
If this is your current ~/.gdbinit file after the installation:
Then, you can uninstall this plug-in by:
And remove source /path/to/GEP/gdbinit-gep.py from your ~/.gdbinit.
Some ideas/code are inspired by hugsy/gef and pwndbg/pwndbg.
Thanks!
If you found any bug, or you have any suggestions/ideas about this plug-in, feel free to leave your feedback on the
GitHub issue page or send me a pull request!
Thanks!
开发语言:Python
Star 数:139
该项目属于CTF思路方向的开源资源,代码结构清晰,适合安全研究人员学习参考。项目围绕GEP (GDB Enhanced Prompt) - a GDB plug-in to enhance your GDB with fzf history search, fzf tab auto-completion, fish-like autosuggestions, and more!展开,提供了可运行的实现,对理解相关安全机制、工具原理与攻防技术具有较高的研究价值。
从技术实现角度看,此类项目的核心在于对底层原理的深入理解与工程化落地。开发者在研究过程中可以结合官方文档与社区讨论,梳理项目的初始化流程、核心模块职责与数据流转,逐步掌握其中的技术细节与设计思路。
1. 下载源码压缩包,解压到本地环境。
2. 根据项目类型准备对应的运行环境与依赖。
3. 按照 README 中的步骤完成配置与部署。
4. 在隔离的测试环境中运行验证,避免影响生产系统。
本资源来源于开源社区,仅供安全研究、技术学习与合法授权范围内的攻防演练使用,请勿用于任何非法或侵害他人权益的用途。使用本项目产生的一切后果由使用者自行承担。
| 资源标题 | GEP - GEP ( GDB增强提示) -一个GDB插件,用于增强 |
| 所属分类 | CTF思路 |
| 发布作者 | admin |
| 发布时间 | 2026-10-05 23:51:01 |
| 下载权限 | 免费下载 |
| 附件数量 | 2 个下载链接 |
| 浏览次数 | 505 |
| 讨论数量 | 0 |
| 主题状态 | 正常讨论中 |