Skip to content

Latest commit

 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-connect

CI Release Go Version License CodeQL Stars Issues

A netcat-like tool with proxy support, written in Go.

Features

  • Direct TCP connections - Connect directly to any TCP port
  • HTTP/HTTPS Proxy - Connect through HTTP CONNECT proxies with authentication
  • SOCKS5 Proxy - Support for SOCKS5 proxies with authentication (using golang.org/x/net/proxy)
  • TLS/SSL Support - Direct TLS connections or TLS over proxy
  • Port Scanning - Zero I/O mode for port scanning
  • Listen Mode - Act as a server and accept connections
  • Verbose Output - Detailed connection information

Installation

# Install from source
go install github.com/crimson-and-clover/go-connect/cmd/go-connect@latest

# Or clone and build locally
git clone https://github.com/crimson-and-clover/go-connect.git
cd go-connect
go install ./cmd/go-connect

# Or use make
make build
make install

Usage

Direct TCP Connection

# Simple connection (like nc host port)
go-connect example.com 80
go-connect -v example.com 443

HTTP Proxy

# HTTP CONNECT proxy
go-connect -x http://proxy.company.com:8080 target.example.com 443

# With authentication
go-connect -x http://user:pass@proxy.company.com:8080 target.example.com 443

SOCKS5 Proxy

# SOCKS5
go-connect -x socks5://proxy.example.com:1080 target.com 80

# SOCKS5 with authentication
go-connect -x socks5://user:pass@proxy.example.com:1080 target.com 80

HTTPS Proxy (HTTP CONNECT over TLS)

go-connect -x https://proxy.company.com:443 target.example.com 443

TLS Connections

# Direct TLS connection
go-connect -T -v api.example.com 443

# TLS through proxy
go-connect -x socks5://proxy:1080 -T api.example.com 443

# Skip certificate verification
go-connect -T -k self-signed.example.com 443

Port Scanning

# Scan single port
go-connect -z -v target.example.com 443

# Scan port range
go-connect -z -v -w 1s target.example.com 1-1000

# Scan multiple discrete and range ports (comma or space separated)
go-connect -z -v -w 500ms target.example.com 22,80,443,8000-8010,3306
go-connect -z -v -w 500ms target.example.com 22 80 443 8080

Listen Mode

# Listen on port 8080
go-connect -l -p 8080

# With verbose output
go-connect -l -p 8080 -v
### Unix Domain Socket

```bash
# Connect to local Unix Domain Socket (e.g. Docker daemon)
echo -e "GET /v1.41/containers/json HTTP/1.0\r\n\r\n" | go-connect -U /var/run/docker.sock

# Listen on a Unix Domain Socket
go-connect -l -U /tmp/test.sock

UDP Mode

# Send UDP datagram / connect
echo "hello udp" | go-connect -u 127.0.0.1 5353

# Listen on UDP port 5353
go-connect -l -u -p 5353 -v

Options

Option Description
-x URL Proxy URL (http://, https://, socks5://)
-T Enable TLS
-k Skip TLS certificate verification
-t duration Connection timeout (default: 30s)
-v Verbose output
-u Use UDP mode
-U Use Unix Domain Socket
-z Zero I/O mode (port scanning)
-l Listen mode
-p port Port to listen on (with -l)
-w duration Timeout alias (nc compatible)
-X Hex dump incoming and outgoing traffic
-V Show version

Examples

SSH through HTTP Proxy

ssh -o ProxyCommand="go-connect -x http://proxy:8080 %h %p" user@remotehost

Git through SOCKS5 Proxy

export GIT_SSH_COMMAND="ssh -o ProxyCommand='go-connect -x socks5://127.0.0.1:1080 %h %p'"
git clone git@github.com:user/repo.git

Test HTTPS Service

echo -e "GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\n\r\n" | go-connect -T example.com 443

License

MIT License

About

A netcat-like tool with proxy support, written in Go.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages