$ show hackerschoice/gsocket
The Global Socket Toolkit (gsocket) is a secure networking utility suite that enables TCP connections across NATs and firewalls without requiring any inbound ports. It achieves this by relaying traffic through a free cloud-based relay network (GSRN) and encrypting the session end-to-end using SRP (RFC 5054) with AES-256 and a 4096-bit prime. The project provides a core library (`libgsocket`) that abstracts the relay protocol, and several command-line tools: `gs-netcat` (a netcat-like tool for data transfer, reverse shells, port forwarding, and SOCKS proxies), `gs-sftp` (SFTP through the relay), `gs-mount` (sshfs mounting), and `blitz` (bulk file transfer). It also includes a `LD_PRELOAD`-based interposition library (`gsocket_dso`) that can transparently redirect existing network applications through the relay. The architecture is client-server with a relay network; the client establishes a connection to the relay using a shared secret token, and the server connects to the same token, allowing the relay to bridge the two. The codebase is written in C and Bash, with autotools build system, extensive cross-platform support (Linux, macOS, FreeBSD, OpenBSD, Solaris, Cygwin, OpenWRT), and CI/CD pipelines for publishing static binaries. It is a dual-use tool: it can be used for legitimate remote administration, secure file transfer, and privacy, but also includes documented patterns for hidden reverse shells and persistence, which introduces security and maintenance risks.
The LLM identified 3 files worth highlighting for reuse:
Core library implementing the GS session management: `GS_new()`, `GS_connect()`, `GS_accept()`, `GS_read()`, `GS_write()`, `GS_heartbeat()`. It handles SRP-AES-256 encrypted communication with the relay network, token authentication, and reconnection logic. This is a reusable abstraction for any application needing NAT-traversal relay connectivity, and it demonstrates clean separation of protocol logic from I/O and encryption.
A self-contained file transfer module that supports recursive directory transfer, resume, preservation of permissions and timestamps, and glob patterns. It uses a callback architecture for progress and status updates, making it reusable in any application that needs to transfer files over a stream. The module is used by both `gs-netcat -i` and `blitz`, and its design allows easy integration into new projects.
A console display subsystem that provides a scrollable log area, a status bar showing latency, throughput, and file transfer progress, and handles ANSI escape sequences for clean redraws. It is a reusable component for building interactive terminal applications with real-time status updates, and demonstrates careful handling of terminal quirks and cursor management.