Original netcat
doesn't support ssl. ncat
from nmap project does.
In linux, we can connect multiple commands with pipeline.
Is it possible to combine netcat
and openssl
to create a ncat
?
3 Answers
No doubt you can do it with stunnel, a generic program that makes TCP connections such that they're done with SSL.
It's generic, so it make POP go through SSL too, making Secure POP, or it could do HTTP.
Socat is netcat on steroids. If you can use socat, see Securing Traffic Between two Socat Instances Using SSL
Use stunnel
+netcat
to connect smtp.gmail.com
:
$ grep smtp /etc/services
smtp 25/tcp mail
ssmtp 465/tcp smtps # SMTP over SSL
$ cat stunnel.conf
[gmail-smtp]
client = yes
accept = localhost:smtp
connect = smtp.gmail.com:ssmtp
$ sudo stunnel4 stunnel.conf
$ nc -C localhost smtp
220 mx.google.com ESMTP s7sm6983451paz.7
ehlo
250-mx.google.com at your service, [112.91.181.20]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH XOAUTH2
250 ENHANCEDSTATUSCODES
quit
221 2.0.0 closing connection s7sm6983451paz.7