Skip to content

Instantly share code, notes, and snippets.

@dampfklon
Forked from leonjza/README.md
Last active January 29, 2019 13:46
Show Gist options
  • Save dampfklon/34f9d118bb4aca592e40ce33a35ba3b8 to your computer and use it in GitHub Desktop.
Save dampfklon/34f9d118bb4aca592e40ce33a35ba3b8 to your computer and use it in GitHub Desktop.
Custom socat with SSLv2 and SSLv3 support

socat with sslv2 and sslv3 support

This script downloads and builds OpenSSL v1.0.2q and socat v1.7.3.2 in /usr/local/src. Once complete, a symlink at /usr/local/bin/socat-ssl23 is created so that you can run it with socat-ssl23.

install

Tested on Kali Linux:

curl -fsSL https://git.io/vFBDA | bash
# socat with sslv2 && sslv3 support for proxies
# symlinks the built socat to /usr/local/bin/socat-ssl23
#
# 2017 - @leonjza
set -e
# https://en.wikipedia.org/wiki/OpenSSL
# sslv2 is ripped from 1.1.0 so build latest 1.0.2
opensslversion=1.0.2q
socatversion=1.7.3.2
working_directory=/usr/local/src
# OpenSSL first
echo "Preparing working directory..."
mkdir -p $working_directory
cd $working_directory
echo "Downloading OpenSSL $opensslversion..."
curl -s -O https://www.openssl.org/source/openssl-$opensslversion.tar.gz
echo "Unpacking and building..."
tar xvf openssl-$opensslversion.tar.gz
cd openssl-$opensslversion
./config --prefix=`pwd`/local --openssldir=/usr/lib/ssl enable-ssl2 enable-ssl3 shared
make depend
make
make -i install
# set variables to use in socat build
openssl_libs=`pwd`/local/lib
openssl_include=`pwd`/local/include
openssl_rpath="-Wl,-rpath,'\$\$ORIGIN/../openssl-$opensslversion/local/lib' -Wl,-z,origin"
echo "OpenSSL build complete."
# Next, socat!
cd $working_directory
echo "Downloading socat..."
curl -s -O http://www.dest-unreach.org/socat/download/socat-$socatversion.tar.gz
echo "Unpacking and building..."
tar xvf socat-$socatversion.tar.gz
cd socat-$socatversion
./configure LIBS="-L$openssl_libs" CPPFLAGS="-I$openssl_include" LDFLAGS="$openssl_rpath"
make
echo "Creating symlink to new socat for 'socat-ssl23'..."
ln -s `pwd`/socat /usr/local/bin/socat-ssl23
echo "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment