-
Notifications
You must be signed in to change notification settings - Fork 137
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
Python 3 compatibility fixes #20
Conversation
manage groups on regex
fix support winXP
@AlessandroZ If you have a patch I can apply I can make it part of the PR (.. or if you have commit access you can push it directly to my branch). |
Should be ok like that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't state if this is a complete fix for py3, but all the changes here look good and relative to python 3 changes.
*Edit:
So I ran the code from matslindh/memorpy and I get an error when running the given example. Probably a bit more byte coding needed somewhere:
(env3) XX\memorpy>python
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import memorpy
>>> from memorpy import *
>>> mw = MemWorker(pid=11644)
>>> l=[x for x in mw.umem_search("cheese")]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 1, in <listcomp>
File "XX\memorpy\memorpy\MemWorker.py", line 68, in umem_search
for _, i in self.mem_search(str(regex), ftype='re'):
File "XX\memorpy\memorpy\MemWorker.py", line 221, in mem_search
for res in func(b, value, offset):
File "XX\memorpy\memorpy\MemWorker.py", line 94, in parse_re_function
for res in regex.finditer(b):
TypeError: cannot use a string pattern on a bytes-like object
>>>
Python 2.7 works as expected:
$>python
Python 2.7.11rc1 (v2.7.11rc1:82dd9545bd93, Nov 21 2015, 23:25:27) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import memorpy
>>> from memorpy import *
>>> mw = MemWorker(pid=11644)
>>> l=[x for x in mw.umem_search("cheese")]
>>> l
[<Addr: 0x0027CCFE>]
>>>
@AlessandroZ It'd be great if you could submit a patch with your discoveries; I don't have the time right now to hunt down each line based on your descriptions. If you're already modifying the code, clone the PR and include the patch here and I'll add it to the PR (if you don't have maintainer access - in that case you can push directly to my branch). |
I did the change @AlessandroZ suggested from matslindh/memorpy, then I have the following error :
Can someone point me out to a fully functional Python 3 repo ? |
|
Ok I actually got it running. Thanks btw. But then I have another issue. When I write this code :
The following error is returned :
|
any updates/fixes? |
I'm guessing you're gonna have to get it further yourself; I currently have no interest in pursuing it further as our use case is currently inactive. |
bummer, this would have been a great tool for analyzing malware |
My comment was in relation to this specific PR - the library itself might be moving forward (although it seems rather abandoned based on when it was last updated). |
This set of patches makes the basic functionality of memorpy work under python 3 on Windows. I've not tested it with python 2 - so there probably needs to be a few extra try/catch-es or a dependency on six.
As the platform I had this need on is Windows, I haven't tested the Linux (or other OS-es) compatibility either.
Consider this a starting PR that can be updated with other patches to make memorpy both 2 and 3 compliant.