refactor: finish moving ssh-* scripts to own installers
[webi-installers/.git] / sclient / README.md
1 ---
2 title: sclient
3 homepage: https://github.com/therootcompany/sclient
4 tagline: |
5   sclient: a cross-platform tool to unwrap TLS as plain text.
6 ---
7
8 To update or switch versions, run `webi sclient@stable`.
9
10 ## Cheat Sheet
11
12 > sclient unwraps encrypted connections (HTTPS/TLS/SSL) so that you can work
13 > with them as as plain text (or binary). Great for debugging web services, and
14 > security research.
15 >
16 > Think of it like netcat (or socat) + openssl s_client.
17
18 You can _literally_ use this on example.com:
19
20 ```bash
21 sclient example.com:443 localhost:3000
22 ```
23
24 To use it with an http client, just set the Host header to the original domain:
25
26 ```bash
27 curl -H "Host: example.com" http://localhost:3000
28 ```
29
30 ```html
31 <!DOCTYPE html>
32 <html>
33   <body>
34     <h1>Example Domain</h1>
35     This domain is for use in illustrative examples in documents. You may use
36     this domain in literature without prior coordination or asking for
37     permission.
38     <a href="https://www.iana.org/domains/example">More information...</a>
39   </body>
40 </html>
41 ```
42
43 ### How to Proxy SSH over SSL
44
45 SSH can be tunneled within HTTPS, TLS, SSL, WebSockets, etc.
46
47 ```bash
48 ssh -o ProxyCommand="sclient %h" jon.telebit.io
49 ```
50
51 This is useful to be able to connect to SSH even from behind a corporate
52 packet-inspection firewall. It can also be used to multiplex and relay multiple
53 ssh connections through a single host.
54
55 ### How to unwrap TLS for Telnet (HTTP/HTTPS)
56
57 ```bash
58 sclient example.com:443 localhost:3000
59 ```
60
61 ```bash
62 telnet localhost 3000
63 ```
64
65 ### How to unwrap TLS for SMTP/SMTPS/STARTTLS
66
67 ```bash
68 sclient smtp.gmail.com:465 localhost:2525
69 ```
70
71 ```bash
72 telnet localhost 2525
73
74 Trying 127.0.0.1...
75 Connected to localhost.
76 Escape character is '^]'.
77 220 smtp.gmail.com ESMTP c79-v6sm37968282pfb.147 - gsmtp
78 ```
79
80 ### How to use with stdin / stdout
81
82 ```bash
83 sclient whatever.com -
84 ```
85
86 Use just like netcat or telnet. A manual HTTP request, for example:
87
88 ```txt
89 > GET / HTTP/1.1
90 > Host: whatever.com
91 > Connection: close
92 >
93 ```
94
95 ### How to pipe connections
96
97 ```bash
98 printf "GET / HTTP/1.1\r\nHost: telebit.cloud\r\n\r\n" | sclient telebit.cloud
99 ```
100
101 ### How to Spoof SNI
102
103 Sometimes you want to check to see if your site is vulnerable to SNI-spoofing
104 attacks, such as Domain Fronting.
105
106 The literal domains `example.net` and `example.com` are _actually_ vulnerable to
107 SNI spoofing:
108
109 ```bash
110 sclient --servername example.net example.com:443 localhost:3000
111 curl -H "example.com" http://localhost:3000
112 ```
113
114 Most domains, however, are not:
115
116 ```bash
117 sclient --servername google.net google.com:443 localhost:3000
118 curl -H "google.com" http://localhost:3000
119 ```