How hackerschoice/gsocket works
Global Socket lets programs behind NAT or firewalls establish an encrypted TCP connection using a shared secret rather than peer addresses. The principal workflow is: a user starts a toolkit command, derives a temporary Global Socket identity, connects through the relay network, negotiates SRP/TLS encryption, then exchanges application streams. The sampled code covers the connection engine, nonblocking event loop, packet dispatch, gs-netcat forwarding, file transfer, console control, and preload-based socket hijacking. Other documented tools are represented only at their enclosing tools directory.
Main entry points: 4_gs-netcat.c gs-netcat · gsocket-engine.c Connection Engine · pkt_mgr.c Packet Manager · gsocket_dso.c Socket Hijacking
Components 19
Core Runtime
- Secret Identity
lib/gsocket-util.c - Connection Engine
lib/gsocket-engine.c - Select Event Loop
include/gsocket/gs-select.h
Secure Transport
- SRP TLS Layer
lib/gsocket-ssl.c
Application Protocol
- Packet Codec
lib/packet.c - Packet Manager
tools/pkt_mgr.c
Toolkit Features
- gs-netcat
tools/4_gs-netcat.c - File Transfer
tools/filetransfer.c - Interactive Console
tools/console.c
System Integration
- Socket Hijacking
tools/gsocket_dso.c - SFTP Mount Blitz
tools
Other components
- User A
- User B
- Local Program
- Relay Network
- OpenSSL
- TOR SOCKS
- Local Filesystem
- Shell Process
Connections 21
- User A → gs-netcat: starts command
- User B → gs-netcat: starts command
- gs-netcat → Secret Identity: derives identity
- gs-netcat → Connection Engine: opens socket
- Connection Engine → Relay Network: connects relay
- Connection Engine → Select Event Loop: waits for I/O
- Connection Engine → SRP TLS Layer: negotiates TLS
- SRP TLS Layer → OpenSSL: uses crypto
- Connection Engine → gs-netcat: returns connection
- gs-netcat → Packet Manager: dispatches traffic
- Packet Manager → Packet Codec: encodes packets
- Packet Manager → File Transfer: dispatches files
- gs-netcat → Interactive Console: handles console
- gs-netcat → Shell Process: forwards shell
- File Transfer → Local Filesystem: reads writes
- gs-netcat → Local Program: forwards TCP
- User A → Socket Hijacking: runs wrapper
- Socket Hijacking → Local Program: intercepts sockets
- Socket Hijacking → gs-netcat: spawns forwarder
- SFTP Mount Blitz → Connection Engine: uses library
- Connection Engine → TOR SOCKS: routes optionally