| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | # sclient
 | 
					
						
							| 
									
										
										
										
											2018-08-06 16:55:45 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-21 23:28:41 -06:00
										 |  |  | Secure Client for exposing TLS (aka SSL) secured services as plain-text | 
					
						
							|  |  |  | connections locally. | 
					
						
							| 
									
										
										
										
											2018-08-06 16:55:45 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | Also ideal for multiplexing a single port with multiple protocols using SNI. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Unwrap a TLS connection: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | sclient whatever.com:443 localhost:3000 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-06 17:34:32 -06:00
										 |  |  | > [listening] whatever.com:443 <= localhost:3000
 | 
					
						
							| 
									
										
										
										
											2018-08-06 16:55:45 -06:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Connect via Telnet | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | telnet localhost 3000 | 
					
						
							| 
									
										
										
										
											2018-08-06 16:55:45 -06:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Connect via netcat (nc) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | nc localhost 3000 | 
					
						
							| 
									
										
										
										
											2018-08-06 16:55:45 -06:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-06 17:34:32 -06:00
										 |  |  | cURL | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | curl http://localhost:3000 -H 'Host: whatever.com' | 
					
						
							| 
									
										
										
										
											2018-08-06 17:34:32 -06:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-21 23:28:41 -06:00
										 |  |  | A poor man's (or Windows user's) makeshift replacement for `openssl s_client`, | 
					
						
							|  |  |  | `stunnel`, or `socat`. | 
					
						
							| 
									
										
										
										
											2018-08-06 16:55:45 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | # Table of Contents
 | 
					
						
							| 
									
										
										
										
											2018-08-06 22:22:04 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | - [Install](#install) | 
					
						
							|  |  |  | - [Usage](#usage) | 
					
						
							|  |  |  | - [Examples](#examples) | 
					
						
							|  |  |  | - [Build from Source](#build-from-source) | 
					
						
							| 
									
										
										
										
											2018-08-06 22:22:04 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | # Install
 | 
					
						
							| 
									
										
										
										
											2018-08-06 16:55:45 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | ### Mac, Linux
 | 
					
						
							| 
									
										
										
										
											2018-08-06 16:55:45 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | curl -sS https://webinstall.dev/sclient | bash | 
					
						
							| 
									
										
										
										
											2018-08-06 16:55:45 -06:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | curl.exe -A MS https://webinstall.dev/sclient | powershell | 
					
						
							| 
									
										
										
										
											2018-08-06 16:55:45 -06:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | ### Downloads
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-21 23:28:41 -06:00
										 |  |  | Check the [Github Releases](https://github.com/therootcompany/sclient/releases) | 
					
						
							|  |  |  | for | 
					
						
							| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-21 23:28:41 -06:00
										 |  |  | - macOS (x64) Apple Silicon | 
					
						
							|  |  |  |   [coming soon](https://github.com/golang/go/issues/39782) | 
					
						
							| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | - Linux (x64, i386, arm64, arm6, arm7) | 
					
						
							|  |  |  | - Windows 10 (x64, i386) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Usage
 | 
					
						
							| 
									
										
										
										
											2018-08-06 16:55:45 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							| 
									
										
										
										
											2018-08-06 17:05:39 -06:00
										 |  |  | sclient [flags] <remote> <local> | 
					
						
							| 
									
										
										
										
											2018-08-06 16:55:45 -06:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | - flags | 
					
						
							| 
									
										
										
										
											2023-10-27 15:16:29 -06:00
										 |  |  |   - `-s`, `--silent` less verbose logging | 
					
						
							|  |  |  |   - `-k`, `--insecure` ignore invalid TLS (SSL/HTTPS) certificates | 
					
						
							|  |  |  |   - `--servername <domain>` spoof SNI (to disable use IP as <remote> and do | 
					
						
							| 
									
										
										
										
											2021-06-21 23:28:41 -06:00
										 |  |  |     not use this option) | 
					
						
							| 
									
										
										
										
											2023-10-27 15:16:29 -06:00
										 |  |  |   - `--alpn <protocol-list>` | 
					
						
							| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | - remote | 
					
						
							|  |  |  |   - must have servername (i.e. example.com) | 
					
						
							|  |  |  |   - port is optional (default is 443) | 
					
						
							|  |  |  | - local | 
					
						
							|  |  |  |   - address is optional (default is localhost) | 
					
						
							|  |  |  |   - must have port (i.e. 3000) | 
					
						
							| 
									
										
										
										
											2018-08-06 16:55:45 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-27 15:16:29 -06:00
										 |  |  |   -alpn string | 
					
						
							|  |  |  |     	acceptable protocols, ex: 'h2,http/1.1' 'http/1.1' (default) 'ssh' (default "http/1.1") | 
					
						
							|  |  |  |   -insecure | 
					
						
							|  |  |  |     	ignore bad TLS/SSL/HTTPS certificates | 
					
						
							|  |  |  |   -k	alias for --insecure | 
					
						
							|  |  |  |   -s	alias of --silent | 
					
						
							|  |  |  |   -servername string | 
					
						
							|  |  |  |     	specify a servername different from <remote> (to disable SNI use an IP as <remote> and do use this option) | 
					
						
							|  |  |  |   -silent | 
					
						
							|  |  |  |     	less verbose output | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | # Examples
 | 
					
						
							| 
									
										
										
										
											2018-08-06 16:55:45 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | Bridge between `telebit.cloud` and local port `3000`. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							|  |  |  | sclient telebit.cloud 3000 | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Same as above, but more explicit | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							|  |  |  | sclient telebit.cloud:443 localhost:3000 | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Ignore a bad TLS/SSL/HTTPS certificate and connect anyway. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							| 
									
										
										
										
											2018-08-06 17:05:39 -06:00
										 |  |  | sclient -k badtls.telebit.cloud:443 localhost:3000 | 
					
						
							| 
									
										
										
										
											2018-08-06 16:55:45 -06:00
										 |  |  | ``` | 
					
						
							| 
									
										
										
										
											2018-08-08 00:16:52 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | Reading from stdin | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							|  |  |  | sclient telebit.cloud:443 - | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							|  |  |  | sclient telebit.cloud:443 - </path/to/file | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Piping | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							|  |  |  | printf "GET / HTTP/1.1\r\nHost: telebit.cloud\r\n\r\n" | sclient telebit.cloud:443 | 
					
						
							|  |  |  | ``` | 
					
						
							| 
									
										
										
										
											2018-08-25 00:37:46 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | Testing for security vulnerabilities on the remote: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							| 
									
										
										
										
											2018-09-03 16:05:50 -06:00
										 |  |  | sclient --servername "Robert'); DROP TABLE Students;" -k example.com localhost:3000 | 
					
						
							| 
									
										
										
										
											2018-08-25 00:37:46 -06:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							| 
									
										
										
										
											2018-09-03 16:05:50 -06:00
										 |  |  | sclient --servername "../../../.hidden/private.txt" -k example.com localhost:3000 | 
					
						
							| 
									
										
										
										
											2018-08-25 00:37:46 -06:00
										 |  |  | ``` | 
					
						
							| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-21 23:30:56 -06:00
										 |  |  | # API
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | See [Go Docs](https://pkg.go.dev/github.com/therootcompany/sclient). | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | # Build from source
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-21 23:28:41 -06:00
										 |  |  | You'll need to install [Go](https://golang.org). See | 
					
						
							|  |  |  | [webinstall.dev/golang](https://webinstall.dev/golang) for install instructions. | 
					
						
							| 
									
										
										
										
											2020-12-02 14:23:07 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							|  |  |  | curl -sS https://webinstall.dev/golang | bash | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Then you can install and run as per usual. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							|  |  |  | git clone https://git.rootprojects.org/root/sclient.go.git | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | pushd sclient.go | 
					
						
							|  |  |  |   go build -o dist/sclient cmd/sclient/main.go | 
					
						
							|  |  |  |   sudo rsync -av dist/sclient /usr/local/bin/sclient | 
					
						
							|  |  |  | popd | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | sclient example.com:443 localhost:3000 | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ## Install or Run with Go
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							|  |  |  | go get git.rootprojects.org/root/sclient.go/cmd/sclient | 
					
						
							|  |  |  | go run git.rootprojects.org/root/sclient.go/cmd/sclient example.com:443 localhost:3000 | 
					
						
							|  |  |  | ``` |