Advanced application proxy debugger and F12-style web console
Project description
🚀 h4-debug
The Universal Application Proxy Debugger & F12-Style Web Console
h4-debug is a ridiculously powerful, injection-free, cross-language runtime debugger. It seamlessly attaches to arbitrary scripts, applications, and native Windows executables to stream highly detailed runtime telemetry (Console, Network, Disk, Exceptions, and System Events) to an elegant, real-time web dashboard.
📖 Table of Contents
- The Core Philosophy (Why No Injection?)
- How It Works Under the Hood
- Installation
- Usage
- Advanced Details & Edge Cases
- Contributing
🛡 The Core Philosophy (Why No Injection?)
In the world of application tracing and reverse engineering, a common approach to gathering deep runtime telemetry is Dynamic API Hooking (e.g., injecting custom DLLs, patching memory in real-time using trampolines, or running Kernel-mode ETW rootkits).
h4-debug rejects this methodology completely.
Instead of mutating the target process or injecting rogue binaries, h4-debug achieves perfect observability through 100% native, sanctioned OS and runtime APIs.
Why is this better?
- Zero Anti-Cheat / DRM Tripping: By avoiding memory modification,
h4-debugruns perfectly against heavily guarded applications. We act as a legitimate OS-level debugger, rather than operating like malware. - Infinite Stability: API hooking is notorious for causing arbitrary segmentation faults, race conditions, and application crashes. By using passive OS telemetry and standard runtime intercepts, the target application runs with maximum stability.
- No Rootkits Required: You do not need to compile or install dangerous kernel-mode drivers to get network and disk observability.
- Universal Compatibility: Our architecture allows us to drop in and debug Python, Node.js, and raw
.exebinaries with the exact same UX.
⚙ How It Works Under the Hood
The h4-debug architecture consists of two primary components:
- The Telemetry Server: A fast, asynchronous
FastAPIinstance managing real-time WebSocket connections and serving the UI dashboard. - The Handlers / Interceptors: Language/target-specific wrappers that boot the target application and transparently route its telemetry back to the server.
Native Executables (Windows Native Debugger)
When you run h4-debug app.exe, the tool leverages the raw Windows Win32 Debugging API (kernel32.dll) via ctypes.
- Event Loop Integration: We spawn the process using
CreateProcessWwith theDEBUG_PROCESSflag. We then captureWaitForDebugEvent, natively interceptingCREATE_PROCESS_DEBUG_EVENT,LOAD_DLL_DEBUG_EVENT, thread lifecycles, and unhandled exceptions. - Hidden Debug Strings: GUI applications (like Unity mods, game launchers, or heavy desktop apps) do not pipe logs to
stdout. Instead, they typically useOutputDebugString.h4-debuginterceptsOUTPUT_DEBUG_STRING_EVENT, usesReadProcessMemoryto safely read the buffer in real-time, and routes it to your console. - Piped stdout/stderr: For console-based native applications, we dynamically generate anonymous pipes (
CreatePipe) equipped withSTARTF_USESTDHANDLESto natively capture all standard command-line output. - Disk & Network Polling: Because we refuse to inject DLLs to hook
ws2_32.dll(Network) orntdll.dll(Disk), we launch a hyper-efficient, high-frequency background daemon (psutil). This daemon polls the target process 10 times a second, intelligently indexing newly opened file descriptors (fd) and newly active TCP/UDP endpoints, streaming live Disk and Network events directly to the dashboard.
(Note: Debugging installers or protected executables often requires Administrator privileges. h4-debug gracefully detects ERROR_ACCESS_DENIED [Error 5] or ERROR_ELEVATION_REQUIRED [Error 740] and halts, prompting you to elevate your terminal rather than crashing).
Node.js Deep Hooking
When you execute h4-debug node app.js, the tool dynamically sets the NODE_OPTIONS=--require ... environment variable before executing the Node binary.
- Console & Errors: Overrides
console.log,console.error, etc., intercepting the arguments and beaming them to the dashboard before passing them along to the originalstdout. Automatically catchesuncaughtExceptionandunhandledRejection. - Network Interception: Hot-patches the native
http.requestandhttps.requestmodules to trace the exact URL, method, and protocol of outbound network calls. - Disk Tracing: Hooks raw filesystem methods like
fs.open,fs.readFile, andfs.writeFile, logging the file paths being accessed.
Python Introspection
For h4-debug python main.py, the debugger alters PYTHONPATH and injects a custom sitecustomize.py.
- Seamless Boot: Because
sitecustomize.pyis loaded before any user code executes, we establish the Telemetry Client instantly. - Module Hooking: We hot-patch
sys.stdoutandsys.stderrto mirror all terminal output. We also monkey-patch popular HTTP libraries (likeurllib,requests, andaiohttp) to provide granular network request visibility.
📦 Installation
Install globally via pip:
pip install h4-debug --upgrade
Requires Python 3.8+
🚀 Usage
Using h4-debug is incredibly simple. Just prefix your standard commands with h4-debug:
1. Debug a Windows Executable (GUI or Console):
# Note: Run your terminal as Administrator if the .exe requires elevation!
h4-debug installer.exe --silent
h4-debug game_launcher.exe
2. Debug a Node.js Application:
h4-debug node index.js
h4-debug npm start
3. Debug a Python Script:
h4-debug python app.py
The Dashboard
Once executed, h4-debug immediately spins up a local web server (usually at http://localhost:8999) and provides a URL in the terminal. Open that URL to view the real-time F12-style developer dashboard!
The dashboard is broken into intuitive tabs:
- Console: See standard output, errors, and native
OutputDebugStringtraces. - Network: Monitor outbound HTTP/HTTPS connections and raw TCP/UDP socket activity.
- Disk: Track file read/write operations and active open file handles.
- System: Observe process creation, DLL loads, unhandled exceptions, and debugger state.
🛠 Advanced Details & Edge Cases
The "Access Denied" Error (Native Debugging)
If you attempt to debug a Windows executable and immediately see an Error 5 or Error 740 in your terminal or dashboard, this means the OS has rejected the debugger attachment.
- The Fix: This is an intended security mechanism in Windows. If an application requests Administrative privileges in its manifest, a non-elevated debugger cannot attach to it. Simply close your terminal, re-open it as Administrator, and run the command again.
The Network / Disk Polling Interval
The native execution wrapper utilizes a 10Hz (0.1s) polling loop to track open files and socket connections without risking application stability. While this is incredibly robust and will catch the vast majority of I/O (like an installer downloading a payload), microsecond-length file touches might occasionally slip past the poll. This is a deliberate architectural trade-off to ensure 100% stability and zero injection risk.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file h4_debug-0.2.6.tar.gz.
File metadata
- Download URL: h4_debug-0.2.6.tar.gz
- Upload date:
- Size: 26.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6230d2369e50e4a8e0f12ec06cd3e1a25dedf25ea619cbf98eb577fd4f1c1209
|
|
| MD5 |
3fe52bf56164cbbd3503db8ad87263ea
|
|
| BLAKE2b-256 |
81424e9a964560bf47ea9f9ff530fdb78290155a7e2d31a6c1773bf57ae38d3a
|
File details
Details for the file h4_debug-0.2.6-py3-none-any.whl.
File metadata
- Download URL: h4_debug-0.2.6-py3-none-any.whl
- Upload date:
- Size: 24.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ef5ad4470b9fc777d6b4361418cef686c89ac8f6db8717b7c127af716ee4a0d
|
|
| MD5 |
36d59b96e54bdfe1691940b050b4e8c7
|
|
| BLAKE2b-256 |
fdf58f37b3feab75cdf60ba229b743e73f8ad5d48e57e5447608973043369ec4
|