Python3报错Crypto失败(from Crypto.Cipher import AES ModuleNotFoundError: No module named 'Crypto')

使用Python3,运行ShiroScan项目时;

python3 shiro_rce.py
Traceback (most recent call last):
  File "shiro_rce.py", line 5, in <module>
    from moule.main import scripts
  File "/root/ShiroScan-master/moule/__init__.py", line 4, in <module>
    from .plugins import *
  File "/root/ShiroScan-master/moule/plugins/CommonsBeanutils1.py", line 10, in <module>
    from Crypto.Cipher import AES
ModuleNotFoundError: No module named 'Crypto'

报错Crypto没有,那就安装吧,

这里需要注意;安装顺序,之前安装的可能会出错;

先删除:

sudo pip uninstall crypto
sudo pip uninstall pycrypto

重新安装:

sudo pip install pycrypto

使用方式:

from Crypto.Cipher import AES

安装pycrypto的时候报错:

 驱动错误:

creating build/temp.linux-x86_64-3.6/src
gcc -pthread -Wno-unused-result -Wsign-compare -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/ -I/usr/include/python3.6m -c src/_fastmath.c -o build/temp.linux-x86_64-3.6/src/_fastmath.o
src/_fastmath.c:31:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1

----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ali3wo3r/pycrypto/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-rc07oh_g-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-ali3wo3r/pycrypto/

解决方案:

安装python-dev(我的是centos7系统,Python3.6),但是这里需要注意版本问题,Python2可以直接安装python-devel,但是Python3 就需要安装python3-devel

yum search python3-devel

安装成功:

猜你喜欢

转载自www.cnblogs.com/Risk2S/p/12361304.html