Convert Figma logo to code with AI

hugsy logogef

GEF (GDB Enhanced Features) - a modern experience for GDB with advanced debugging capabilities for exploit devs & reverse engineers on Linux

6,915
729
6,915
13

Top Related Projects

7,493

Exploit Development and Reverse Engineering with GDB Made Easy

5,871

PEDA - Python Exploit Development Assistance for GDB

6,168

A hacky debugger UI for hackers

1,323

20,547

UNIX-like reverse engineering framework and command-line toolset

15,782

Free and Open Source Reverse Engineering Platform powered by rizin

Quick Overview

GEF (GDB Enhanced Features) is a set of commands for GDB, the GNU debugger, to enhance its capabilities and make debugging easier. It provides a more user-friendly interface, additional features, and improved visualization for reverse engineering and exploit development.

Pros

  • Enhances GDB with a more intuitive and feature-rich interface
  • Provides powerful visualization tools for memory, registers, and stack
  • Supports multiple architectures (x86, ARM, MIPS, PowerPC)
  • Includes built-in exploit development helpers and ROP gadget search

Cons

  • Requires Python 3, which may not be available on all systems
  • Can be slower than vanilla GDB for some operations
  • May have a steeper learning curve for users new to advanced debugging techniques
  • Some features may not work consistently across all supported architectures

Getting Started

To install GEF:

# Clone the repository
git clone https://github.com/hugsy/gef.git

# Add GEF to your GDB configuration
echo "source ~/path/to/gef/gef.py" >> ~/.gdbinit

# Start GDB with GEF
gdb -q

Once installed, you can use GEF commands within GDB. For example:

gef➤ checksec
[+] checksec for '/path/to/binary'
Canary                        : ✓
NX                            : ✓
PIE                           : ✓
Fortify                       : ✘
RelRO                         : Full

gef➤ vmmap
Start              End                Offset             Perm Path
0x0000555555554000 0x0000555555555000 0x0000000000000000 r-- /path/to/binary
0x0000555555555000 0x0000555555556000 0x0000000000001000 r-x /path/to/binary
0x0000555555556000 0x0000555555557000 0x0000000000002000 r-- /path/to/binary
...

gef➤ heap chunks
Chunk(addr=0x555555559260, size=0x290, flags=PREV_INUSE)
    [0x0000555555559260     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................]
Chunk(addr=0x5555555594f0, size=0x30, flags=PREV_INUSE)
    [0x00005555555594f0     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................]
...

These examples demonstrate some of GEF's features, including security checks, memory mapping, and heap analysis. GEF provides many more commands and capabilities to assist in debugging and reverse engineering tasks.

Competitor Comparisons

7,493

Exploit Development and Reverse Engineering with GDB Made Easy

Pros of pwndbg

  • More focused on exploit development and reverse engineering
  • Better integration with GDB's Python API
  • Faster startup time and lower memory usage

Cons of pwndbg

  • Less extensive feature set compared to GEF
  • Steeper learning curve for beginners
  • Limited compatibility with older GDB versions

Code Comparison

pwndbg:

@pwndbg.commands.ParsedCommand
@pwndbg.commands.OnlyWhenRunning
def context(*args):
    if len(args) == 0:
        args = ['reg','code','stack','backtrace']

GEF:

@register_command
class ContextCommand(GenericCommand):
    """Displays a comprehensive and modular summary of runtime context."""
    _cmdline_ = "context"
    _syntax_  = "{:s} [reg|code|stack|all]".format(_cmdline_)

Both projects aim to enhance GDB for reverse engineering and exploit development, but they have different approaches. pwndbg focuses on speed and integration with GDB's Python API, while GEF offers a more extensive feature set at the cost of higher resource usage. The choice between them often comes down to personal preference and specific use cases.

5,871

PEDA - Python Exploit Development Assistance for GDB

Pros of PEDA

  • Lighter weight and faster to load than GEF
  • Simpler setup process with fewer dependencies
  • Better compatibility with older GDB versions

Cons of PEDA

  • Less actively maintained compared to GEF
  • Fewer advanced features and customization options
  • Limited support for non-x86 architectures

Code Comparison

PEDA command example:

peda.execute_redirect('checksec')

GEF command example:

gef.execute('checksec')

Both projects extend GDB functionality, but GEF offers a more modern and feature-rich approach, while PEDA focuses on simplicity and ease of use. GEF provides better support for multiple architectures and has a more active development community. PEDA, on the other hand, is lighter and may be preferred for simpler debugging tasks or on systems with limited resources.

The code examples show that both projects implement similar commands, but GEF's implementation is generally more comprehensive and offers additional options. GEF also provides a more consistent and user-friendly interface across its various features.

Overall, the choice between PEDA and GEF depends on the user's specific needs, system requirements, and preference for either simplicity or advanced features.

6,168

A hacky debugger UI for hackers

Pros of Voltron

  • More flexible and modular architecture, allowing for easier customization
  • Supports multiple debuggers (GDB, LLDB, WinDbg) out of the box
  • Better integration with various terminal emulators and IDEs

Cons of Voltron

  • Steeper learning curve due to its modular nature
  • Less active development and community support compared to GEF
  • May require more setup and configuration for optimal use

Code Comparison

Voltron command example:

voltron view register

GEF command example:

gef> registers

Both tools provide similar functionality for viewing registers, but Voltron's modular approach allows for more customization in how the information is displayed.

Summary

Voltron offers greater flexibility and multi-debugger support, making it suitable for users who work across different debugging environments. However, GEF provides a more streamlined experience with a larger user base and more frequent updates. The choice between the two depends on the user's specific needs and preferences in terms of customization vs. ease of use.

1,323

Pros of ida

  • Specifically designed for IDA Pro, offering deep integration with the disassembler
  • Provides a comprehensive set of scripts and plugins for reverse engineering tasks
  • Includes tools for malware analysis and vulnerability research

Cons of ida

  • Limited to IDA Pro users, not as versatile for other debugging environments
  • May require more setup and configuration compared to gef's out-of-the-box experience
  • Less active community and fewer regular updates

Code Comparison

ida example:

import idaapi
import idc

def analyze_function():
    ea = idc.get_screen_ea()
    func = idaapi.get_func(ea)
    if func:
        print(f"Function at {hex(func.start_ea)}")

gef example:

@register_command
class ExampleCommand(GenericCommand):
    """Example GEF command."""
    _cmdline_ = "example"
    _syntax_  = f"{_cmdline_}"

    def do_invoke(self, argv):
        print("Hello from GEF!")

The ida code demonstrates integration with IDA Pro's API, while gef's example shows how to create custom GDB commands within the GEF framework. Both repositories offer extensibility, but ida focuses on IDA Pro-specific functionality, whereas gef provides a more general-purpose debugging environment enhancement.

20,547

UNIX-like reverse engineering framework and command-line toolset

Pros of radare2

  • More comprehensive toolkit with disassembly, debugging, and analysis capabilities
  • Supports a wide range of architectures and file formats
  • Highly extensible with plugins and scripting support

Cons of radare2

  • Steeper learning curve due to its extensive feature set
  • Command-line interface may be less intuitive for some users
  • Can be more resource-intensive for large binaries

Code Comparison

radare2:

r2 -d ./binary
[0x00400000]> aaa
[0x00400000]> pdf @ main

GEF:

gdb ./binary
gef➤ break main
gef➤ run
gef➤ disassemble

Key Differences

  • radare2 is a standalone reverse engineering framework, while GEF is a GDB extension
  • radare2 offers more advanced analysis features, but GEF provides a more user-friendly interface within GDB
  • radare2 has broader platform support, whereas GEF is primarily focused on enhancing GDB functionality

Use Cases

  • radare2: Ideal for complex reverse engineering tasks, malware analysis, and cross-platform development
  • GEF: Better suited for quick debugging sessions and exploit development within a familiar GDB environment
15,782

Free and Open Source Reverse Engineering Platform powered by rizin

Pros of Cutter

  • User-friendly GUI interface for easier navigation and visualization
  • Cross-platform support (Windows, macOS, Linux)
  • Integrated decompiler for quick analysis of binary code

Cons of Cutter

  • Larger resource footprint due to GUI components
  • Steeper learning curve for users familiar with command-line tools
  • Less flexibility for scripting and automation compared to GDB-based tools

Code Comparison

Cutter (Python API example):

import cutter

# Open binary
cutter.cmd("o /bin/ls")

# Analyze
cutter.cmd("aa")

# Print functions
print(cutter.cmdj("aflj"))

GEF (GDB commands):

gdb /bin/ls
gef➤ info functions
gef➤ disassemble main
gef➤ x/10i $pc

While both tools serve similar purposes in reverse engineering and binary analysis, Cutter offers a more visual approach with its GUI, making it accessible to a broader audience. GEF, being a GDB extension, provides a lightweight, command-line focused experience that's highly customizable and scriptable. The choice between them often depends on personal preference and specific use cases.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

logo

Discord Docs Try GEF

GEF (pronounced ʤɛf - "Jeff") is a set of commands for x86/64, ARM, MIPS, PowerPC and SPARC to assist exploit developers and reverse-engineers when using old school GDB. It provides additional features to GDB using the Python API to assist during the process of dynamic analysis and exploit development. Application developers will also benefit from it, as GEF lifts a great part of regular GDB obscurity, avoiding repeating traditional commands, or bringing out the relevant information from the debugging runtime.

Instant Setup

Simply make sure you have GDB 10.0 or higher compiled with Python3.10+ bindings, then:

# via the install script
## using curl
$ bash -c "$(curl -fsSL https://gef.blah.cat/sh)"

## using wget
$ bash -c "$(wget https://gef.blah.cat/sh -O -)"

# or manually
$ wget -O ~/.gdbinit-gef.py -q https://gef.blah.cat/py
$ echo source ~/.gdbinit-gef.py >> ~/.gdbinit

# or alternatively from inside gdb directly
$ gdb -q
(gdb) pi import urllib.request as u, tempfile as t; g=t.NamedTemporaryFile(suffix='-gef.py'); open(g.name, 'wb+').write(u.urlopen('https://tinyurl.com/gef-main').read()); gdb.execute('source %s' % g.name)

You can immediately see that GEF is correctly installed by launching GDB:

gef-context

A few of GEF features include:

  • One single GDB script
  • Entirely architecture agnostic, NO dependencies: GEF is battery-included and is installable instantly
  • Fast limiting the number of dependencies and optimizing code to make the commands as fast as possible
  • Provides a great variety of commands to drastically change your experience in GDB.
  • Easily extensible to create other commands by providing d more comprehensible layout to GDB Python API.
  • Full Python3 support (Python2 support was dropped - see gef-legacy).
  • Built around an architecture abstraction layer, so all commands work in any GDB-supported architecture such as x86-32/64, ARMv5/6/7, AARCH64, SPARC, MIPS, PowerPC, etc.
  • Suited for real-life apps debugging, exploit development, just as much as CTF
  • And a lot more commands contributed by the community available on GEF-Extras !!

Check out the Screenshot page for more or try it online (user:gef/password:gef-demo)

Documentation

Unlike other GDB plugins, GEF has an extensive and up-to-date documentation. Users are recommended to refer to it as it may help them in their attempts to use GEF. In particular, new users should navigate through it (see the FAQ for common installation problems), and the problem persists, try to reach out for help on the Discord channel or submit an issue.

Current status

DocumentationLicenseCompatibilityCI Tests (main)
DocumentationMITPython 3CI Test for GEF

Contribute

To get involved, refer to the Contribution documentation and the guidelines to start.

Sponsors

Another way to contribute to keeping the project alive is by sponsoring it! Check out the sponsoring documentation for details so you can be part of the list of those awesome sponsors.

Happy Hacking 🍻