skelsec / minidump

Python library to parse and read Microsoft minidump file format
MIT License
271 stars 55 forks source link

fix: module import error in createminidump.py #25

Closed yasaidev closed 2 years ago

yasaidev commented 3 years ago

@skelsec

Problem

createminidump.py have a ModuleNotFoundError.

This problem is caused by the missing privilege module path resolve in createminidump.py.

C:\>python 
Python 3.8.12 (default, Oct 12 2021, 03:01:40) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from minidump.utils import createminidump
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\my_program\test\.venv\lib\site-packages\minidump\utils\createminidump.py", line 12, in <module>
    from privileges import enable_debug_privilege
ModuleNotFoundError: No module named 'privileges'

Fix

I just change from privileges import enable_debug_privilege to from minidump.utils.privileges import enable_debug_privilege.

After doing this, shell output is below and now fixed.

C:\>python
Python 3.8.12 (default, Oct 12 2021, 03:01:40) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from minidump.utils import createminidump
>>> createminidump.create_dump(5584,"spotify.dump",createminidump.MINIDUMP_TYPE.MiniDumpNormal)
WARNING:root:process architecture mismatch! This could case error! Python arch: x64 Target process arch: x86
>>> createminidump.create_dump(10104,"vscode.dump",createminidump.MINIDUMP_TYPE.MiniDumpNormal)  
>>> createminidump.create_dump(4308,"firefox.dump",createminidump.MINIDUMP_TYPE.MiniDumpNormal) 
skelsec commented 2 years ago

Hello, thank you for the PR. Good thing you spotted it because I rarely use it.