2

I'm trying to use secretsdump.py, which relies on winregistry.py.

The error I'm getting is:

Traceback (most recent call last):
  File "secretsdump.py", line 41, in <module>
    from impacket import version, smbconnection, winregistry, ntlm
ImportError: cannot import name winregistry

I've used sys.path to see where python loads files from and copied winregistry.py to some of these directories, which made no difference. I'm using Kali Linux, a Debian based distribution.

I've tried upgrading python, which had no effect.

What else could I try to solve this problem?

  • Did you install impacket? – cuonglm Jul 31 '14 at 15:45
  • @gnouc I installed python-all which I thought included impacket. – R Wilson Jul 31 '14 at 15:53
  • I don't think so. Try pip freeze then check impacket is installed. Otherwise, run sudo pip install impacket. – cuonglm Jul 31 '14 at 15:54
  • Well, I just installed it into a virtualenv right now from pip and python successfully loaded the winregistry module from impacket/winregistry.py file for me. In /home/me/Documents/temp I said: virtualenv ENV --system-site-packages, source ENV/bin/activate, pip install impacket and it works. – Boris Burkov Jul 31 '14 at 15:54
1

from impacket import version, smbconnection, winregistry, ntlm in this case means from the package impacket, import the modules version, smbconnection, winregistry and ntlm.

This means you need impacket, the package, not winregistry, a submodule of impacket, on the path. Try putting the whole package on the path somewhere, or just putting the impacket package right next to the secretsdumpy.py script.

impacket can be found here.

The python2 tutorial section on package imports here.

  • I've installed python-impacket on debian, it still doesn't find it. I checked out impacket via svn, renamed the directory from impacket-read-only to impacket in the same directory as secretsdump.py, it still can't find it. – R Wilson Jul 31 '14 at 16:10
  • I haven't used svn very much, but doesn't checkout get the whole repository tree, as seen here? You would need to copy the svn/trunk/impacket directory to the same directory as secretsdump.py. – Majaha Jul 31 '14 at 16:25
  • Also, have you tried just opening a python interpreter and running: import impacket and then from impacket import winregistry – Majaha Jul 31 '14 at 16:28
  • Another thing: Python has two major an mutually incompatible versions in use, python3 and python2. I think Debian's default python version is still python2, and a quick look at the code for impacket suggests it is also python2. You say you "upgraded to the latest python version", could you be using python3 when instead you should be using python2? – Majaha Jul 31 '14 at 16:41
  • After I realized the error from checking out via svn and moved to the directory alongside my script it worked fine, thank you! – R Wilson Jul 31 '14 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.