nettitude / PoshC2

A proxy aware C2 framework used to aid red teamers with post-exploitation and lateral movement.
BSD 3-Clause "New" or "Revised" License
1.8k stars 326 forks source link

Decryption error: No module named 'Crypto' #105

Closed VirtualAlllocEx closed 4 years ago

VirtualAlllocEx commented 4 years ago

Hello,

I a tried to install and use the current Version of PoshC2 V6 at following Version of Kali Linux:

I also tried it a few times on a fresh Kali Installation 2019.4 and 2020.2.

After installing the PoshC2 V6 Framework I configured it, set in the configuration my Kali IP and started the posh-server application. In the next step I started the cliene 'posh'

Issue: After executing any payload no C2 Channel opens and in the window with 'posh-server' I got always following message:

Decryption error: No module named 'Crypto' Traceback (most recent call last): File "/opt/PoshC2/poshc2/server/C2Server.py", line 298, in do_GET decCookie = decrypt(KEY.encode("utf-8"), cookieVal) File "/opt/PoshC2/poshc2/server/Core.py", line 70, in decrypt aes = get_encryption(key, iv) File "/opt/PoshC2/poshc2/server/Core.py", line 59, in get_encryption from Crypto.Cipher import AES ModuleNotFoundError: No module named 'Crypto'

I installed it new for a few times, but there is always the same problem. Also I tried following:

But that also does not help.

Would be great if you have a solution for that, many thanks!

benpturner commented 4 years ago

Hi,

Sorry to hear your having issues, we are using a Python3.8 virtual environment with PoshC2 so you need to make sure you are in the PoshC2 folder then run the install of the requirements, i've seen a lot of errors with some of the very bleeding edge python repos.

Try this and see if you get any errors:

cd /opt/PoshC2 python3 -m pipenv --python 3 run pip install -r requirements.txt

VirtualAlllocEx commented 4 years ago

Hi Ben,

thanks for the quick response! I tried it but there is still the same error, also after completly new installing PoshC2 with:

At installing or at using the 'python3 -m pipenv --python 3 run pip install -r requirements.txt' there comes a very long Error Message, which I think is the reason for the problem. But I don't know how to fix it.

root@kali:/opt/PoshC2# python3 -m pipenv --python 3 run pip install -r requirements.txt Virtualenv already exists! Removing existing virtualenv… Creating a virtualenv for this project… Pipfile: /opt/PoshC2/Pipfile Using /usr/bin/python3.7 (3.7.7) to create virtualenv… ⠦ Creating virtual environment...created virtual environment CPython3.7.7.final.0-64 in 409ms creator CPython3Posix(dest=/root/.local/share/virtualenvs/PoshC2-KGSTtxLR, clear=False, global=False) seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=/root/.local/share/virtualenv/seed-a pp-data/v1.0.1) activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator ✔ Successfully created virtual environment! Virtualenv location: /root/.local/share/virtualenvs/PoshC2-KGSTtxLR Collecting pyopenssl Using cached pyOpenSSL-19.1.0-py2.py3-none-any.whl (53 kB) Collecting pandas Using cached pandas-1.0.3-cp37-cp37m-manylinux1_x86_64.whl (10.0 MB) Collecting prompt_toolkit Using cached prompt_toolkit-3.0.5-py3-none-any.whl (351 kB) Processing /root/.cache/pip/wheels/5e/03/1e/e1e954795d6f35dfc7b637fe2277bff021303bd9570ecea653/PyYAML-5.3.1-cp37-cp37m-linux_x86_64.whl Collecting pytest Using cached pytest-5.4.2-py3-none-any.whl (247 kB) Collecting pycrypto Using cached pycrypto-2.6.1.tar.gz (446 kB) Collecting psycopg2 Using cached psycopg2-2.8.5.tar.gz (380 kB) Collecting six>=1.5.2 Using cached six-1.15.0-py2.py3-none-any.whl (10 kB) Collecting cryptography>=2.8 Using cached cryptography-2.9.2-cp35-abi3-manylinux2010_x86_64.whl (2.7 MB) Collecting numpy>=1.13.3 Using cached numpy-1.18.4-cp37-cp37m-manylinux1_x86_64.whl (20.2 MB) Collecting python-dateutil>=2.6.1 Using cached python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB) Collecting pytz>=2017.2 Using cached pytz-2020.1-py2.py3-none-any.whl (510 kB) Collecting wcwidth Using cached wcwidth-0.1.9-py2.py3-none-any.whl (19 kB) Collecting attrs>=17.4.0 Using cached attrs-19.3.0-py2.py3-none-any.whl (39 kB) Collecting more-itertools>=4.0.0 Using cached more_itertools-8.3.0-py3-none-any.whl (44 kB) Collecting importlib-metadata>=0.12; python_version < "3.8" Using cached importlib_metadata-1.6.0-py2.py3-none-any.whl (30 kB) Collecting packaging Using cached packaging-20.4-py2.py3-none-any.whl (37 kB) Collecting pluggy<1.0,>=0.12 Using cached pluggy-0.13.1-py2.py3-none-any.whl (18 kB) Collecting py>=1.5.0 Using cached py-1.8.1-py2.py3-none-any.whl (83 kB) Collecting cffi!=1.11.3,>=1.8 Using cached cffi-1.14.0-cp37-cp37m-manylinux1_x86_64.whl (400 kB) Collecting zipp>=0.5 Using cached zipp-3.1.0-py3-none-any.whl (4.9 kB) Collecting pyparsing>=2.0.2 Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB) Collecting pycparser Using cached pycparser-2.20-py2.py3-none-any.whl (112 kB) Building wheels for collected packages: pycrypto, psycopg2 Building wheel for pycrypto (setup.py) ... error ERROR: Command errored out with exit status 1: command: /root/.local/share/virtualenvs/PoshC2-KGSTtxLR/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-in stall-w3rceo13/pycrypto/setup.py'"'"'; file='"'"'/tmp/pip-install-w3rceo13/pycrypto/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', ope n)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp /pip-wheel-27ngle1h cwd: /tmp/pip-install-w3rceo13/pycrypto/ Complete output (216 lines): running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.7 creating build/lib.linux-x86_64-3.7/Crypto copying lib/Crypto/pct_warnings.py -> build/lib.linux-x86_64-3.7/Crypto copying lib/Crypto/init.py -> build/lib.linux-x86_64-3.7/Crypto creating build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/MD5.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/SHA256.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/HMAC.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/MD4.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/SHA512.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/MD2.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/SHA224.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/SHA384.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/RIPEMD.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/hashalgo.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/init.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/SHA.py -> build/lib.linux-x86_64-3.7/Crypto/Hash creating build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/CAST.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/ARC2.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/DES.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/blockalgo.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/Blowfish.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/ARC4.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/XOR.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/PKCS1_OAEP.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/init.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/PKCS1_v1_5.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/AES.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/DES3.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher creating build/lib.linux-x86_64-3.7/Crypto/Util copying lib/Crypto/Util/Counter.py -> build/lib.linux-x86_64-3.7/Crypto/Util copying lib/Crypto/Util/py3compat.py -> build/lib.linux-x86_64-3.7/Crypto/Util copying lib/Crypto/Util/RFC1751.py -> build/lib.linux-x86_64-3.7/Crypto/Util copying lib/Crypto/Util/_number_new.py -> build/lib.linux-x86_64-3.7/Crypto/Util copying lib/Crypto/Util/randpool.py -> build/lib.linux-x86_64-3.7/Crypto/Util copying lib/Crypto/Util/asn1.py -> build/lib.linux-x86_64-3.7/Crypto/Util copying lib/Crypto/Util/init.py -> build/lib.linux-x86_64-3.7/Crypto/Util copying lib/Crypto/Util/winrandom.py -> build/lib.linux-x86_64-3.7/Crypto/Util copying lib/Crypto/Util/number.py -> build/lib.linux-x86_64-3.7/Crypto/Util creating build/lib.linux-x86_64-3.7/Crypto/Random copying lib/Crypto/Random/_UserFriendlyRNG.py -> build/lib.linux-x86_64-3.7/Crypto/Random copying lib/Crypto/Random/random.py -> build/lib.linux-x86_64-3.7/Crypto/Random copying lib/Crypto/Random/init.py -> build/lib.linux-x86_64-3.7/Crypto/Random creating build/lib.linux-x86_64-3.7/Crypto/Random/Fortuna copying lib/Crypto/Random/Fortuna/FortunaGenerator.py -> build/lib.linux-x86_64-3.7/Crypto/Random/Fortuna copying lib/Crypto/Random/Fortuna/SHAd256.py -> build/lib.linux-x86_64-3.7/Crypto/Random/Fortuna copying lib/Crypto/Random/Fortuna/FortunaAccumulator.py -> build/lib.linux-x86_64-3.7/Crypto/Random/Fortuna copying lib/Crypto/Random/Fortuna/init.py -> build/lib.linux-x86_64-3.7/Crypto/Random/Fortuna creating build/lib.linux-x86_64-3.7/Crypto/Random/OSRNG copying lib/Crypto/Random/OSRNG/posix.py -> build/lib.linux-x86_64-3.7/Crypto/Random/OSRNG copying lib/Crypto/Random/OSRNG/fallback.py -> build/lib.linux-x86_64-3.7/Crypto/Random/OSRNG copying lib/Crypto/Random/OSRNG/init.py -> build/lib.linux-x86_64-3.7/Crypto/Random/OSRNG copying lib/Crypto/Random/OSRNG/rng_base.py -> build/lib.linux-x86_64-3.7/Crypto/Random/OSRNG creating build/lib.linux-x86_64-3.7/Crypto/SelfTest copying lib/Crypto/SelfTest/st_common.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest copying lib/Crypto/SelfTest/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest creating build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_ARC2.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_AES.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/common.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_ARC4.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_pkcs1_15.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_DES3.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_Blowfish.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_pkcs1_oaep.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_XOR.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_CAST.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_DES.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher creating build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_MD4.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_SHA224.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_RIPEMD.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_SHA.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/common.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_HMAC.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_SHA512.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_SHA256.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_MD5.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_SHA384.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_MD2.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash creating build/lib.linux-x86_64-3.7/Crypto/SelfTest/Protocol copying lib/Crypto/SelfTest/Protocol/test_chaffing.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Protocol copying lib/Crypto/SelfTest/Protocol/test_rfc1751.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Protocol copying lib/Crypto/SelfTest/Protocol/test_KDF.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Protocol copying lib/Crypto/SelfTest/Protocol/test_AllOrNothing.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Protocol copying lib/Crypto/SelfTest/Protocol/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Protocol creating build/lib.linux-x86_64-3.7/Crypto/SelfTest/PublicKey copying lib/Crypto/SelfTest/PublicKey/test_ElGamal.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/PublicKey copying lib/Crypto/SelfTest/PublicKey/test_RSA.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/PublicKey copying lib/Crypto/SelfTest/PublicKey/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/PublicKey copying lib/Crypto/SelfTest/PublicKey/test_importKey.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/PublicKey copying lib/Crypto/SelfTest/PublicKey/test_DSA.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/PublicKey creating build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random copying lib/Crypto/SelfTest/Random/test_random.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random copying lib/Crypto/SelfTest/Random/test_rpoolcompat.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random copying lib/Crypto/SelfTest/Random/testUserFriendlyRNG.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random copying lib/Crypto/SelfTest/Random/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random creating build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/Fortuna copying lib/Crypto/SelfTest/Random/Fortuna/test_FortunaAccumulator.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/Fortuna copying lib/Crypto/SelfTest/Random/Fortuna/test_FortunaGenerator.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/Fortuna copying lib/Crypto/SelfTest/Random/Fortuna/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/Fortuna copying lib/Crypto/SelfTest/Random/Fortuna/test_SHAd256.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/Fortuna creating build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/OSRNG copying lib/Crypto/SelfTest/Random/OSRNG/test_posix.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/OSRNG copying lib/Crypto/SelfTest/Random/OSRNG/test_winrandom.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/OSRNG copying lib/Crypto/SelfTest/Random/OSRNG/test_fallback.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/OSRNG copying lib/Crypto/SelfTest/Random/OSRNG/test_generic.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/OSRNG copying lib/Crypto/SelfTest/Random/OSRNG/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/OSRNG copying lib/Crypto/SelfTest/Random/OSRNG/test_nt.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/OSRNG creating build/lib.linux-x86_64-3.7/Crypto/SelfTest/Util copying lib/Crypto/SelfTest/Util/test_number.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Util copying lib/Crypto/SelfTest/Util/test_winrandom.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Util copying lib/Crypto/SelfTest/Util/test_Counter.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Util copying lib/Crypto/SelfTest/Util/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Util copying lib/Crypto/SelfTest/Util/test_asn1.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Util creating build/lib.linux-x86_64-3.7/Crypto/SelfTest/Signature copying lib/Crypto/SelfTest/Signature/test_pkcs1_pss.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Signature copying lib/Crypto/SelfTest/Signature/test_pkcs1_15.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Signature copying lib/Crypto/SelfTest/Signature/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Signature creating build/lib.linux-x86_64-3.7/Crypto/Protocol copying lib/Crypto/Protocol/Chaffing.py -> build/lib.linux-x86_64-3.7/Crypto/Protocol copying lib/Crypto/Protocol/init.py -> build/lib.linux-x86_64-3.7/Crypto/Protocol copying lib/Crypto/Protocol/AllOrNothing.py -> build/lib.linux-x86_64-3.7/Crypto/Protocol copying lib/Crypto/Protocol/KDF.py -> build/lib.linux-x86_64-3.7/Crypto/Protocol creating build/lib.linux-x86_64-3.7/Crypto/PublicKey copying lib/Crypto/PublicKey/_slowmath.py -> build/lib.linux-x86_64-3.7/Crypto/PublicKey copying lib/Crypto/PublicKey/RSA.py -> build/lib.linux-x86_64-3.7/Crypto/PublicKey copying lib/Crypto/PublicKey/_RSA.py -> build/lib.linux-x86_64-3.7/Crypto/PublicKey copying lib/Crypto/PublicKey/pubkey.py -> build/lib.linux-x86_64-3.7/Crypto/PublicKey copying lib/Crypto/PublicKey/_DSA.py -> build/lib.linux-x86_64-3.7/Crypto/PublicKey copying lib/Crypto/PublicKey/DSA.py -> build/lib.linux-x86_64-3.7/Crypto/PublicKey copying lib/Crypto/PublicKey/init.py -> build/lib.linux-x86_64-3.7/Crypto/PublicKey copying lib/Crypto/PublicKey/ElGamal.py -> build/lib.linux-x86_64-3.7/Crypto/PublicKey creating build/lib.linux-x86_64-3.7/Crypto/Signature copying lib/Crypto/Signature/PKCS1_PSS.py -> build/lib.linux-x86_64-3.7/Crypto/Signature copying lib/Crypto/Signature/init__.py -> build/lib.linux-x86_64-3.7/Crypto/Signature copying lib/Crypto/Signature/PKCS1_v1_5.py -> build/lib.linux-x86_64-3.7/Crypto/Signature Skipping optional fixer: buffer Skipping optional fixer: idioms Skipping optional fixer: set_literal Skipping optional fixer: ws_comma warning: PCTBuildPy: byte-compiling is disabled, skipping.

running build_ext running build_configure checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for __gmpz_init in -lgmp... yes checking for __gmpz_init in -lmpir... no checking whether mpz_powm is declared... yes checking whether mpz_powm_sec is declared... yes checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for inttypes.h... (cached) yes checking limits.h usability... yes checking limits.h presence... yes checking for limits.h... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking for stdint.h... (cached) yes checking for stdlib.h... (cached) yes checking for string.h... (cached) yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking for inline... inline checking for int16_t... yes checking for int32_t... yes checking for int64_t... yes checking for int8_t... yes checking for size_t... yes checking for uint16_t... yes checking for uint32_t... yes checking for uint64_t... yes checking for uint8_t... yes checking for stdlib.h... (cached) yes checking for GNU libc compatible malloc... yes checking for memmove... yes checking for memset... yes configure: creating ./config.status config.status: creating src/config.h building 'Crypto.PublicKey._fastmath' extension creating build/temp.linux-x86_64-3.7 creating build/temp.linux-x86_64-3.7/src x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -fwrapv -Wall -fstack-protector-strong -Wformat -Werror=format-security -fw rapv -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/ -I/root/.local/share/virtualenvs/PoshC2-KGSTtxLR/include -I/usr/include/python3.7m -c src/_fastmath.c -o build/temp.linux-x8 6_64-3.7/src/_fastmath.o src/_fastmath.c:31:10: fatal error: Python.h: No such file or directory 31 | #include "Python.h" | ^~~~~~ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

ERROR: Failed building wheel for pycrypto Running setup.py clean for pycrypto Building wheel for psycopg2 (setup.py) ... error ERROR: Command errored out with exit status 1: command: /root/.local/share/virtualenvs/PoshC2-KGSTtxLR/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-in stall-w3rceo13/psycopg2/setup.py'"'"'; file='"'"'/tmp/pip-install-w3rceo13/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', ope n)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp /pip-wheel-o5hvhprk cwd: /tmp/pip-install-w3rceo13/psycopg2/ Complete output (42 lines): running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.7 creating build/lib.linux-x86_64-3.7/psycopg2 copying lib/pool.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/_json.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/tz.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/_range.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/errorcodes.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/sql.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/errors.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/init.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/compat.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/_lru_cache.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/extras.py -> build/lib.linux-x86_64-3.7/psycopg2 copying lib/extensions.py -> build/lib.linux-x86_64-3.7/psycopg2 warning: build_py: byte-compiling is disabled, skipping.

running build_ext building 'psycopg2._psycopg' extension creating build/temp.linux-x86_64-3.7 creating build/temp.linux-x86_64-3.7/psycopg 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 -DPSYCOPG_V ERSION=2.8.5 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120003 -DHAVE_LO64=1 -I/root/.local/share/virtualenvs/PoshC2-KGSTtxLR/include -I/usr/incl ude/python3.7m -I. -I/usr/include/postgresql -I/usr/include/postgresql/12/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.7/ps ycopg/psycopgmodule.o -Wdeclaration-after-statement In file included from psycopg/psycopgmodule.c:28: ./psycopg/psycopg.h:35:10: fatal error: Python.h: No such file or directory 35 | #include | ^~~~~~ compilation terminated.

It appears you are missing some prerequisite to build the package from source.

You may install a binary package by installing 'psycopg2-binary' from PyPI. If you want to install psycopg2 from source, please install the packages required for the build and try again.

For further information please check the 'doc/src/install.rst' file (also at https://www.psycopg.org/docs/install.html).

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

ERROR: Failed building wheel for psycopg2 Running setup.py clean for psycopg2 Failed to build pycrypto psycopg2 Installing collected packages: six, pycparser, cffi, cryptography, pyopenssl, numpy, python-dateutil, pytz, pandas, wcwidth, prompt-toolkit, pyyaml, attrs, more-itertools, zipp, importlib-metadata, pyparsing, packaging, pluggy, py, pytest, pycrypto, psycopg2 Running setup.py install for pycrypto ... error ERROR: Command errored out with exit status 1: command: /root/.local/share/virtualenvs/PoshC2-KGSTtxLR/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip- install-w3rceo13/pycrypto/setup.py'"'"'; file='"'"'/tmp/pip-install-w3rceo13/pycrypto/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', o pen)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-_sbrb0lj/install-record.txt --single-version-externally-managed --compile --install-headers /root/.local/share/virtualenvs/Po shC2-KGSTtxLR/include/site/python3.7/pycrypto cwd: /tmp/pip-install-w3rceo13/pycrypto/ Complete output (161 lines): running install running build running build_py creating build creating build/lib.linux-x86_64-3.7 creating build/lib.linux-x86_64-3.7/Crypto copying lib/Crypto/pct_warnings.py -> build/lib.linux-x86_64-3.7/Crypto copying lib/Crypto/init.py -> build/lib.linux-x86_64-3.7/Crypto creating build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/MD5.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/SHA256.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/HMAC.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/MD4.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/SHA512.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/MD2.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/SHA224.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/SHA384.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/RIPEMD.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/hashalgo.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/init.py -> build/lib.linux-x86_64-3.7/Crypto/Hash copying lib/Crypto/Hash/SHA.py -> build/lib.linux-x86_64-3.7/Crypto/Hash creating build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/CAST.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/ARC2.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/DES.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/blockalgo.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/Blowfish.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/ARC4.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/XOR.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/PKCS1_OAEP.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/init.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/PKCS1_v1_5.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/AES.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher copying lib/Crypto/Cipher/DES3.py -> build/lib.linux-x86_64-3.7/Crypto/Cipher creating build/lib.linux-x86_64-3.7/Crypto/Util copying lib/Crypto/Util/Counter.py -> build/lib.linux-x86_64-3.7/Crypto/Util copying lib/Crypto/Util/py3compat.py -> build/lib.linux-x86_64-3.7/Crypto/Util copying lib/Crypto/Util/RFC1751.py -> build/lib.linux-x86_64-3.7/Crypto/Util copying lib/Crypto/Util/_number_new.py -> build/lib.linux-x86_64-3.7/Crypto/Util copying lib/Crypto/Util/randpool.py -> build/lib.linux-x86_64-3.7/Crypto/Util copying lib/Crypto/Util/asn1.py -> build/lib.linux-x86_64-3.7/Crypto/Util copying lib/Crypto/Util/init.py -> build/lib.linux-x86_64-3.7/Crypto/Util copying lib/Crypto/Util/winrandom.py -> build/lib.linux-x86_64-3.7/Crypto/Util copying lib/Crypto/Util/number.py -> build/lib.linux-x86_64-3.7/Crypto/Util creating build/lib.linux-x86_64-3.7/Crypto/Random copying lib/Crypto/Random/_UserFriendlyRNG.py -> build/lib.linux-x86_64-3.7/Crypto/Random copying lib/Crypto/Random/random.py -> build/lib.linux-x86_64-3.7/Crypto/Random copying lib/Crypto/Random/init.py -> build/lib.linux-x86_64-3.7/Crypto/Random creating build/lib.linux-x86_64-3.7/Crypto/Random/Fortuna copying lib/Crypto/Random/Fortuna/FortunaGenerator.py -> build/lib.linux-x86_64-3.7/Crypto/Random/Fortuna copying lib/Crypto/Random/Fortuna/SHAd256.py -> build/lib.linux-x86_64-3.7/Crypto/Random/Fortuna copying lib/Crypto/Random/Fortuna/FortunaAccumulator.py -> build/lib.linux-x86_64-3.7/Crypto/Random/Fortuna copying lib/Crypto/Random/Fortuna/init.py -> build/lib.linux-x86_64-3.7/Crypto/Random/Fortuna creating build/lib.linux-x86_64-3.7/Crypto/Random/OSRNG copying lib/Crypto/Random/OSRNG/posix.py -> build/lib.linux-x86_64-3.7/Crypto/Random/OSRNG copying lib/Crypto/Random/OSRNG/fallback.py -> build/lib.linux-x86_64-3.7/Crypto/Random/OSRNG copying lib/Crypto/Random/OSRNG/init.py -> build/lib.linux-x86_64-3.7/Crypto/Random/OSRNG copying lib/Crypto/Random/OSRNG/rng_base.py -> build/lib.linux-x86_64-3.7/Crypto/Random/OSRNG creating build/lib.linux-x86_64-3.7/Crypto/SelfTest copying lib/Crypto/SelfTest/st_common.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest copying lib/Crypto/SelfTest/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest creating build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_ARC2.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_AES.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/common.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_ARC4.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_pkcs1_15.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_DES3.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_Blowfish.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_pkcs1_oaep.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_XOR.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_CAST.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_DES.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Cipher creating build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_MD4.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_SHA224.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_RIPEMD.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_SHA.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/common.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_HMAC.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_SHA512.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_SHA256.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_MD5.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_SHA384.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_MD2.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Hash creating build/lib.linux-x86_64-3.7/Crypto/SelfTest/Protocol copying lib/Crypto/SelfTest/Protocol/test_chaffing.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Protocol copying lib/Crypto/SelfTest/Protocol/test_rfc1751.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Protocol copying lib/Crypto/SelfTest/Protocol/test_KDF.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Protocol copying lib/Crypto/SelfTest/Protocol/test_AllOrNothing.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Protocol copying lib/Crypto/SelfTest/Protocol/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Protocol creating build/lib.linux-x86_64-3.7/Crypto/SelfTest/PublicKey copying lib/Crypto/SelfTest/PublicKey/test_ElGamal.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/PublicKey copying lib/Crypto/SelfTest/PublicKey/test_RSA.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/PublicKey copying lib/Crypto/SelfTest/PublicKey/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/PublicKey copying lib/Crypto/SelfTest/PublicKey/test_importKey.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/PublicKey copying lib/Crypto/SelfTest/PublicKey/test_DSA.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/PublicKey creating build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random copying lib/Crypto/SelfTest/Random/test_random.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random copying lib/Crypto/SelfTest/Random/test_rpoolcompat.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random copying lib/Crypto/SelfTest/Random/testUserFriendlyRNG.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random copying lib/Crypto/SelfTest/Random/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random creating build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/Fortuna copying lib/Crypto/SelfTest/Random/Fortuna/test_FortunaAccumulator.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/Fortuna copying lib/Crypto/SelfTest/Random/Fortuna/test_FortunaGenerator.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/Fortuna copying lib/Crypto/SelfTest/Random/Fortuna/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/Fortuna copying lib/Crypto/SelfTest/Random/Fortuna/test_SHAd256.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/Fortuna creating build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/OSRNG copying lib/Crypto/SelfTest/Random/OSRNG/test_posix.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/OSRNG copying lib/Crypto/SelfTest/Random/OSRNG/test_winrandom.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/OSRNG copying lib/Crypto/SelfTest/Random/OSRNG/test_fallback.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/OSRNG copying lib/Crypto/SelfTest/Random/OSRNG/test_generic.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/OSRNG copying lib/Crypto/SelfTest/Random/OSRNG/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/OSRNG copying lib/Crypto/SelfTest/Random/OSRNG/test_nt.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Random/OSRNG creating build/lib.linux-x86_64-3.7/Crypto/SelfTest/Util copying lib/Crypto/SelfTest/Util/test_number.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Util copying lib/Crypto/SelfTest/Util/test_winrandom.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Util copying lib/Crypto/SelfTest/Util/test_Counter.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Util copying lib/Crypto/SelfTest/Util/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Util copying lib/Crypto/SelfTest/Util/test_asn1.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Util creating build/lib.linux-x86_64-3.7/Crypto/SelfTest/Signature copying lib/Crypto/SelfTest/Signature/test_pkcs1_pss.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Signature copying lib/Crypto/SelfTest/Signature/test_pkcs1_15.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Signature copying lib/Crypto/SelfTest/Signature/init.py -> build/lib.linux-x86_64-3.7/Crypto/SelfTest/Signature creating build/lib.linux-x86_64-3.7/Crypto/Protocol copying lib/Crypto/Protocol/Chaffing.py -> build/lib.linux-x86_64-3.7/Crypto/Protocol copying lib/Crypto/Protocol/init.py -> build/lib.linux-x86_64-3.7/Crypto/Protocol copying lib/Crypto/Protocol/AllOrNothing.py -> build/lib.linux-x86_64-3.7/Crypto/Protocol copying lib/Crypto/Protocol/KDF.py -> build/lib.linux-x86_64-3.7/Crypto/Protocol creating build/lib.linux-x86_64-3.7/Crypto/PublicKey copying lib/Crypto/PublicKey/_slowmath.py -> build/lib.linux-x86_64-3.7/Crypto/PublicKey copying lib/Crypto/PublicKey/RSA.py -> build/lib.linux-x86_64-3.7/Crypto/PublicKey copying lib/Crypto/PublicKey/_RSA.py -> build/lib.linux-x86_64-3.7/Crypto/PublicKey copying lib/Crypto/PublicKey/pubkey.py -> build/lib.linux-x86_64-3.7/Crypto/PublicKey copying lib/Crypto/PublicKey/_DSA.py -> build/lib.linux-x86_64-3.7/Crypto/PublicKey copying lib/Crypto/PublicKey/DSA.py -> build/lib.linux-x86_64-3.7/Crypto/PublicKey copying lib/Crypto/PublicKey/init.py -> build/lib.linux-x86_64-3.7/Crypto/PublicKey copying lib/Crypto/PublicKey/ElGamal.py -> build/lib.linux-x86_64-3.7/Crypto/PublicKey creating build/lib.linux-x86_64-3.7/Crypto/Signature copying lib/Crypto/Signature/PKCS1_PSS.py -> build/lib.linux-x86_64-3.7/Crypto/Signature copying lib/Crypto/Signature/init__.py -> build/lib.linux-x86_64-3.7/Crypto/Signature copying lib/Crypto/Signature/PKCS1_v1_5.py -> build/lib.linux-x86_64-3.7/Crypto/Signature Skipping optional fixer: buffer Skipping optional fixer: idioms Skipping optional fixer: set_literal Skipping optional fixer: ws_comma warning: PCTBuildPy: byte-compiling is disabled, skipping.

running build_ext
running build_configure
building 'Crypto.PublicKey._fastmath' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/src
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -fwrapv -Wall -fstack-protector-strong -Wformat -Werror=format-security -                fwrapv -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -std=c99 -O3 -fomit-frame-pointer -Isr                c/ -I/usr/include/ -I/root/.local/share/virtualenvs/PoshC2-KGSTtxLR/include -I/usr/include/python3.7m -c src/_fastmath.c -o build/temp.linux-                x86_64-3.7/src/_fastmath.o
src/_fastmath.c:31:10: fatal error: Python.h: No such file or directory
   31 | #include "Python.h"
      |          ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------

ERROR: Command errored out with exit status 1: /root/.local/share/virtualenvs/PoshC2-KGSTtxLR/bin/python -u -c 'import sys, setuptools, token ize; sys.argv[0] = '"'"'/tmp/pip-install-w3rceo13/pycrypto/setup.py'"'"'; file='"'"'/tmp/pip-install-w3rceo13/pycrypto/setup.py'"'"';f=ge tattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '" '"'exec'"'"'))' install --record /tmp/pip-record-_sbrb0lj/install-record.txt --single-version-externally-managed --compile --install-headers /root/.local/share/virtualenvs/PoshC2-KGSTtxLR/include/site/python3.7/pycrypto Check the logs for full command output.

benpturner commented 4 years ago

Hey, just a quick one is this using WSL or a full install of Kali?

riskydissonance commented 4 years ago

In addition to Ben's question, it appears you're missing the Python.h header for some reason, can you confirm if sudo apt-get install python3-dev is installed/installs successfully?

riskydissonance commented 4 years ago

and/or sudo apt-get install python3.8-dev if you have multiple versions of python installed

VirtualAlllocEx commented 4 years ago

Hi,

I tried it always with an installed Kali (2019.4 and 2020.2) The strange thing is, that this error comes also on a fresh installed Version 2020.2

I tried 'sudo apt-get install python3-dev':

root@kali:~# sudo apt-get install python3-dev Reading package lists... Done Building dependency tree Reading state information... Done python3-dev is already the newest version (3.8.2-3). 0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.

And also 'sudo apt-get install python3.8-dev' but that does not change anything. Seems to be very strange, because a few weeks ago everything works fine? So I decided to install kali new for a few times, but yet it won' work? THX!

root@kali:~# sudo apt-get install python3.8-dev Reading package lists... Done Building dependency tree Reading state information... Done python3.8-dev is already the newest version (3.8.3~rc1-1). 0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.

vardanbansal commented 4 years ago

Hi,

When this issue will resolve ? I tried to configure today and i am very curious to work on Poshc2 server. But after updating my kali box and installing C2 i got the same issues.

Please commit the old one or resolve the issue as per your convenience.

riskydissonance commented 4 years ago

Hi, I'm not sure when the issue will be resolved, it's a bug so it's hard to say how long it will take to find.

You are welcome to look into it yourself however and we'll happily accept a pull request once you find it. Alternatively, in the mean time you can try using the Docker image (this is what I test on and it works) or checking out an older release yourself, as all releases are tagged.

vardanbansal commented 4 years ago

Sure buddy...

Thanks

NeoTheCapt commented 4 years ago

Fix this with

apt install libpython3.7-dev
VirtualAlllocEx commented 4 years ago

@usualwyy NOP still the same problem

benpturner commented 4 years ago

Just tested this against the latest version of a brand new Kali WSL image and it fails on python3.8. This is how you can get it working under python3.7 without any problems. There seems to be some issues with the latest version of python3.8.

Install Python3.7 and use this instead of Python3.8

sudo apt install python3.7 python3-pip python3.7-dev sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1 sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2

Update python3 to point to python3.7

sudo update-alternatives --config python3

Enter <1> or whichever is python3.7

Install pipenv for Python3.7 if not already installed

python3 -m pip install

Reinstall the PoshC2 requirements but it should no be using 3.7 not 3.8 pipenv

cd /opt/PoshC2/ pipenv --rm pipenv install --python=/usr/bin/python3.7 python3 -m pip install -r /opt/PoshC2/requirements.txt

Can you give this a go and let me know how you get on?

vardanbansal commented 4 years ago

Tested this against the latest version of a kali distros 2020.2

@benpturner, After running above commands.

Adding - if python3 -m pip install command not working. | curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py | python3 get-pip.py --force-reinstall | pip install pipenv

After this i got - Error with SharpSocks or old implant connection - is SharpSocks running /work/embedded/

benpturner commented 4 years ago

Ok, so you are up and running but maybe have an existing implant running in the background beaconing back to the same C2 Server. Is your instance up and running ok now. I would remove the whole project file and start again

vardanbansal commented 4 years ago

Screenshot_2020-05-24_09-36-26

yes, Instance up and running ok now..

working fine :)

Thanks @benpturner :)

benpturner commented 4 years ago

All good! We'll need to have a look why python3.8 isnt working properly but maybe use 3.7 in the interim. Thanks for checking it all works and glad we got it up and running

benpturner commented 4 years ago

@TKD-SEC can you confirm this also works for you

VirtualAlllocEx commented 4 years ago

@benpturner @vardanbansal: great work, thanks! With python 3.7 everything works fine as two weeks ago. I do the following steps:

After doing that steps the PoshC2 Frameworks works again fine and after executing a payload the C2 channel opens normal and there is not longer the "Decryption error"

Many thanks a PoschC2 Team for quick and great help!

image

riskydissonance commented 4 years ago

Looks good !