Pydbg作為一個純Python庫,為Windows環境下從事逆向工程的童鞋們,提供不少便利的同時,也帶來了安裝方面的一些問題。
下面step by step地記錄一下自己在Win7+python27環境中安裝pydbg庫的過程。(以下過程適用於win7(64-bit)和win7(32-bit) )
在安裝Pydbg前,首先需要安裝Pydasm第三庫,Google pydasm download下載對應版本,對下載后文檔解壓后,進行如下操作:
1、cd 到解壓后的Pydasm文件夾下
2、Running “setup.py build_ext”
3、Running ”setup.py install”
4、在命令行窗口中運行Python(當然這需要在安裝python時進行配置)
5、輸入:import pydasm
無報錯,安裝成功(如圖所示)
其次,Pydbg的安裝,關於下載無需多說,到PaiMei的官網上下載對應版本即可。
對下載文檔解壓后進行同上類似操作:
1、 cd到解壓后的Pydbg文件夾下
2、 running ”setup.py build_ext”
3、 running “setup.py install”
4、 命令窗口中啟動python
5、輸入import pydbg
出現報錯:TypeError: can't set attributes of built-in/extension type '_ctypes.Structure'(這是pdbg庫中的一個py文件報錯,貌似是個小bug)
此時根據報錯提示,找到pydbg\my_ctypes.py中的出錯位置,修改相關出錯py文件,在c_types=(…)前class聲明如下所示:
6、再次import pydbg,出現報錯:Import Error: DLL load failed 無法找到指定模塊。
此時找到:python安裝路徑\Lib\site-packages\pydbg\pydasm.pyd文件刪掉
7、啟動python,輸入import pydbg。無報錯,安裝成功