1

Running kali 2020, I am trying to run CVE-2007-2447 which is a python2.7 script, which says:

import smb

from smb.SMBConnection import SMBConnection

I saved the script to a file and ran it, but I get ImportError: No module named smb. In the script, it says install pysmb by running pip install --user pysmb. I did this, but still the same error message.

I tried to locate pysmb and found these packages:

$ locate pysmb            
/usr/lib/python3/dist-packages/pysmbc-1.0.23.egg-info
/usr/lib/python3/dist-packages/pysmbc-1.0.23.egg-info/PKG-INFO
/usr/lib/python3/dist-packages/pysmbc-1.0.23.egg-info/dependency_links.txt
/usr/lib/python3/dist-packages/pysmbc-1.0.23.egg-info/top_level.txt
/usr/share/system-config-printer/pysmb.py
/usr/share/system-config-printer/__pycache__/pysmb.cpython-39.pyc

I have had a problem before where packages only install for python3 and I have to copy the folders to python2.7. I tried that for this without success.

When I googled module smb, it comes up with samba. I installed the samba package but still nothing. Does anyone know how I can get smb module to python2.7?

Christian
  • 4,902
  • 4
  • 24
  • 42
Levi
  • 31
  • 1
  • 1
  • 5

4 Answers4

3

You need to install using the Python 2.7 pip. Use the following command:

pip2.7 install pysmb
DapperDuck
  • 2,728
  • 1
  • 9
  • 21
1

Pip no longer supports Python 2.

pip documentation v21.0.1

Mark Ransom
  • 299,747
  • 42
  • 398
  • 622
0

You need to use python 2 pip to install the module, instead of installing it for python 3. See How to use pip with Python 3.x alongside Python 2.x .

Christian
  • 4,902
  • 4
  • 24
  • 42
BobDotCom
  • 319
  • 1
  • 8
  • I tried to install pip2.7 as the link says and i get SyntaxError: invalid syntax I tried to paste the output but it put it all on one line when i hit enter...? – Levi Jan 31 '21 at 02:10
0

In my case, the problem was simple. I named the python script file 'smb.py'. 'smb.py' and'pysmb' were in conflict.