python—kali linux anzhuang pexpect
1.downlaod pexpect
root@kali:/usr/share/scrapy# cd ..
root@kali:/usr/share# git clone https://github.com/pexpect/pexpect.git
Cloning into 'pexpect'...
remote: Counting objects: 6377, done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 6377 (delta 4), reused 6 (delta 1), pack-reused 6361
Receiving objects: 100% (6377/6377), 8.31 MiB | 315.00 KiB/s, done.
Resolving deltas: 100% (3975/3975), done.
Checking connectivity... done.
root@kali:/usr/share# cd pexpect/
root@kali:/usr/share/pexpect# ls
DEVELOPERS.rst doc examples LICENSE MANIFEST.in notes pexpect README.rst requirements-testing.txt setup.cfg setup.py tests tools
root@kali:/usr/share/pexpect# python setup.py install
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
running install
................................
................................
..................................
running install_egg_info
Writing /usr/local/lib/python2.7/dist-packages/pexpect-4.3.1.egg-info
root@kali:/usr/share/pexpect#
2.downlao pty
root@kali:/usr/share/pexpect# cd ..
root@kali:/usr/share# tar -zxvf ptyprocess-0.5.2.tar.gz
ptyprocess-0.5.2/.gitignore
ptyprocess-0.5.2/.travis.yml
ptyprocess-0.5.2/LICENSE
ptyprocess-0.5.2/README.rst
ptyprocess-0.5.2/docs/Makefile
ptyprocess-0.5.2/docs/api.rst
ptyprocess-0.5.2/docs/conf.py
ptyprocess-0.5.2/docs/images/pty_vs_popen.png
ptyprocess-0.5.2/docs/images/pty_vs_popen.svg
ptyprocess-0.5.2/docs/index.rst
ptyprocess-0.5.2/flit.ini
ptyprocess-0.5.2/ptyprocess/__init__.py
ptyprocess-0.5.2/ptyprocess/_fork_pty.py
ptyprocess-0.5.2/ptyprocess/ptyprocess.py
ptyprocess-0.5.2/ptyprocess/util.py
ptyprocess-0.5.2/readthedocs.yml
ptyprocess-0.5.2/tests/__init__.py
ptyprocess-0.5.2/tests/test_echo.py
ptyprocess-0.5.2/tests/test_invalid_binary.py
ptyprocess-0.5.2/tests/test_preexec_fn.py
ptyprocess-0.5.2/tests/test_spawn.py
ptyprocess-0.5.2/tests/test_wait.py
ptyprocess-0.5.2/setup.py
ptyprocess-0.5.2/PKG-INFO
root@kali:/usr/share# cd ptyprocess-0.5.2/
root@kali:/usr/share/ptyprocess-0.5.2# ls
docs flit.ini LICENSE PKG-INFO ptyprocess README.rst readthedocs.yml setup.py tests
root@kali:/usr/share/ptyprocess-0.5.2# python setup.py install
running install
running build
running build_py
creating build
creating build/lib.linux-i686-2.7
creating build/lib.linux-i686-2.7/ptyprocess
copying ptyprocess/util.py -> build/lib.linux-i686-2.7/ptyprocess
copying ptyprocess/ptyprocess.py -> build/lib.linux-i686-2.7/ptyprocess
copying ptyprocess/_fork_pty.py -> build/lib.linux-i686-2.7/ptyprocess
copying ptyprocess/__init__.py -> build/lib.linux-i686-2.7/ptyprocess
running install_lib
creating /usr/local/lib/python2.7/dist-packages/ptyprocess
copying build/lib.linux-i686-2.7/ptyprocess/util.py -> /usr/local/lib/python2.7/dist-packages/ptyprocess
copying build/lib.linux-i686-2.7/ptyprocess/ptyprocess.py -> /usr/local/lib/python2.7/dist-packages/ptyprocess
copying build/lib.linux-i686-2.7/ptyprocess/_fork_pty.py -> /usr/local/lib/python2.7/dist-packages/ptyprocess
copying build/lib.linux-i686-2.7/ptyprocess/__init__.py -> /usr/local/lib/python2.7/dist-packages/ptyprocess
byte-compiling /usr/local/lib/python2.7/dist-packages/ptyprocess/util.py to util.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/ptyprocess/ptyprocess.py to ptyprocess.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/ptyprocess/_fork_pty.py to _fork_pty.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/ptyprocess/__init__.py to __init__.pyc
running install_egg_info
Writing /usr/local/lib/python2.7/dist-packages/ptyprocess-0.5.2.egg-info
root@kali:/usr/share/ptyprocess-0.5.2# cd ..
3.download setuptools
root@kali:/usr/share# cd pexpect/
root@kali:/usr/share/pexpect# python setup.py install
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
running install
running build
running build_py
running install_lib
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/_async.py to _async.pyc
File "/usr/local/lib/python2.7/dist-packages/pexpect/_async.py", line 18
transport, pw = yield from asyncio.get_event_loop()\
^
SyntaxError: invalid syntax
running install_egg_info
Removing /usr/local/lib/python2.7/dist-packages/pexpect-4.3.1.egg-info
Writing /usr/local/lib/python2.7/dist-packages/pexpect-4.3.1.egg-info
root@kali:/usr/share/pexpect# sudo apt-get install python-setuptools
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-setuptools is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 2130 not upgraded.
root@kali:/usr/share/pexpect# sudo apt-get install setuptools
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package setuptools
root@kali:/usr/share/pexpect# cd ..
more Error!!!
root@kali:/usr/share/pexpect# cd ..
root@kali:/usr/share# git clone https://github.com/pypa/setuptools.git
Cloning into 'setuptools'...
remote: Counting objects: 37255, done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 37255 (delta 12), reused 22 (delta 9), pack-reused 37225
Receiving objects: 100% (37255/37255), 33.05 MiB | 293.00 KiB/s, done.
Resolving deltas: 100% (18388/18388), done.
Checking connectivity... done.
root@kali:/usr/share# cd setuptools/
root@kali:/usr/share/setuptools# ls
appveyor.yml CHANGES.rst docs launcher.c MANIFEST.in pavement.py pytest.ini setup.cfg setuptools tox.ini
bootstrap.py conftest.py easy_install.py LICENSE msvc-build-launcher.cmd pkg_resources README.rst setup.py tests
root@kali:/usr/share/setuptools# python setup.py install
Traceback (most recent call last):
File "setup.py", line 186, in <module>
require_metadata()
File "setup.py", line 24, in require_metadata
raise RuntimeError(msg)
RuntimeError: Cannot build setuptools without metadata. Run `bootstrap.py`.
root@kali:/usr/share/setuptools# python bootstrap.py
adding minimal entry_points
Regenerating egg_info
...................................
.....................................
.................................
writing manifest file 'setuptools.egg-info/SOURCES.txt'
root@kali:/usr/share/setuptools# python easy_install.py setuptools
Processing setuptools
error: Couldn't find a setup script in /usr/share/setuptools/setuptools
root@kali:/usr/share/setuptools# python easy_install.py setup*
Processing setup.cfg
error: Not a recognized archive type: setup.cfg
root@kali:/usr/share/setuptools# ls
appveyor.yml CHANGES.rst docs launcher.c MANIFEST.in pavement.py pytest.ini setup.cfg setuptools tests
bootstrap.py conftest.py easy_install.py LICENSE msvc-build-launcher.cmd pkg_resources README.rst setup.py setuptools.egg-info tox.ini
root@kali:/usr/share/setuptools# python easy_install.py pexpect
Searching for pexpect
Best match: pexpect 4.3.1
Adding pexpect 4.3.1 to easy-install.pth file
Using /usr/local/lib/python2.7/dist-packages
Processing dependencies for pexpect
Finished processing dependencies for pexpect
root@kali:/usr/share/setuptools# python
Python 2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pexpect
>>> import pxssh
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>> exit()
root@kali:/usr/share/setuptools#
OK!!!