异常现象
apkSingRelease]# python ./apkNLS.py -i zhouxj.apk -o zhouxj-endsore.apk
Traceback (most recent call last):
File "./apkNLS.py", line 12, in <module>
from Crypto.Hash import SHA256
ImportError: No module named Crypto.Hash
修复步骤
# 1.安装丢失的Crypto包
apkSingRelease]# pip install pyCrypto
-bash: /usr/bin/pip: /usr/local/bin/python: bad interpreter: No such file or directory
# 2.pip报错python的路径不对, 所以修改pip指定的python路径
vi /usr/bin/pip
# 修改python路径到真实python路径 #!/usr/local/bin/python -> #!/usr/bin/python
# 3.继续安装丢失的Crypto包, 但没有pkg_resources模块
apkSingRelease]# pip install pyCrypto
Traceback (most recent call last):
File "/usr/bin/pip", line 6, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
# 4.报错没有pkg_resources包, 所以安装python对应的包
apkSingRelease]# yum install gcc python-setuptools python-devel
# 5.继续安装丢失的Crypto包, 但没有Distribution
apkSingRelease]# pip install pyCrypto
Traceback (most recent call last):
File "/usr/bin/pip", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 3007, in <module>
working_set.require(__requires__)
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 728, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 626, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==9.0.1
# 6.下载Distribution并安装
~]# wget https://files.pythonhosted.org/packages/5f/ad/1fde06877a8d7d5c9b60eff7de2d452f639916ae1d48f0b8f97bf97e570a/distribute-0.7.3.zip
~]# cd distribute-0.7.3 && python setup.py install
...
Finished processing dependencies for distribute==0.7.3
# 7.重新安装pip
distribute-0.7.3]# easy_install pip==9.0.1
...
Finished processing dependencies for pip==9.0.1
# 8.继续安装丢失的Crypto包, 终于成功
distribute-0.7.3]# pip install pyCrypto
Installing collected packages: pyCrypto
Running setup.py install for pyCrypto ... done
Successfully installed pyCrypto-2.6.1
apkSingRelease]# python ./apkNLS.py -i zhouxj_noSign.apk -o zhouxj-endsore.apk
start process. input:zhouxj_noSign.apk output:zhouxj-endsore.apk
sha256:0.139378070831
writeSINGINFO:0.0103378295898
writeZip:0.0118269920349
success