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

安裝成功:

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM