fortra / impacket

Impacket is a collection of Python classes for working with network protocols.
https://www.coresecurity.com
Other
13.37k stars 3.56k forks source link

Error for me [Check it] #111

Closed its0x08 closed 8 years ago

its0x08 commented 8 years ago

Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/gevent/greenlet.py", line 327, in run result = self._run(_self.args, *_self.kwargs) File "/home/its_0x08/Desktop/exploits/CrackMapExec/core/maingreenlet.py", line 34, in connect smb = SMBConnection(host, host, None, settings.args.port) File "/usr/local/lib/python2.7/dist-packages/impacket/smbconnection.py", line 61, in init self.negotiateSession(preferredDialect) File "/usr/local/lib/python2.7/dist-packages/impacket/smbconnection.py", line 81, in negotiateSession self._SMBConnection = smb3.SMB3(self._remoteName, self._remoteHost, self._myName, hostType, self._sess_port, self._timeout, session = self._nmbSession ) File "/usr/local/lib/python2.7/dist-packages/impacket/smb3.py", line 231, in init self.negotiateSession(preferredDialect) File "/usr/local/lib/python2.7/dist-packages/impacket/smb3.py", line 434, in negotiateSession if ans.isValidAnswer(STATUS_SUCCESS): File "/usr/local/lib/python2.7/dist-packages/impacket/smb3structs.py", line 430, in isValidAnswer raise smb3.SessionError(self['Status'], self) SessionError: SMB SessionError: STATUS_INVALID_HANDLE(An invalid HANDLE was specified.) <Greenlet at 0xb529011cL: connect('192.168.193.171')> failed with SessionError

asolino commented 8 years ago

I need a traffic capture to try to reproduce this issue.

its0x08 commented 8 years ago

Traceback (most recent call last): File "crackmapexec.py", line 11, in from core.maingreenlet import connect File "/home/its_0x08/Desktop/exploits/CrackMapExec/core/maingreenlet.py", line 4, in from impacket.smbconnection import SMBConnection, SessionError ImportError: cannot import name SessionError

asolino commented 8 years ago

Looks like you are using an outdated impacket version. Inside Python interpreter do:

from impacket import version
print version.BANNER

You should have the following version at least:

Impacket v0.9.14-dev - Copyright 2002-2015 Core Security Technologies
its0x08 commented 8 years ago

no im using the last one ;) look ⚡ root@backbox  /home/its_0x08/Desktop/exploits/CrackMapExec   master  python crackmapexec.py
Traceback (most recent call last): File "crackmapexec.py", line 11, in from core.maingreenlet import connect File "/home/its_0x08/Desktop/exploits/CrackMapExec/core/maingreenlet.py", line 4, in from impacket.smbconnection import SMBConnection, SessionError ImportError: cannot import name SessionError ✘ ⚡ root@backbox  /home/its_0x08/Desktop/exploits/CrackMapExec   master  pip install --upgrade -r requirements.txt Collecting git+git://github.com/CoreSecurity/impacket (from -r requirements.txt (line 1)) Cloning git://github.com/CoreSecurity/impacket to /tmp/pip-q8XsDD-build Requirement already up-to-date: gevent in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 2)) Requirement already up-to-date: netaddr in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 3)) Requirement already up-to-date: pycrypto in /usr/lib/python2.7/dist-packages (from -r requirements.txt (line 4)) Requirement already up-to-date: pyasn1 in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 5)) Requirement already up-to-date: termcolor in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 6)) Requirement already up-to-date: colorama in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 7)) Requirement already up-to-date: greenlet>=0.4.7 in /usr/local/lib/python2.7/dist-packages (from gevent->-r requirements.txt (line 2)) Installing collected packages: impacket Found existing installation: impacket 0.9.14.dev0 Uninstalling impacket-0.9.14.dev0: Successfully uninstalled impacket-0.9.14.dev0 Running setup.py install for impacket Successfully installed impacket-0.9.14.dev0 ⚡ root@backbox  /home/its_0x08/Desktop/exploits/CrackMapExec   master  python crackmapexec.py
Traceback (most recent call last): File "crackmapexec.py", line 11, in from core.maingreenlet import connect File "/home/its_0x08/Desktop/exploits/CrackMapExec/core/maingreenlet.py", line 4, in from impacket.smbconnection import SMBConnection, SessionError ImportError: cannot import name SessionError ✘ ⚡ root@backbox  /home/its0x08/Desktop/exploits/CrackMapExec   master  i think its some problem with my cisco bcz some kidz --' were playing with the router .. maybe som certificate problem or smth im not sure !

asolino commented 8 years ago

I don't know you pip works or where does it store the downloaded copy.

Please run your Python interpreter and inside it type:

from impacket import version
print version.BANNER

and send me the output.

its0x08 commented 8 years ago

✘ ⚡ root@backbox  ~its_0x08/Desktop/exploits/CrackMapExec   master  python
Python 2.7.6 (default, Jun 22 2015, 18:00:18) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information.

from impacket import version print version.BANNER Impacket v0.9.10 - Copyright 2002-2013 Core Security Technologies

asolino commented 8 years ago

There you go...

There's something wrong with your PYTHONPATH. Most probably there are two copies of impacket installed, 0.9.10 and 0.9.14-dev. But the PYTHONPATH is finding the old one first.

What you can do now is removing impacket-0.9.10. If you want to do it manually, from your Python prompt type:

from impacket import version
print version.__file__

That will tell you where the version.py (or pyc) is located. Since that's the old version, go to that directory and remove everything (including the directory). That would clean your system from the 0.9.10 version.

its0x08 commented 8 years ago

from impacket import version print version.file /usr/lib/python2.7/dist-packages/impacket/version.pyc thank you :)

asolino commented 8 years ago

rm -rf /usr/lib/python2.7/dist-packages/impacket and give it a try again

its0x08 commented 8 years ago

now is ok thank you again :')

asolino commented 8 years ago

no problem!