Giter Site home page Giter Site logo

lebr0nli / gep Goto Github PK

View Code? Open in Web Editor NEW
65.0 65.0 6.0 56 KB

GEP (GDB Enhanced Prompt) - a GDB plug-in for GDB command prompt with fzf history search, fish-like autosuggestions, tab auto-completion with fzf, partial string matching in history, and more!

License: MIT License

Python 90.68% Shell 9.32%
auto-completion autosuggestion ctf fzf gdb gdbinit gef gep history-search history-substring-search pwn pwndbg

gep's Introduction

Hi there πŸ––

I'm an undergraduate computer science student from Taiwan. My most familiar language is Python. I started to play CTF since early 2021, mainly focusing on web challenges, but I also like to solve some pwn and some pyjail/jsjail type challenges :P

I have a small blog written in Chinese here, it is mostly my CTF writeups and some notes.

gep's People

Contributors

lebr0nli avatar qiuwei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gep's Issues

gdb doesn't import prompt_toolkit from $HOME/GEP/

This is a really cool plugin and I'm eager to use its features. However, when I try to load it with source ~/GEP/.gdbinit-gep.py, I get an error about "'_GdbOutputFile' object has no attribute 'fileno'". It looks like there's some issue with prompt_toolkit. To get a full backtrace, I did the following:

(gdb) python
>from prompt_toolkit import PromptSession
>p = PromptSession()
>end
Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/home/dp12/.local/lib/python3.8/site-packages/prompt_toolkit/shortcuts/prompt.py", line 468, in __init__
    self.app = self._create_application(editing_mode, erase_when_done)
  File "/home/dp12/.local/lib/python3.8/site-packages/prompt_toolkit/shortcuts/prompt.py", line 719, in _create_application
    application: Application[_T] = Application(
  File "/home/dp12/.local/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 277, in __init__
    self.output = output or session.output
  File "/home/dp12/.local/lib/python3.8/site-packages/prompt_toolkit/application/current.py", line 70, in output
    self._output = create_output()
  File "/home/dp12/.local/lib/python3.8/site-packages/prompt_toolkit/output/defaults.py", line 77, in create_output
    return Vt100_Output.from_pty(
  File "/home/dp12/.local/lib/python3.8/site-packages/prompt_toolkit/output/vt100.py", line 466, in from_pty
    fd = stdout.fileno()
AttributeError: '_GdbOutputFile' object has no attribute 'fileno'
Error while executing Python code.

Any ideas about what might be happening?

Error when starting gdb

When I installed as instructed in README,

$ bash -c "$(curl -fsSL https://raw.githubusercontent.com/lebr0nli/GEP/main/install.sh)"

I've got this error when starting GDB.

File "~/GEP/.gdbinit-gep.py", line 77
    fzf_cmd = [f"awk '!seen[$0]++' {shlex.quote(HISTORY_FILENAME)}"]
                                                                  ^
SyntaxError: invalid syntax

Add type hints

I was too lazy to add type hints, so the code ended up looking messy.
We might have to consider incorporating mypy into our lint.sh script down the line and adding the missing type hints.

Error in `gdb.prompt_hook` might cause infinite loop

If we set gdb.prompt_hook as following:

x = 0


def foo(current_prompt):
    global x
    if x & 1:
        x += 1
        raise gdb.error("err")
    x += 1
    return "(test) "


gdb.prompt_hook = foo

GEP will step into an infinite loop after the first prompt.

fzf completion is incorrect when I set breakpoint at runtime

Hello,

First, thanks for making this simple yet awesome tool! :D

Here's the bug description:

When I set breakpoint after I run the program, the fzf tab auto-completion for symbol name encounters weird behavior.

For example, if I type B then press <tab>, the first character of each symbol name is overwritten as B.

See the following screenshot. The function name foo::B::func() is displayed as Boo::B::func(). Thus, if I press enter for completion, it will fill the name as Boo::B::func().

It seems that GEP has some problem with searching non-prefix string.

image

Here's the source.cpp:

#include <iostream>
using namespace std;

namespace foo {
class B {
  public:
    void func()
    {
        cout << "B:func" << endl;
    }
};
}
int main()
{
    foo::B b;
    b.func();
    return 0;
}

Here's my system info:

Ubuntu 20.04 (WSL 1) with all packages installed from APT
g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
Python 3.8.10

Please note that the above example is very simple. I don't if this problem occurs BEFORE I run the program.

somthing was wrong with layout src

Hi, thank you for the convenience brought by this tool to my debugging experience. It is really useful!
I find something was wrong when gdb run "layout [src|asm|}regs|split|next|prev]". The specific problems are described below.

When I typed "n", the pane of src was broken, and gdb exited when I continue typing "n", the following is the screenshot
image

The Operator system is Ubuntu 20.04.6 TLS
The version of gdb is 9.2

thanks

Update the demo on `README.md`

[![asciicast](https://asciinema.org/a/TJiEkHv3cqieR0XizG41uOg93.svg)](https://asciinema.org/a/TJiEkHv3cqieR0XizG41uOg93)

The demo on README.md is a little bit outdated, we need an update for it.

Problem with completion popup text

I was trying out this plugin (really cool btw) and I think there is a problem with the completion:

For example:

GEP

The rho)) prefix is off.

pwndbg's venv issue

In the latest pwndbg, it used venv to load its dependencies and removed all site-packages's import path.
This causes GEP to fail to load the dependency: prompt_toolkit.
To fix this, we need to create venv for GEP as well or somehow install prompt_toolkit into pwndbg's venv.
I think creating venv probably it's a better idea.

multi-line command hangs GDB

When you input a multi-line GDB command (e.g. while), GEP hangs and CPU usage increases to 100%.

image

In normal GDB, the result should be:
image

It may not be a serious problem since I don't use multi-line commands very often. But it indeed hangs and crashes GDB.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.