Last active
August 29, 2015 14:25
-
-
Save sjagoe/e1f4676fc9ff9b0ce365 to your computer and use it in GitHub Desktop.
Socat example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ubuntu@ip-172-20-30-106:~$ sudo apt-get install socat curl | |
.... | |
ubuntu@ip-172-20-30-106:~$ socat TCP-LISTEN:8888,fork OPENSSL:google.com:443,cafile=/etc/ssl/certs/ca-certificates.crt,verify=1 & | |
[1] 27060 | |
ubuntu@ip-172-20-30-106:~$ curl -H 'Host: google.com' localhost:8888 | |
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> | |
<TITLE>301 Moved</TITLE></HEAD><BODY> | |
<H1>301 Moved</H1> | |
The document has moved | |
<A HREF="https://www.google.com/">here</A>. | |
</BODY></HTML> | |
ubuntu@ip-172-20-30-106:~$ curl -o /dev/null -vvv -H 'Host: www.google.com' localhost:8888 | |
* Rebuilt URL to: localhost:8888/ | |
* Hostname was NOT found in DNS cache | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 127.0.0.1... | |
* Connected to localhost (127.0.0.1) port 8888 (#0) | |
> GET / HTTP/1.1 | |
> User-Agent: curl/7.35.0 | |
> Accept: */* | |
> Host: www.google.com | |
> | |
< HTTP/1.1 200 OK | |
< Date: Thu, 16 Jul 2015 18:24:28 GMT | |
< Expires: -1 | |
< Cache-Control: private, max-age=0 | |
< Content-Type: text/html; charset=ISO-8859-1 | |
< P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info." | |
* Server gws is not blacklisted | |
< Server: gws | |
< X-XSS-Protection: 1; mode=block | |
< X-Frame-Options: SAMEORIGIN | |
< Set-Cookie: PREF=ID=1111111111111111:FF=0:TM=1437071068:LM=1437071068:V=1:S=4KUdrA9pIL9YvNX6; expires=Sat, 15-Jul-2017 18:24:28 GMT; path=/; domain=.google.com | |
< Set-Cookie: NID=69=QQGbXKrSH1qQWf7Gn-EIKZf2oI3FzVotxnlPsei-ElLGcGE6vYnJ1Z9d-u4ypBuK8QH8C1M2x3znvC4_dJCewVmSSGzZiujiAb85f-eKpQ3MQbRmyHRh76LX74KVyGFm; expires=Fri, 15-Jan-2016 18:24:28 GMT; path=/; domain=.google.com; HttpOnly | |
< Alternate-Protocol: 443:quic,p=1 | |
< Accept-Ranges: none | |
< Vary: Accept-Encoding | |
< Transfer-Encoding: chunked | |
< | |
{ [data not shown] | |
100 19118 0 19118 0 0 262k 0 --:--:-- --:--:-- --:--:-- 266k | |
* Connection #0 to host localhost left intact |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment