'Python2.7 no smb module. Cant locate
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?
Solution 1:[1]
You need to install using the Python 2.7 pip. Use the following command:
pip2.7 install pysmb
Solution 2:[2]
Solution 3:[3]
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 .
Solution 4:[4]
In my case, the problem was simple. I named the python script file 'smb.py'. 'smb.py' and'pysmb' were in conflict.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | DapperDuck |
Solution 2 | Mark Ransom |
Solution 3 | Christian |
Solution 4 | Tate Suke |