Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update python.md #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions python.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,56 @@

PyCharm是python最好的集成开发工具,目前有专业版和社区版可供选择。

### 安装pwntools
先更新 homebrew !!官方的巨慢无比

```
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
```
安装

执行brew install pwntools等待一会就安装完成,会自动解决依赖关系。安装完后会在/usr/local/Cellar/(可能不一样)目录下生成pwntools文件夹,其中python的包在:


/usr/local/Cellar/pwntools/3.6.1/libexec/lib/python2.7/site-packages

/usr/local/Cellar/pwntools/3.6.1/libexec/lib/python2.7/site-packages

然后需要把路径添加到python的sys.path中,这里使用的方法是在默认包目录下创建文件mypkpath.pth然后把目录写进去:


$ cd /Library/Python/2.7/site-packages
$ sudo vim mypkpath.pth
$ cat mypkpath.pth
/usr/local/Cellar/pwntools/3.6.1/libexec/lib/python2.7/site-packages

$ cd /Library/Python/2.7/site-packages
$ sudo vim mypkpath.pth
$ cat mypkpath.pth
/usr/local/Cellar/pwntools/3.6.1/libexec/lib/python2.7/site-packages

测试

不报错就可以知道安装成功:


$ python
Python 2.7.10 (default, Feb 7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pwn import *
>>> print disasm('b817000000'.decode('hex'), arch = 'amd64')
0: b8 17 00 00 00 mov eax,0x17



$ python
Python 2.7.10 (default, Feb 7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pwn import *
>>> print disasm('b817000000'.decode('hex'), arch = 'amd64')
0: b8 17 00 00 00 mov eax,0x17