Site Map - skip to main content

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


hpr3338 :: Using openssl s_client like telnet

OpenSSL s_client is the new telnet. Here is how to use it.

<< First, < Previous, Latest >>

Hosted by klaatu on 2021-05-19 is flagged as Clean and is released under a CC-BY-SA license.
Tags: telnet, openssl.
Listen in ogg, spx, or mp3 format. | Comments (0)

Part of the series: Networking

This series will try and explain the basics of networking to the listener as well as introduce more detailed topics.

Connect to port 443 and send some HTTP signals:


$ openssl s_client -connect example.com:443
    [...snip...]
    Verify return code: 0 (ok)
    Extended master secret: no
    Max Early Data: 0
---

You're now connected. If you wait too long, your connection will likely time out. View the default landing page of the site you've connected with:


GET / HTTP/1.1
HOST: example.com

In return, you get a dump of the HTML source of the default page (usually index.html) in your terminal.

You can also use OpenSSL s_client for email servers using SSL. Before you can send credentials, you must encode your email username and passphrase into Base64. The easiest method I know is this Perl one-liner:


$ perl -MMIME::Base64 -e 'print encode_base64("myUserName");'
$ perl -MMIME::Base64 -e 'print encode_base64("myPassPhrase");'

Take note of the results.

The s_client session, aside from authentication, is basically the same as a telnet session. You can find good telnet tutorials all over the Internet, and aside from sending your credentials, they apply to s_client.

Here's a copy-paste of an example session:


$ openssl s_client -starttls smtp -connect email.example.com:587
> ehlo example.com
> auth login
##paste your user base64 string here####
##paste your password base64 string here####

> mail from: noreply@example.com
> rcpt to: admin@example.com
> data
> Subject: Test 001
This is a test email.
.
> quit

Comments

Subscribe to the comments RSS feed.

<< First, < Previous, Latest >>

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Title:
Comment:
Anti Spam Question: What does the P in HPR stand for ?