330 words
2 minutes
MacOS M系列芯片安装pwntools
前言
使用ARM64架构的M芯片无法直接使用pwntools,故在此记录如何简单配置后即可使用。
参考配置
M2 MacBookAir 16G内存1T硬盘
macOS Sonoma — 14.61
python — 3.12
前期准备
1、安装Homebrew
Homebrew是一款强大的包管理工具,对于mac的兼容性非常好,大多数软件都建议大家直接使用brew来管理。
网上很多安装教程,这里不在赘述。官方网站:https://brew.sh/
2、使用brew安装python3
➜ ~ brew install python3
3、查看python 第三方模块安装路径
➜ ~ python3
Python 3.12.4 (main, Jun 6 2024, 18:26:44) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import site
>>> site.getsitepackages()
['/opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages']
4、使用brew安装pwntools
➜ ~ brew install pwntools
这个时候的pwntools是不可以直接使用的,依然找不到pwn库
➜ ~ python3
Python 3.12.4 (main, Jun 6 2024, 18:26:44) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pwn import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pwn'
>>>
5、为python添加托展目录(.pth)
➜ ~ cd /opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages
➜ site-packages git:(stable) vim mypath.pth
➜ site-packages git:(stable) cat mypath.pth
/opt/homebrew/Cellar/pwntools/4.12.0_4/libexec/lib/python3.12/site-packages
➜ site-packages git:(stable) python3
Python 3.12.4 (main, Jun 6 2024, 18:26:44) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pwn import *
>>>
这样就安装成功了,因为使用了brew,后续管理也比较方便。
参考链接:
https://dandelioncloud.cn/article/details/1576089301408772098
MacOS M系列芯片安装pwntools
https://25pm-sumio.github.io/posts/2024/08/18/01/