A Rust rewrite of proxychains-windows - A proxifier for Win32 programs that forces TCP connections through SOCKS5 proxies.
This is a work-in-progress Rust implementation of proxychains for Windows, using modern Rust async/await, safe memory management, and strong type safety guarantees.
┌─────────────────┐ 启动 ┌─────────────────┐
│ proxychains.exe │ ───────────► │ 目标程序.exe │
│ (主控程序) │ 挂起+注入 │ (被注入DLL) │
└────────┬────────┘ └────────┬────────┘
│ │
│ Named Pipe (命名管道) │
│◄──────────────────────────────►│
│ 交换: DNS查询/FakeIP/日志 │
│ │
维护 FakeIP 映射表 Hook 网络 API
监控子进程生命周期 转发到 SOCKS5 代理
proxychains-rs/
├── Cargo.toml # Workspace root
├── src/
│ ├── main.rs # Main controller entry point
│ ├── injector.rs # DLL injection logic
│ ├── ipc_server.rs # Named pipe IPC server
│ ├── fakeip.rs # FakeIP allocation/management
│ └── config.rs # Configuration parser
├── proxychains-hook/ # Hook DLL crate
│ └── src/
│ ├── lib.rs # DLL entry point
│ ├── ipc.rs # IPC client
│ └── hooks.rs # API hooks (connect, GetAddrInfoW, etc.)
└── proxychains-common/ # Shared types and protocols
└── src/
└── lib.rs # IPC messages, config types
- Process Creation: Main program creates target process in suspended state using
CreateProcessWwithCREATE_SUSPENDEDflag - DLL Injection: Injects
proxychains_hook.dllinto target process usingCreateRemoteThread+LoadLibraryW - API Hooking: Hooked DLL intercepts Winsock functions:
connect/WSAConnect- Hijacks TCP connectionsGetAddrInfoW- Implements FakeIP DNS resolutionCreateProcessW- Propagates hooks to child processes
- FakeIP Mechanism: Returns fake IPs (198.18.x.x) for DNS queries, maps them to real hostnames internally
- SOCKS5 Proxying: Redirects all connections through configured SOCKS5 proxy
- Rust 1.75+ (2024 edition)
- Windows SDK
- Visual Studio Build Tools (for Windows API)
# Build everything
cargo build --release
# Build specific targets
cargo build --release --bin proxychains
cargo build --release --manifest-path proxychains-hook/Cargo.toml# Basic usage
proxychains.exe curl https://example.com
# With config file
proxychains.exe -c proxychains.conf firefox.exe
# Verbose mode
proxychains.exe -v ssh user@serverCreate proxychains.conf in one of these locations:
%USERPROFILE%\.proxychains\proxychains.conf%APPDATA%\Proxychains\proxychains.conf%PROGRAMDATA%\Proxychains\proxychains.conf
Example:
# SOCKS5 proxy
socks5 127.0.0.1:1080
# Enable remote DNS resolution
proxy_dns
# Quiet mode
quiet_mode
- Project structure and IPC protocol
- FakeIP allocation logic
- DLL injection framework
- API hook skeleton
- SOCKS5 client implementation
- Full DNS resolution handling
- Child process propagation
- Configuration file parsing
- Error handling and logging
GPL-2.0+ (same as original proxychains)
Based on proxychains-windows by shunf4.