前言
为什么要写这个文章呢?
是因为在客户现场做渗透测试,对于一些中间件漏洞扫描脚本。我们需要下载拷贝进客户的内网中,来进行扫描操作,一般来说下载的漏洞扫描脚本是不可以直接进行使用的。因为大佬们写的脚本大部分都用到了第三方的python模块来编写。
所以我们还需要下载第三方的模块拷贝进内网安装后才能使用。
具体的第三方模块安装过程这里就不演示了。
使用python36进行本地requests安装的时候,可以安装成功,但是去使用这个模块时候就会报错
一开始以为,报错原因需要安装什么证书,其实真是只是需要一个python的证书库,(⊙﹏⊙)
requests模块的依赖包检查
在可以上网且已安装python的机器上检查requests模块需要哪些依赖包,要是没有依赖包,直接下载一个直接安装最好。
在CMD命令窗口中输入 pip show requestsC:\Users\Laycher>pip show requests
Name: requests
Version: 2.18.4
Summary: Python HTTP for Humans.
Home-page: http://python-requests.org
Author: Kenneth Reitz
Author-email: me@kennethreitz.org
License: Apache 2.0
Location: d:\program files\python3\lib\site-packages
Requires: chardet, urllib3, idna, certifi
Required-by:
发现需要chardet,urllib3,idna,certifi
下载依赖包模块和requests模块certifi-2019.9.11-py2.py3-none-any.whl
chardet-3.0.4-py2.py3-none-any.whl
idna-2.8-py2.py3-none-any.whl
requests-2.22.0-py2.py3-none-any.whl
urllib3-1.25.6-py2.py3-none-any.whl
安装模块
将以上下载的文件传到测试环境。离线装模块。
安装命令为 pip install XXXXX.whl
切记,先安装依赖包,如果直接安装requests,由于有依赖包,还是会去连外网找依赖包。D:\软件>pip install certifi-2019.9.11-py2.py3-none-any.whl
Processing d:\软件\certifi-2019.9.11-py2.py3-none-any.whl
Installing collected packages: certifi
Successfully installed certifi-2019.9.11
D:\软件>pip install chardet-3.0.4-py2.py3-none-any.whl
Processing d:\软件\chardet-3.0.4-py2.py3-none-any.whl
Installing collected packages: chardet
Successfully installed chardet-3.0.4
D:\软件>pip install idna-2.8-py2.py3-none-any.whl
Processing d:\软件\idna-2.8-py2.py3-none-any.whl
Installing collected packages: idna
Successfully installed idna-2.8
D:\软件>pip install urllib3-1.25.6-py2.py3-none-any.whl
Processing d:\软件\urllib3-1.25.6-py2.py3-none-any.whl
Installing collected packages: urllib3
Successfully installed urllib3-1.25.6
D:\软件>pip install requests-2.22.0-py2.py3-none-any.whl
Processing d:\软件\requests-2.22.0-py2.py3-none-any.whl
Requirement already satisfied: idna in c:\users\administrator\appdata\local\prog
rams\python\python37\lib\site-packages (from requests==2.22.0) (2.8)
Requirement already satisfied: chardet in c:\users\administrator\appdata\local\p
rograms\python\python37\lib\site-packages (from requests==2.22.0) (3.0.4)
Requirement already satisfied: urllib3 in c:\users\administrator\appdata\local\p
rograms\python\python37\lib\site-packages (from requests==2.22.0) (1.25.6)
Requirement already satisfied: certifi in c:\users\administrator\appdata\local\p
rograms\python\python37\lib\site-packages (from requests==2.22.0) (2019.9.11)
Installing collected packages: requests
Successfully installed requests-2.22.0
安装包汇集
我汇集了我这边的安装包,安装包
其他办法
网上还有很多其他办法,比如在干净的能上外网的机器上,安装python,然后pip install 安装需要的模块,然后直接把python安装目录直接拷到离线环境中,那就直接可以用了。
还有的是通过命令 pip freeze > requiresment.txt ,生成已经安装的模块信息,然后再下载。具体可以搜索看看。
总结
以上所述是我踩过的坑和填坑的过程。