moxie0/sslstrip

Issue with installing sslstrip

Opened this issue · 5 comments

Hi,
I am facing some issues while installing the sslstrip
I run the following command:
python setup.py build && python setup.py install
then when i run:
sslstrip -h
Traceback (most recent call last):
File "/usr/local/bin/sslstrip", line 27, in
from twisted.web import http
ImportError: No module named twisted.web

I have tried installing twisted module using apt-get but unfortunately it is not there anymore
apt-get install python-twisted
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python-twisted is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'python-twisted' has no installation candidate

when i install it using pip3 is shows that it is there
pip3 install twisted
Requirement already satisfied: twisted in /usr/lib/python3/dist-packages (18.9.0)

so please can you guide me for the proper way to install it

adding to what i have posted earlier
i tried installing it using the below command:

pip3 install sslstrip
Collecting sslstrip
Downloading sslstrip-0.9.2.tar.gz (9.2 kB)
Collecting Twisted==13.1.0
Downloading Twisted-13.1.0.tar.bz2 (2.7 MB)
|████████████████████████████████| 2.7 MB 74 kB/s
Collecting pyOpenSSL==0.13.1
Downloading pyOpenSSL-0.13.1.tar.gz (254 kB)
|████████████████████████████████| 254 kB 135 kB/s
Requirement already satisfied: zope.interface>=3.6.0 in /usr/lib/python3/dist-packages (from Twisted==13.1.0->sslstrip) (4.7.1)
Building wheels for collected packages: sslstrip, Twisted, pyOpenSSL
Building wheel for sslstrip (setup.py) ... done
Created wheel for sslstrip: filename=sslstrip-0.9.2-py3-none-any.whl size=14796 sha256=b5c3a7e8ae8768510e5cab995b0387523d48c55d14bee307c1c3730c45a37ef3
Stored in directory: /root/.cache/pip/wheels/fc/9d/90/1e5bc8d868e08c73037090addb2a01cc7b8444151828b5d7fa
Building wheel for Twisted (setup.py) ... done
Created wheel for Twisted: filename=Twisted-13.1.0-cp38-cp38-linux_x86_64.whl size=2920570 sha256=735c6c41bc7f0e6a0969ff28db00af15916a87b14d57ddfebcaf61332402a6d9
Stored in directory: /root/.cache/pip/wheels/9c/fb/12/2c2371bd134a8ce5ad854b5b5eb8d4ebf37b1e60bc31c182aa
Building wheel for pyOpenSSL (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8wdgl596/pyOpenSSL/setup.py'"'"'; file='"'"'/tmp/pip-install-8wdgl596/pyOpenSSL/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-fcirrlto
cwd: /tmp/pip-install-8wdgl596/pyOpenSSL/
Complete output (36 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/OpenSSL
copying OpenSSL/init.py -> build/lib.linux-x86_64-3.8/OpenSSL
copying OpenSSL/tsafe.py -> build/lib.linux-x86_64-3.8/OpenSSL
copying OpenSSL/version.py -> build/lib.linux-x86_64-3.8/OpenSSL
creating build/lib.linux-x86_64-3.8/OpenSSL/test
copying OpenSSL/test/init.py -> build/lib.linux-x86_64-3.8/OpenSSL/test
copying OpenSSL/test/util.py -> build/lib.linux-x86_64-3.8/OpenSSL/test
copying OpenSSL/test/test_crypto.py -> build/lib.linux-x86_64-3.8/OpenSSL/test
copying OpenSSL/test/test_rand.py -> build/lib.linux-x86_64-3.8/OpenSSL/test
copying OpenSSL/test/test_ssl.py -> build/lib.linux-x86_64-3.8/OpenSSL/test
running build_ext
building 'OpenSSL.crypto' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/OpenSSL
creating build/temp.linux-x86_64-3.8/OpenSSL/crypto
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c OpenSSL/crypto/crypto.c -o build/temp.linux-x86_64-3.8/OpenSSL/crypto/crypto.o
OpenSSL/crypto/crypto.c: In function ‘crypto_sign’:
OpenSSL/crypto/crypto.c:626:16: error: storage size of ‘md_ctx’ isn’t known
626 | EVP_MD_CTX md_ctx;
| ^~~~~~
OpenSSL/crypto/crypto.c:626:16: warning: unused variable ‘md_ctx’ [-Wunused-variable]
OpenSSL/crypto/crypto.c: In function ‘crypto_verify’:
OpenSSL/crypto/crypto.c:673:16: error: storage size of ‘md_ctx’ isn’t known
673 | EVP_MD_CTX md_ctx;
| ^~~~~~
OpenSSL/crypto/crypto.c:673:16: warning: unused variable ‘md_ctx’ [-Wunused-variable]
At top level:
OpenSSL/crypto/crypto.c:743:13: warning: ‘locking_function’ defined but not used [-Wunused-function]
743 | static void locking_function(int mode, int n, const char * file, int line) {
| ^~~~~~~~~~~~~~~~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

ERROR: Failed building wheel for pyOpenSSL
Running setup.py clean for pyOpenSSL
Successfully built sslstrip Twisted
Failed to build pyOpenSSL
Installing collected packages: Twisted, pyOpenSSL, sslstrip
Attempting uninstall: Twisted
Found existing installation: Twisted 18.9.0
Not uninstalling twisted at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'Twisted'. No files were found to uninstall.
Attempting uninstall: pyOpenSSL
Found existing installation: pyOpenSSL 19.1.0
Not uninstalling pyopenssl at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'pyOpenSSL'. No files were found to uninstall.
Running setup.py install for pyOpenSSL ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8wdgl596/pyOpenSSL/setup.py'"'"'; file='"'"'/tmp/pip-install-8wdgl596/pyOpenSSL/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-ak69o_6y/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/pyOpenSSL
cwd: /tmp/pip-install-8wdgl596/pyOpenSSL/
Complete output (36 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/OpenSSL
copying OpenSSL/init.py -> build/lib.linux-x86_64-3.8/OpenSSL
copying OpenSSL/tsafe.py -> build/lib.linux-x86_64-3.8/OpenSSL
copying OpenSSL/version.py -> build/lib.linux-x86_64-3.8/OpenSSL
creating build/lib.linux-x86_64-3.8/OpenSSL/test
copying OpenSSL/test/init.py -> build/lib.linux-x86_64-3.8/OpenSSL/test
copying OpenSSL/test/util.py -> build/lib.linux-x86_64-3.8/OpenSSL/test
copying OpenSSL/test/test_crypto.py -> build/lib.linux-x86_64-3.8/OpenSSL/test
copying OpenSSL/test/test_rand.py -> build/lib.linux-x86_64-3.8/OpenSSL/test
copying OpenSSL/test/test_ssl.py -> build/lib.linux-x86_64-3.8/OpenSSL/test
running build_ext
building 'OpenSSL.crypto' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/OpenSSL
creating build/temp.linux-x86_64-3.8/OpenSSL/crypto
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c OpenSSL/crypto/crypto.c -o build/temp.linux-x86_64-3.8/OpenSSL/crypto/crypto.o
OpenSSL/crypto/crypto.c: In function ‘crypto_sign’:
OpenSSL/crypto/crypto.c:626:16: error: storage size of ‘md_ctx’ isn’t known
626 | EVP_MD_CTX md_ctx;
| ^~~~~~
OpenSSL/crypto/crypto.c:626:16: warning: unused variable ‘md_ctx’ [-Wunused-variable]
OpenSSL/crypto/crypto.c: In function ‘crypto_verify’:
OpenSSL/crypto/crypto.c:673:16: error: storage size of ‘md_ctx’ isn’t known
673 | EVP_MD_CTX md_ctx;
| ^~~~~~
OpenSSL/crypto/crypto.c:673:16: warning: unused variable ‘md_ctx’ [-Wunused-variable]
At top level:
OpenSSL/crypto/crypto.c:743:13: warning: ‘locking_function’ defined but not used [-Wunused-function]
743 | static void locking_function(int mode, int n, const char * file, int line) {
| ^~~~~~~~~~~~~~~~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Can't roll back pyOpenSSL; was not uninstalled
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8wdgl596/pyOpenSSL/setup.py'"'"'; file='"'"'/tmp/pip-install-8wdgl596/pyOpenSSL/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-ak69o_6y/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/pyOpenSSL Check the logs for full command output.

yet when i run sslstrip command i get the same error:
Traceback (most recent call last):
File "/usr/local/bin/sslstrip", line 27, in
from twisted.web import http
ImportError: No module named twisted.web

We removed sslstrip and python-twisted-web from kali because the packages are in Python 2 (EOL).
For sslstrip, there was no upstream change since 2011.

Then now what I should do to install the sslstrip ?
I need the sslstrip

There's a way to install python2 on Kali2020.3 without breaking anything. I got it working like this:

sudo -i
apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev
curl https://pyenv.run | bash

Add following lines to /root/.bashrc
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

exit
sudo -i
pyenv install 2.7.18
pyenv global 2.7.18
pip install Twisted==18.9.0
pip install service_identity

After this I was able to run sslstrip again. I got some errors in console sometimes but functionality was there.

Oh. Do go back to python3 just remove the lines in .bashrc and start a new shell.