Dobby Exploit Hook Framework

repository·master·Indexed 26 days ago

https://github.com/jmpews/dobby

A lightweight, modular exploit hook framework for multi-platform and multi-architecture environments. It supports Windows, macOS, iOS, Android, and Linux across X86, X86-64, ARM, and ARM64 architectures.

Tokens
1.3K
Snippets
5
Records
7
Agent score
39%

What's inside Dobby

  1. Overview of Dobby exploit hook framework

    master

    Dobby is a lightweight, multi-platform, and multi-architecture exploit hook framework. It is designed to be a minimal and modular library suitable for various environments.

    Supported Platforms:

    • Windows
    • macOS
    • iOS
    • Android
    • Linux

    Supported Architectures:

    • X86
    • X86-64
    • ARM
    • ARM64
  2. Build Dobby using `scripts/platform_builder.py`

    master

    Use the scripts/platform_builder.py script to automate builds for different platforms.

    iOS (iphoneos):

    python3 scripts/platform_builder.py --platform=iphoneos --arch=all

    macOS:

    python3 scripts/platform_builder.py --platform=macos --arch=all

    Linux: Requires running the setup script first to prepare CMake and LLVM.

    sh scripts/setup_linux_cross_compile.sh
    python3 scripts/platform_builder.py --platform=linux --arch=all --cmake_dir=$HOME/opt/cmake-3.25.2 --llvm_dir=$HOME/opt/llvm-15.0.6

    Android: Requires running the setup script and providing paths to CMake, LLVM, and the Android NDK.

    sh scripts/setup_linux_cross_compile.sh
    python3 scripts/platform_builder.py --platform=android --arch=all --cmake_dir=$HOME/opt/cmake-3.25.2 --llvm_dir=$HOME/opt/llvm-15.0.6 --android_ndk_dir=$HOME/opt/ndk-r25b
    python3 scripts/platform_builder.py --platform=android --arch=all --cmake_dir=$HOME/opt/cmake-3.25.2 --llvm_dir=$HOME/opt/llvm-15.0.6 --android_ndk_dir=$HOME/opt/ndk-r25b
  3. Integrate Dobby into Android Studio CMake projects

    master

    To use Dobby as a subdirectory in an Android Studio project, use add_subdirectory and configure the Dobby options using a macro to set cache variables. You must also include the Dobby include directories to ensure your native library can find the headers.

    if(NOT TARGET dobby)
    set(DOBBY_DIR /Users/jmpews/Workspace/Project.wrk/Dobby)
    macro(SET_OPTION option value)
      set(${option} ${value} CACHE INTERNAL "" FORCE)
    endmacro()
    SET_OPTION(DOBBY_DEBUG OFF)
    SET_OPTION(DOBBY_GENERATE_SHARED OFF)
    add_subdirectory(${DOBBY_DIR} dobby)
    get_property(DOBBY_INCLUDE_DIRECTORIES
      TARGET dobby
      PROPERTY INCLUDE_DIRECTORIES)
    include_directories(
      .
      ${DOBBY_INCLUDE_DIRECTORIES}
      $<TARGET_PROPERTY:dobby,INCLUDE_DIRECTORIES>
    )
    endif()
    
    add_library(native-lib SHARED
      ${DOBBY_DIR}/examples/socket_example.cc
      native-lib.cpp)
  4. Reference CMake build options for Dobby

    master

    The following CMake options are available to configure the Dobby build process:

    OptionDefaultDescription
    DOBBY_GENERATE_SHAREDONBuild shared library
    DOBBY_DEBUGOFFEnable debug logging
    NearBranchONEnable near branch trampoline
    FullFloatingPointRegisterPackOFFSave and pack all floating-point registers
    Plugin.SymbolResolverONEnable symbol resolver
    Plugin.ImportTableReplaceOFFEnable import table replace
    Plugin.Android.BionicLinkerUtilOFFEnable android bionic linker util
    DOBBY_BUILD_EXAMPLEOFFBuild example
    DOBBY_BUILD_TESTOFFBuild test
    option(DOBBY_GENERATE_SHARED "Build shared library" ON)
    option(DOBBY_DEBUG "Enable debug logging" OFF)
    option(NearBranch "Enable near branch trampoline" ON)
    option(FullFloatingPointRegisterPack "Save and pack all floating-point registers" OFF)
    option(Plugin.SymbolResolver "Enable symbol resolver" ON)
    option(Plugin.ImportTableReplace "Enable import table replace " OFF)
    option(Plugin.Android.BionicLinkerUtil "Enable android bionic linker util" OFF)
    option(DOBBY_BUILD_EXAMPLE "Build example" OFF)
    option(DOBBY_BUILD_TEST "Build test" OFF)