$ pip install impacket
Requirement already satisfied: impacket in /home/kali/.local/lib/python3.9/site-packages (0.9.16.dev0)
$ sudo python2 -m pip install impacket
/usr/bin/python2: No module named pip
我找到了这个:
$ curl https://bootstrap.pypa.io/get-pip.py -o pip2.py
$ sudo python2 pip2.py install impacket
Collecting install
Using cached install-1.3.0.tar.gz (1.8 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-JsNXwt/install/setup.py'"'"'; __file__='"'"'/tmp/pip-install-JsNXwt/install/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-zr9fqs
cwd: /tmp/pip-install-JsNXwt/install/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'egg_info'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
答案1
Python2 已弃用,以下是根据 Kali 文档在 Kali Linux Rolling Release 上正确安装 python2 的方法:在 Kali 上使用 EoL Python 版本
Debian 存储库中不再维护 Python 2。这意味着我们必须找到解决这个问题的方法。 pyenv 通过允许我们安装多个互不冲突的 Python 版本来解决这个问题。
pyenv 是安装 python2 的方法:
sudo apt install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python3-openssl git
curl https://pyenv.run |bash
export PYENV_ROOT="$HOME/.pyenv
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init -)" ; fi
exec $SHELL
pyenv
pyenv install 2.7.18
pyenv global 2.7.18
python2 -m pip install impacket
然后运行python2并检查impack版本:
python2
>>> from impacket import version
>>> version.BANNER
示例输出:
'Impacket v0.9.18 - Copyright 2018 SecureAuth Corporation\n'
答案2
我想出来了 $curlhttps://bootstrap.pypa.io/get-pip.py-o 获取 pip.py
$ python get-pip.py
现在 pip2 可以工作并安装到 python2 目录中
我一定是在这之前搞砸了一些事情。不管怎样,现在我们可以安装 python2 的模块了