from:http://blog.csdn.net/cheng_tian/article/details/7652058
Recently looking at the Python grey Hat: The path of Python programming for hackers and reverse engineers, the fourth chapter does not explain the installation of pydbg, which makes it impossible for me to run the code in the book. So I spent a lot of time to solve pydbg in the Python2.7 environment installation problem, and posted here hope to help others.
(This article by Wei Wang Original, Welcome to visit my blog: Http://blog.csdn.net/cheng_tian)
1. Download pydbg: Please go to https://github.com/OpenRCE/pydbg, this page has a "ZIP" button, click to download the compressed package.
2. After decompression, rename the resulting folder to pydbg and place it in the Lib directory under the Python installation directory.
3. The aforementioned directory lib/pydbg/under the Pydasm.pyd file and Python2.7 do not match, you need to replace it, otherwise use pydbg will error "Importerror:no module named Pydasm." There are articles on the Internet that describe how to compile and install pydasm, I try to do the result unfortunately failed, unable to compile through. Simply download a compiled good (http://d.download.csdn.net/download/zhuangyan2004/3774476) and replace the original pydasm.pyd.
4. The code in this book will be able to run smoothly.
Note: If you are developing under Win7, make sure that your Python IDE has administrator privileges, otherwise the code on the running book will report an error. For example, I use Eclipse's plug-in pydev for development, and I need administrator privileges to start eclipse if I want to run the code in the book smoothly.
Installation of pydbg in Python2.7 environment