exported / paimei

Automatically exported from code.google.com/p/paimei
GNU General Public License v2.0
1 stars 0 forks source link

pyDbg compatibility issue #3

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit 
(Intel)] on win32
>>> import pydbg;
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "L:\projects\Project.Paimei\pydbg\__init__.py", line 41, in <module>
    from defines                 import *
  File "L:\projects\Project.Paimei\pydbg\defines.py", line 36, in <module>
    from my_ctypes import *
  File "pydbg\my_ctypes.py", line 80, in <module>
    typ.__reduce__ = _reduce
TypeError: can't set attributes of built-in/extension 
type '_ctypes.Structure'

Original issue reported on code.google.com by Support....@gmail.com on 8 Jan 2009 at 7:15

GoogleCodeExporter commented 9 years ago
Confirmed both on 2.6.1 (shown in the reported issue) and 2.5.4:

Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pydbg
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pydbg\__init__.py", line 41, in <module>
    from defines                 import *
  File "pydbg\defines.py", line 36, in <module>
    from my_ctypes import *
  File "pydbg\my_ctypes.py", line 80, in <module>
    typ.__reduce__ = _reduce
TypeError: can't set attributes of built-in/extension type '_ctypes.Structure'

Original comment by jlw...@gmail.com on 13 Jan 2009 at 7:36

GoogleCodeExporter commented 9 years ago
Hi.

It seems the project a bit dead.
I have resolved the issue by patching ctypes/__init__.py with
from _ctypes import ..., Structure as _ctypesStructure
class Structure (_ctypesStructure):
    pass

Don't know if it was right. I hope it is the same as empty public inheritance.
It allowed me start the project and made few tests. Don't expect miracles. :)

Original comment by Support....@gmail.com on 13 Jan 2009 at 8:02

GoogleCodeExporter commented 9 years ago
Hi All,

I agree, seems a bit dead. Anyway, as part of submitting my last changes I 
cloned the
SVN into a git repo (yes, i know git isn't really useable on windoze yet), but 
at
least it allowed to give back some changes to the community, without loosing 
all history.

http://gitorious.org/projects/paimei

perhaps we should commit there or, alternatively try to get some more 
maintainers at
google code to get the patches back in.

Original comment by netwerkf...@gmail.com on 12 Feb 2009 at 3:37

GoogleCodeExporter commented 9 years ago
Works just fine for me with 2.5 after installing ctypes via setuptools

Original comment by fuk...@gmail.com on 29 Mar 2009 at 12:06

GoogleCodeExporter commented 9 years ago
What version of ctypes did you install via setuptools? Python 2.5.4 comes with 
ctypes
1.0.3.

Original comment by john.as...@gmail.com on 2 Jun 2009 at 2:58

GoogleCodeExporter commented 9 years ago
Adding the following in pydbg\my_ctypes.py above "c_type = (Structure ..." 
seems to 
work for me and avoids modifying ctypes when, really, pydbg is doing something 
wrong.

class Structure(Structure):
    pass

Original comment by cronos...@gmail.com on 16 Jul 2009 at 1:25

GoogleCodeExporter commented 9 years ago
i tried to modify as suggest above but none of those working for me :(
i think it's time to fix this thing

Original comment by cla.guar...@gmail.com on 22 Oct 2009 at 9:13

GoogleCodeExporter commented 9 years ago
Just change that line to
c_types = (Structure2, c_char, c_byte, c_ubyte, c_short, c_ushort, c_int, 
c_uint,
c_long, c_ulong, c_longlong, \
           c_ulonglong, c_float, c_double, c_char_p, c_wchar_p, c_void_p)
and then create a class named Structure2 above it:
class Structure2(Structure):
    pass

No need to change ctypes

Original comment by mehdideveloper on 23 Nov 2009 at 12:31

GoogleCodeExporter commented 9 years ago
That's the same idea as my comment #6, only I also avoid changing c_types.

Original comment by cronos...@gmail.com on 23 Nov 2009 at 7:00

GoogleCodeExporter commented 9 years ago
this is very helpful patch. thanks guys

Original comment by electron...@gmail.com on 14 Dec 2009 at 2:23

GoogleCodeExporter commented 9 years ago
Declare the 
Class Structure:
  pass

Works to me, thanks guys.

Original comment by m1z...@gmail.com on 24 Jan 2010 at 8:18

GoogleCodeExporter commented 9 years ago
hello guys .. 

i have some different problem .. i try to install paimei on win7+python25 .. 

when i run __install_requirements .. then i got pydbg and utils not found .. so 
i recompile the pydasm with python25 .. then when i do 

>>> import pydbg
>>> import utils

Traceback (most recent call last):
  File "<pyshell#8>", line 1, in <module>
    import utils
  File "C:\Python25\Lib\site-packages\utils\__init__.py", line 11, in <module>
    from process_stalker import *
  File "C:\Python25\Lib\site-packages\utils\process_stalker.py", line 32, in <module>
    from pydbg import *
AttributeError: 'module' object has no attribute 'defines'
>>> 

can any body help me out what problem with utils ???  

Original comment by amit.agg...@gmail.com on 6 Jul 2010 at 5:43

GoogleCodeExporter commented 9 years ago
Hi...

Anybody working on porting pydbg to python 3? . This might resolve most of the 
issues.

Original comment by hnchan...@gmail.com on 30 Jul 2010 at 1:53

GoogleCodeExporter commented 9 years ago
amit.aggarwal85: I suggest you file a separate bug report and give more detail 
on what the problem is. 
hnchandan: What makes you say Python 3 could resolve "most issues"? Which 
issues are you referring to?

Original comment by cronos...@gmail.com on 30 Jul 2010 at 3:16

GoogleCodeExporter commented 9 years ago
If anyone comes across the same issue as amit, the solution lies in the 
pydasm.pyd file.

If you made it all the way to get the paimai installer to run and it installed 
pydbg in the appropriate directory under c:\python25\Lib\site-packages\pydbg 
then go into that directory and open up pydasm.pyd in a hex editor. Do a search 
for python26.dll. When you find it, replace the 26 with 25 if you are running 
python 2.5. That's what's causing the "import pydbg" to fail and thus why the 
__install_requirements script says it can't find pydbg. 

After you make that change and save it, PaiMei console will run and everything 
will work. Why someone compiled that for python 2.6 I don't know since the IDA 
Python that I use only runs under python 2.5 and generating pida files is 
required for PaiMei. 

Aside from this issue and the __build_installer file generating the wrong 
filename and placing it in the wrong directory for the __install_requirements 
script, it's not that hard to get this to run under python 2.5.

Original comment by Chrisf...@gmail.com on 1 Aug 2010 at 6:00

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Good installation and configuration guide for PaiMei on Python 2.5: 
http://www.0xlogic.com/?p=8

Original comment by Chrisf...@gmail.com on 3 Aug 2010 at 12:57

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I googled and fixed certain problems like changing buildinstaller.bat
After which i ran the mysql setup script. I get the following error.I have 
mysql 5.5 installed.

[code]E:\REVERSE ENGINEERING 
TOOLS\paimei\PaiMei-1.1-REV122\PaiMei-1.1-REV122>__setup_
mysql.py
Traceback (most recent call last):
  File "E:\REVERSE ENGINEERING TOOLS\paimei\PaiMei-1.1-REV122\PaiMei-1.1-REV122\
__setup_mysql.py", line 3, in <module>
    import MySQLdb
ImportError: No module named MySQLdb[\code]

please help

Original comment by soumya.m...@gmail.com on 26 Feb 2011 at 7:56

GoogleCodeExporter commented 9 years ago
Same error occured:
TypeError: can't set attributes of built-in/extension type '_ctypes.Structure'

Python 2.7, Windows 7 and PaiMei 1.1 REV 122

Described howto doesn't work. Any ideas?

BTW: More than need to have more patchers is preferable to do a actualized 
documentation and howtos. I suggest to use some wiki platform for this purpose.

Original comment by miroslav...@gmail.com on 7 Jul 2013 at 9:18