ubuntu中安装pwntools

安装pip3
sudo apt-get install python3-pip
查看pip3的版本
acat@acat-xx:~$ pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)
对pip3的版本进行更新.
acat@acat-xx:~$ pip3 install --upgrade pip
Collecting pip
  Downloading http://pypi.doubanio.com/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 2.7MB/s 
Installing collected packages: pip
Successfully installed pip-20.0.2
acat@acat-xx:~$ pip3 --version
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
pip 20.0.2 from /home/acat/.local/lib/python3.6/site-packages/pip (python 3.6)

根据提示,以后使用pip3的时候使用-m pip,即python3 -m pip…

查看pip list

这里使用-m参数.而不是直接使用pip3 list命令.

acat@acat-xx:~$ python3 -m pip list
Package               Version            
--------------------- -------------------
apturl                0.5.2              
asn1crypto            0.24.0             
Brlapi                0.6.6              
certifi               2018.1.18          
chardet               3.0.4              
command-not-found     0.3                
cryptography          2.1.4              
cupshelpers           1.0                
defer                 1.0.6              
distro-info           0.18ubuntu0.18.04.1
httplib2              0.9.2              
idna                  2.6                
keyring               10.6.0             
keyrings.alt          3.0                
language-selector     0.1                
launchpadlib          1.10.6             
lazr.restfulclient    0.13.5             
lazr.uri              1.0.3              
louis                 3.5.0              
macaroonbakery        1.1.3              
Mako                  1.0.7              
MarkupSafe            1.0                
netifaces             0.10.4             
oauth                 1.0.1              
olefile               0.45.1             
pexpect               4.2.1              
Pillow                5.1.0              
pip                   20.0.2             
protobuf              3.0.0              
pycairo               1.16.2             
pycrypto              2.6.1              
pycups                1.9.73             
pygobject             3.26.1             
pymacaroons           0.13.0             
PyNaCl                1.1.2              
pyRFC3339             1.0                
python-apt            1.6.5+ubuntu0.2    
python-dateutil       2.6.1              
python-debian         0.1.32             
pytz                  2018.3             
pyxdg                 0.25               
PyYAML                3.12               
reportlab             3.4.0              
requests              2.18.4             
requests-unixsocket   0.1.5              
SecretStorage         2.3.1              
setuptools            39.0.1             
simplejson            3.13.2             
six                   1.11.0             
system-service        0.3                
systemd-python        234                
ubuntu-drivers-common 0.0.0              
ufw                   0.36               
unattended-upgrades   0.1                
urllib3               1.22               
usb-creator           0.3.3              
wadllib               1.3.2              
wheel                 0.30.0             
xkit                  0.0.0              
zope.interface        4.3.2              

如果直接使用pip3 list命令,会有警告

acat@acat-xx:~$ pip3 list
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Package               Version            
--------------------- -------------------
apturl                0.5.2              
asn1crypto            0.24.0             
Brlapi                0.6.6              
certifi               2018.1.18          
chardet               3.0.4              
command-not-found     0.3                
cryptography          2.1.4              
cupshelpers           1.0                
defer                 1.0.6              
distro-info           0.18ubuntu0.18.04.1
httplib2              0.9.2              
idna                  2.6                
keyring               10.6.0             
keyrings.alt          3.0                
language-selector     0.1                
launchpadlib          1.10.6             
lazr.restfulclient    0.13.5             
lazr.uri              1.0.3              
louis                 3.5.0              
macaroonbakery        1.1.3              
Mako                  1.0.7              
MarkupSafe            1.0                
netifaces             0.10.4             
oauth                 1.0.1              
olefile               0.45.1             
pexpect               4.2.1              
Pillow                5.1.0              
pip                   20.0.2             
protobuf              3.0.0              
pycairo               1.16.2             
pycrypto              2.6.1              
pycups                1.9.73             
pygobject             3.26.1             
pymacaroons           0.13.0             
PyNaCl                1.1.2              
pyRFC3339             1.0                
python-apt            1.6.5+ubuntu0.2    
python-dateutil       2.6.1              
python-debian         0.1.32             
pytz                  2018.3             
pyxdg                 0.25               
PyYAML                3.12               
reportlab             3.4.0              
requests              2.18.4             
requests-unixsocket   0.1.5              
SecretStorage         2.3.1              
setuptools            39.0.1             
simplejson            3.13.2             
six                   1.11.0             
system-service        0.3                
systemd-python        234                
ubuntu-drivers-common 0.0.0              
ufw                   0.36               
unattended-upgrades   0.1                
urllib3               1.22               
usb-creator           0.3.3              
wadllib               1.3.2              
wheel                 0.30.0             
xkit                  0.0.0              
zope.interface        4.3.2   
安装pwntools
acat@acat-xx:~$ sudo python3 -m pip install pwntools
WARNING: The directory '/home/acat/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Looking in indexes: http://pypi.douban.com/simple
Collecting pwntools
  Downloading http://pypi.doubanio.com/packages/92/79/263f8bd232b52b76223b5e375f71c64fe25ffaaf3ddbfd05fa167e787acb/pwntools-4.0.1-py2.py3-none-any.whl (9.9 MB)
     |████████████████████████████████| 9.9 MB 369 kB/s 
Collecting packaging
  Downloading http://pypi.doubanio.com/packages/98/42/87c585dd3b113c775e65fd6b8d9d0a43abe1819c471d7af702d4e01e9b20/packaging-20.1-py2.py3-none-any.whl (36 kB)
Requirement already satisfied: python-dateutil in /usr/lib/python3/dist-packages (from pwntools) (2.6.1)
Collecting psutil>=3.3.0
  Downloading http://pypi.doubanio.com/packages/73/93/4f8213fbe66fc20cb904f35e6e04e20b47b85bee39845cc66a0bcf5ccdcb/psutil-5.6.7.tar.gz (448 kB)
     |████████████████████████████████| 448 kB 1.5 MB/s 
Collecting pyserial>=2.7
  Downloading http://pypi.doubanio.com/packages/0d/e4/2a744dd9e3be04a0c0907414e2a01a7c88bb3915cbe3c8cc06e209f59c30/pyserial-3.4-py2.py3-none-any.whl (193 kB)
     |████████████████████████████████| 193 kB 5.6 MB/s 
Requirement already satisfied: mako>=1.0.0 in /usr/lib/python3/dist-packages (from pwntools) (1.0.7)
Collecting capstone>=3.0.5rc2
  Downloading http://pypi.doubanio.com/packages/35/0c/74db5b9b9ed25d72869832865b7612658bd796cd02c26b1d567cbc9f0ab6/capstone-4.0.1-py2.py3-none-manylinux1_x86_64.whl (1.9 MB)
     |████████████████████████████████| 1.9 MB 621 kB/s 
Requirement already satisfied: requests>=2.0 in /usr/lib/python3/dist-packages (from pwntools) (2.18.4)
Collecting tox>=1.8.1
  Downloading http://pypi.doubanio.com/packages/77/a7/a5b721d9bf955edfe36013e5ecc9136fc6b2fef622ab1797ff0560273d8e/tox-3.14.3-py2.py3-none-any.whl (80 kB)
     |████████████████████████████████| 80 kB 1.4 MB/s 
Collecting pysocks
  Downloading http://pypi.doubanio.com/packages/8d/59/b4572118e098ac8e46e399a1dd0f2d85403ce8bbaad9ec79373ed6badaf9/PySocks-1.7.1-py3-none-any.whl (16 kB)
Collecting unicorn>=1.0.2rc1
  Downloading http://pypi.doubanio.com/packages/40/ca/316207963eb550a890ca48d717c2c1c3e2e5cadcdc812d6102c4f5bcf8f3/unicorn-1.0.2rc1-py2.py3-none-manylinux1_x86_64.whl (8.1 MB)
     |████████████████████████████████| 8.1 MB 400 kB/s 
Requirement already satisfied: pip>=6.0.8 in ./.local/lib/python3.6/site-packages (from pwntools) (20.0.2)
Collecting pygments>=2.0
  Downloading http://pypi.doubanio.com/packages/be/39/32da3184734730c0e4d3fa3b2b5872104668ad6dc1b5a73d8e477e5fe967/Pygments-2.5.2-py2.py3-none-any.whl (896 kB)
     |████████████████████████████████| 896 kB 284 kB/s 
Collecting sortedcontainers
  Downloading http://pypi.doubanio.com/packages/13/f3/cf85f7c3a2dbd1a515d51e1f1676d971abe41bba6f4ab5443240d9a78e5b/sortedcontainers-2.1.0-py2.py3-none-any.whl (28 kB)
Collecting pyelftools>=0.2.4
  Downloading http://pypi.doubanio.com/packages/bb/2f/bf41f3c3867d6707fa9b872658bb23088a64d0e522e8979f54c694b8cbe1/pyelftools-0.26-py2.py3-none-any.whl (136 kB)
     |████████████████████████████████| 136 kB 601 kB/s 
Collecting intervaltree>=3.0
  Downloading http://pypi.doubanio.com/packages/e8/f9/76237755b2020cd74549e98667210b2dd54d3fb17c6f4a62631e61d31225/intervaltree-3.0.2.tar.gz (30 kB)
Collecting ropgadget>=5.3
  Downloading http://pypi.doubanio.com/packages/42/f4/51a2c608bc9821641d77490c6e9119698bddb40ed9ab9793f7c1ab726f87/ROPGadget-6.0.tar.gz (20 kB)
Collecting paramiko>=1.15.2
  Downloading http://pypi.doubanio.com/packages/06/1e/1e08baaaf6c3d3df1459fd85f0e7d2d6aa916f33958f151ee1ecc9800971/paramiko-2.7.1-py2.py3-none-any.whl (206 kB)
     |████████████████████████████████| 206 kB 691 kB/s 
Collecting pyparsing>=2.0.2
  Downloading http://pypi.doubanio.com/packages/5d/bc/1e58593167fade7b544bfe9502a26dc860940a79ab306e651e7f13be68c2/pyparsing-2.4.6-py2.py3-none-any.whl (67 kB)
     |████████████████████████████████| 67 kB 483 kB/s 
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from packaging->pwntools) (1.11.0)
Collecting py<2,>=1.4.17
  Downloading http://pypi.doubanio.com/packages/99/8d/21e1767c009211a62a8e3067280bfce76e89c9f876180308515942304d2d/py-1.8.1-py2.py3-none-any.whl (83 kB)
     |████████████████████████████████| 83 kB 735 kB/s 
Collecting toml>=0.9.4
  Downloading http://pypi.doubanio.com/packages/a2/12/ced7105d2de62fa7c8fb5fce92cc4ce66b57c95fb875e9318dba7f8c5db0/toml-0.10.0-py2.py3-none-any.whl (25 kB)
Collecting filelock<4,>=3.0.0
  Downloading http://pypi.doubanio.com/packages/93/83/71a2ee6158bb9f39a90c0dea1637f81d5eef866e188e1971a1b1ab01a35a/filelock-3.0.12-py3-none-any.whl (7.6 kB)
Collecting pluggy<1,>=0.12.0
  Downloading http://pypi.doubanio.com/packages/a0/28/85c7aa31b80d150b772fbe4a229487bc6644da9ccb7e427dd8cc60cb8a62/pluggy-0.13.1-py2.py3-none-any.whl (18 kB)
Collecting virtualenv>=16.0.0
  Downloading http://pypi.doubanio.com/packages/05/f1/2e07e8ca50e047b9cc9ad56cf4291f4e041fa73207d000a095fe478abf84/virtualenv-16.7.9-py2.py3-none-any.whl (3.4 MB)
     |████████████████████████████████| 3.4 MB 530 kB/s 
Collecting importlib-metadata<2,>=0.12; python_version < "3.8"
  Downloading http://pypi.doubanio.com/packages/8b/03/a00d504808808912751e64ccf414be53c29cad620e3de2421135fcae3025/importlib_metadata-1.5.0-py2.py3-none-any.whl (30 kB)
Collecting bcrypt>=3.1.3
  Downloading http://pypi.doubanio.com/packages/8b/1d/82826443777dd4a624e38a08957b975e75df859b381ae302cfd7a30783ed/bcrypt-3.1.7-cp34-abi3-manylinux1_x86_64.whl (56 kB)
     |████████████████████████████████| 56 kB 814 kB/s 
Collecting cryptography>=2.5
  Downloading http://pypi.doubanio.com/packages/ca/9a/7cece52c46546e214e10811b36b2da52ce1ea7fa203203a629b8dfadad53/cryptography-2.8-cp34-abi3-manylinux2010_x86_64.whl (2.3 MB)
     |████████████████████████████████| 2.3 MB 464 kB/s 
Requirement already satisfied: pynacl>=1.0.1 in /usr/lib/python3/dist-packages (from paramiko>=1.15.2->pwntools) (1.1.2)
Collecting zipp>=0.5
  Downloading http://pypi.doubanio.com/packages/46/42/f2dd964b2a6b1921b08d661138148c1bcd3f038462a44019416f2342b618/zipp-2.2.0-py36-none-any.whl (4.6 kB)
Collecting cffi>=1.1
  Downloading http://pypi.doubanio.com/packages/f1/c7/72abda280893609e1ddfff90f8064568bd8bcb2c1770a9d5bb5edb2d1fea/cffi-1.14.0-cp36-cp36m-manylinux1_x86_64.whl (399 kB)
     |████████████████████████████████| 399 kB 675 kB/s 
Collecting pycparser
  Downloading http://pypi.doubanio.com/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz (158 kB)
     |████████████████████████████████| 158 kB 1.6 MB/s 
Building wheels for collected packages: psutil, intervaltree, ropgadget, pycparser
  Building wheel for psutil (setup.py) ... done
  Created wheel for psutil: filename=psutil-5.6.7-cp36-cp36m-linux_x86_64.whl size=281510 sha256=605e22c4c0282e1a87347b3a51f70eabe1d21c19927d0667589c07d7b3204dcb
  Stored in directory: /tmp/pip-ephem-wheel-cache-uw8n10xd/wheels/f9/23/aa/b40def6c76d7a234742c979b2469d05eea6ba5093ba665a6b5
  Building wheel for intervaltree (setup.py) ... done
  Created wheel for intervaltree: filename=intervaltree-3.0.2-py3-none-any.whl size=26113 sha256=0ef01f468b947a6e200e384f7a7ea926ca3429c04a42fd690a72288a801e0d0c
  Stored in directory: /tmp/pip-ephem-wheel-cache-uw8n10xd/wheels/9f/bd/1b/912d7bdd2718f349bda0153da37af6da4ca0d245a435e0483f
  Building wheel for ropgadget (setup.py) ... done
  Created wheel for ropgadget: filename=ROPGadget-6.0-py3-none-any.whl size=29424 sha256=e6fce81916b65774905821e15383172691a3b94a133e3c365dd2849f2f0df312
  Stored in directory: /tmp/pip-ephem-wheel-cache-uw8n10xd/wheels/eb/81/53/d170a5b83fb9beaa50c25ef42626d5a82854ce0b340a2c2513
  Building wheel for pycparser (setup.py) ... done
  Created wheel for pycparser: filename=pycparser-2.19-py2.py3-none-any.whl size=112040 sha256=bf565b8c9a587b2a8c2d9c7174067ea56929aa5681c92a30a445354d91711f30
  Stored in directory: /tmp/pip-ephem-wheel-cache-uw8n10xd/wheels/83/3b/be/37ab06f71ba85d8fc944ade18e1782ce4dfe42380ef6c1cab5
Successfully built psutil intervaltree ropgadget pycparser
Installing collected packages: pyparsing, packaging, psutil, pyserial, capstone, py, toml, filelock, zipp, importlib-metadata, pluggy, virtualenv, tox, pysocks, unicorn, pygments, sortedcontainers, pyelftools, intervaltree, ropgadget, pycparser, cffi, bcrypt, cryptography, paramiko, pwntools
  Attempting uninstall: cryptography
    Found existing installation: cryptography 2.1.4
    Uninstalling cryptography-2.1.4:
      Successfully uninstalled cryptography-2.1.4
Successfully installed bcrypt-3.1.7 capstone-4.0.1 cffi-1.14.0 cryptography-2.8 filelock-3.0.12 importlib-metadata-1.5.0 intervaltree-3.0.2 packaging-20.1 paramiko-2.7.1 pluggy-0.13.1 psutil-5.6.7 pwntools-4.0.1 py-1.8.1 pycparser-2.19 pyelftools-0.26 pygments-2.5.2 pyparsing-2.4.6 pyserial-3.4 pysocks-1.7.1 ropgadget-6.0 sortedcontainers-2.1.0 toml-0.10.0 tox-3.14.3 unicorn-1.0.2rc1 virtualenv-16.7.9 zipp-2.2.0

这里出现了警告:WARNING: The directory ‘/home/acat/.cache/pip’ or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Looking in indexes: http://pypi.douban.com/simple

解决警告The directory ‘/home/acat/.cache/pip’ or its parent directory is not owned or is not writable by the current user
sudo chown -R root /home/acat/.cache/pip
在pycharm中使用pwntools

py文件内容:

from pwn import *
print('hello world')

如果直接右键run进行运行,那么会报错:

/usr/bin/python3.6 /home/acat/PycharmProjects/lotto/lott.py
Traceback (most recent call last):
  File "/home/acat/PycharmProjects/lotto/lott.py", line 1, in <module>
    from pwn import *
  File "/usr/local/lib/python3.6/dist-packages/pwn/__init__.py", line 4, in <module>
    from pwn.toplevel import *
  File "/usr/local/lib/python3.6/dist-packages/pwn/toplevel.py", line 20, in <module>
    import pwnlib
  File "/usr/local/lib/python3.6/dist-packages/pwnlib/__init__.py", line 43, in <module>
    importlib.import_module('.%s' % module, 'pwnlib')
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/local/lib/python3.6/dist-packages/pwnlib/args.py", line 62, in <module>
    from pwnlib import term
  File "/usr/local/lib/python3.6/dist-packages/pwnlib/term/__init__.py", line 6, in <module>
    from pwnlib.term import completer
  File "/usr/local/lib/python3.6/dist-packages/pwnlib/term/completer.py", line 7, in <module>
    from pwnlib.term import readline
  File "/usr/local/lib/python3.6/dist-packages/pwnlib/term/readline.py", line 13, in <module>
    from pwnlib.term import text
  File "/usr/local/lib/python3.6/dist-packages/pwnlib/term/text.py", line 126, in <module>
    sys.modules[__name__] = Module()
  File "/usr/local/lib/python3.6/dist-packages/pwnlib/term/text.py", line 49, in __init__
    s = termcap.get(y)
  File "/usr/local/lib/python3.6/dist-packages/pwnlib/term/termcap.py", line 27, in get
    s = curses.tigetstr(cap)
_curses.error: must call (at least) setupterm() first

Process finished with exit code 1

此时,可以以另一种方式运行,即右键项目文件夹—>Open in Terminal
在这里插入图片描述
此时运行则不会报错:
在这里插入图片描述

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
### 回答1: 要在Ubuntu 20.04上安装pwntools,可以按照以下步骤进行操作: 1. 打开终端并更新软件包列表: sudo apt update 2. 安装pip工具: sudo apt install python3-pip 3. 安装pwntools: sudo pip3 install pwntools 4. 验证pwntools是否安装成功: python3 -c "import pwn; print(pwn.__version__)" 如果成功安装,将会输出pwntools的版本号。 希望这些步骤能够帮助你在Ubuntu 20.04上安装pwntools。 ### 回答2: Pwntools是一个自动化漏洞利用框架,可以帮助安全研究人员优化或扩展漏洞利用过程。在Ubuntu 20.04上安装Pwntools非常简单,您可以按照以下步骤进行: 第一步,安装pip: Pwntools是通过pip进行安装的,因此需要先安装pip。您可以通过运行以下命令来完成安装: ``` sudo apt install python3-pip ``` 第二步,安装libc-bin和binutils: 这些程序包是Pwntools所需的一些依赖项。您可以通过运行以下命令来安装它们: ``` sudo apt-get install libc-bin binutils ``` 第三步,安装Pwntools: 一旦您安装了pip和一些必要的依赖项,就可以在命令行上运行以下命令安装Pwntools: ``` pip3 install pwntools ``` 完成上述步骤后,您已成功安装Pwntools!您可以运行一个示例程序来验证Pwntools是否正常工作。例如,您可以使用以下命令运行Pwntools: ``` python3 -c 'from pwn import *; print("Success!")' ``` 如果输出看起来像以下内容,则证明Pwntools已正常安装: Success! 在安装完成之后,您可以利用Pwntools来编写并运行各种漏洞利用脚本。这些脚本可以用于测试漏洞及其修补程序,以确保您的软件或网络系统更加安全及可靠。 ### 回答3: 要在Ubuntu 20.04上安装pwntools,可以按照以下步骤进行。 1. 首先,使用命令行终端打开Ubuntu 20.04操作系统。可以通过按下Ctrl+Alt+T键打开终端。 2. 在终端,输入以下命令以更新系统的软件包列表。输入完毕后,按下回车键: ``` sudo apt-get update ``` 3. 接下来,输入以下命令以安装需要的软件包和工具。 ``` sudo apt-get install python2.7 python-pip python-dev git libssl-dev libffi-dev build-essential ``` 4. 安装完所需的软件包和工具后,可以使用以下命令安装pwntools。 ``` sudo pip install pwntools ``` 5. 如果您只想安装特定版本的pwntools,则可以使用以下命令来安装所需的版本。 ``` sudo pip install pwntools==3.13.0 ``` 6. 最后,验证pwntools是否已正确安装。您可以在终端输入以下命令: ``` python -c "import pwn" ``` 如果安装正确,则不会显示任何错误消息。否则,将出现有关任何错误的错误消息。 总之,如果您想在Ubuntu 20.04上使用pwntools,只需按照上述步骤进行安装即可。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值