No module named six" error when scanning ESX

This forum supports the ESX Host Health Monitor plugin. When posting post screenshots of issues and any script and command logs listed in the probe consoles.
Post Reply
User avatar
Cubert
Posts: 1483
Joined: Tue Dec 29, 2015 7:57 pm
Contact:

No module named six" error when scanning ESX

Post by Cubert »

File Server Resource Manager may be causing your issues if you have it engaged.

python-error.png
python-error.png (15 KiB) Viewed 9111 times

The file path has the word “crypto” in it. When using File Server Resource Manager to actively block files with certain patterns from being written to the server. Tried disabling the File Server Resource Manager service and tried again – no dice. After some digging around and experimentation I thought maybe the file screen (the thing that does the blocking) was still in force even though the service was not running so I deleted the file screen and hey presto, no more error. I then tried polling the VMware host and I got information back!




Ransomware Protection Using FSRM and PowerShell
https://blog.netwrix.com/2016/04/11/ran ... owershell/

User avatar
dpltadmin
Posts: 9
Joined: Fri Jun 09, 2017 12:07 am

Re: No module named six" error when scanning ESX

Post by dpltadmin »

I am getting the "No module named six" error on a Server 2019 box without FSRM installed.

Code: Select all

PROBE -> [ Traceback (most recent call last):
  File "C:\Python27\check_esxi_hardware.py", line 249, in <module>
    import pywbem
  File "C:\Python27\lib\site-packages\pywbem-0.10.0-py2.7.egg\pywbem\__init__.py", line 34, in <module>
    from .cim_types import *  # noqa: F403,F401
  File "C:\Python27\lib\site-packages\pywbem-0.10.0-py2.7.egg\pywbem\cim_types.py", line 76, in <module>
    import six
ImportError: No module named six ]
Any Idea's or anything I can do to help troubleshoot? Thanks!

User avatar
Cubert
Posts: 1483
Joined: Tue Dec 29, 2015 7:57 pm
Contact:

Re: No module named six" error when scanning ESX

Post by Cubert »

Looks like you have a similar issue to whats posted here

viewtopic.php?f=31&t=5307&sid=289888897 ... cf43371f54

Basically when Python is installed it fails to install the common modules it to its library. In some cases this was a PATH issue and in other cases it was permissions when installed. What I would do first is remove the c:\python27 directory and then tell plugin to rescan probe. This will force a reinstall of python during scan and may correct some issues strait away. You also have the option of moving probe to another system to see if that systems responds differently.

User avatar
dpltadmin
Posts: 9
Joined: Fri Jun 09, 2017 12:07 am

Re: No module named six" error when scanning ESX

Post by dpltadmin »

I finally came back around to this and wanted to post an update for anyone else who might also be having this issue. Disclaimer: I do not know much about python.
No Module Named Six error on Servers where File Server Resource Manager (FSRM) is NOT Installed

I followed the steps at the link you provided above

Download get-pip.py to c:\python27
https://bootstrap.pypa.io/get-pip.py

Execute

Code: Select all

C:\Python27>python.exe get-pip.py
Result

Code: Select all

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting pip
  Using cached pip-20.0.2-py2.py3-none-any.whl (1.4 MB)
Collecting wheel
  Using cached wheel-0.34.2-py2.py3-none-any.whl (26 kB)
Installing collected packages: pip, wheel
  Attempting uninstall: pip
    Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
  WARNING: The scripts pip.exe, pip2.7.exe and pip2.exe are installed in 'C:\Python27\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script wheel.exe is installed in 'C:\Python27\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-20.0.2 wheel-0.34.2

So far so good.


Execute

Code: Select all

C:\Python27\pywbem_tmp>C:\python27\python.exe .\setup.py install
Result

Code: Select all

...
Installed c:\python27\lib\site-packages\pywbem-0.10.0-py2.7.egg
Processing dependencies for pywbem==0.10.0
Searching for M2CryptoWin32>=0.21
Reading https://pypi.python.org/simple/M2CryptoWin32/
Downloading https://files.pythonhosted.org/packages/7d/ed/a36945cf4a45858fbdb090fbbc0b8c7d4ecb6dcd7529e8fc4606f1342ea9/M2CryptoWin32-0.21.1-3.tar.gz#sha256=5497e113980a5f7a925512168ed5e6fc5d9c858632c2953f010f0818a459e19d
error: Download error for https://files.pythonhosted.org/packages/7d/ed/a36945cf4a45858fbdb090fbbc0b8c7d4ecb6dcd7529e8fc4606f1342ea9/M2CryptoWin32-0.21.1-3.tar.gz#sha256=5497e113980a5f7a925512168ed5e6fc5d9c858632c2953f010f0818a459e19d: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)

So everything was mostly good until it tried to download the M2CryptoWin32. The error makes me think the firewall is to blame as i was able to copy the URL and download the package via a browser on my machine. Then for kicks i tried to download it through the browser on the target machine and the package downloaded fine. So i think could still be a firewall issue but unable to verify at this time.

Now i was trying to figure out where to place the M2CryptoWin32-0.21.1-3.tar.gz file so when i rerun

Code: Select all

C:\Python27\pywbem_tmp>C:\python27\python.exe .\setup.py install
it might find the file already downloaded and begin working with it but i couldn't find where to put the file as numerous attempts failed with it unable to download the file.

Then I started researching how to manually install M2CryptoWin32.
I found this: https://github.com/pywbem/pywbem/issues ... -363280745
Except every time i tried to run pip i'd get

Code: Select all

'pip' is not recognized as an internal or external command, operable program or batch file.
Then i figured out it was in C:\Python27\Scripts (I now realize it told me that in the first results window but i didn't pick up on it at the time)

Execute

Code: Select all

C:\Python27\Scripts>pip install m2cryptowin32
Result

Code: Select all

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting m2cryptowin32
  Downloading M2CryptoWin32-0.21.1-3.tar.gz (840 kB)
     |UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU| 840 kB 3.3 MB/s
Building wheels for collected packages: m2cryptowin32
  Building wheel for m2cryptowin32 (setup.py) ... done
  Created wheel for m2cryptowin32: filename=M2CryptoWin32-0.21.1.post3-py2-none-any.whl size=854853 sha256=b655a259296ba856318d7baed2daeeb4fb6adaa5bf8cce98304177d169ad0dae
  Stored in directory: c:\users\redacted\appdata\local\pip\cache\wheels\6e\5a\a1\92e013ee8804f8f63511cf72ca01dda3fcc55073aef5a7b632
Successfully built m2cryptowin32
ERROR: pywbem 0.10.0 requires ply, which is not installed.
ERROR: pywbem 0.10.0 requires PyYAML, which is not installed.
ERROR: pywbem 0.10.0 requires six, which is not installed.
Installing collected packages: m2cryptowin32
Successfully installed m2cryptowin32-0.21.1.post3

Getting warmer, It said M2CryptoWin32 installed but i noticed my nemesis "six" was not installed. I figured i could probably just try to run pip install <modulename> to install the modules it said were not installed which felt like a requirement of some kind and I knew my end game was getting 'six' installed.


Execute

Code: Select all

C:\Python27\Scripts>pip install ply
Result

Code: Select all

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting ply
  Downloading ply-3.11-py2.py3-none-any.whl (49 kB)
     |UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU| 49 kB 3.2 MB/s
ERROR: pywbem 0.10.0 requires PyYAML, which is not installed.
ERROR: pywbem 0.10.0 requires six, which is not installed.
Installing collected packages: ply
Successfully installed ply-3.11

Not quite there but the pip install <modulename> theory seemed to be working.


Execute

Code: Select all

C:\Python27\Scripts>pip install six
Result

Code: Select all

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting six
  Downloading six-1.14.0-py2.py3-none-any.whl (10 kB)
ERROR: pywbem 0.10.0 requires PyYAML, which is not installed.
Installing collected packages: six
Successfully installed six-1.14.0

So close i could taste it. Module named Six is now installed!
I am not sure if i even needed PyYAML but I attempted to install it because of the reference that it was not installed in the first attempt at installing M2CryptoWin32.


Execute

Code: Select all

C:\Python27\Scripts>pip install pyyaml
Result

Code: Select all

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting pyyaml
  Downloading PyYAML-5.3.1-cp27-cp27m-win32.whl (195 kB)
     |UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU| 195 kB 6.8 MB/s
Installing collected packages: pyyaml
Successfully installed pyyaml-5.3.1

Now back to installing M2CryptoWin32


Execute

Code: Select all

C:\Python27\Scripts>pip install m2cryptowin32
Result

Code: Select all

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Requirement already satisfied: m2cryptowin32 in c:\python27\lib\site-packages (0.21.1.post3)

Now we are cooking with gasoline! Now back to Step 2 from your other post.


Execute

Code: Select all

C:\Python27\pywbem_tmp>"C:\Python27\python.exe" .\setup.py install
Result

Code: Select all

running install
running bdist_egg
running egg_info
writing requirements to pywbem.egg-info\requires.txt
writing pywbem.egg-info\PKG-INFO
writing top-level names to pywbem.egg-info\top_level.txt
writing dependency_links to pywbem.egg-info\dependency_links.txt
reading manifest file 'pywbem.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pywbem.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
creating build\bdist.win32\egg
creating build\bdist.win32\egg\pywbem
copying build\lib\pywbem\cim_constants.py -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\cim_http.py -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\cim_obj.py -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\cim_operations.py -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\cim_types.py -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\cim_xml.py -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\config.py -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\exceptions.py -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\LICENSE.txt -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\moflextab.py -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\mofparsetab.py -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\mof_compiler.py -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\tupleparse.py -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\tupletree.py -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\_cliutils.py -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\_listener.py -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\_recorder.py -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\_server.py -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\_subscription_manager.py -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\_version.py -> build\bdist.win32\egg\pywbem
copying build\lib\pywbem\__init__.py -> build\bdist.win32\egg\pywbem
byte-compiling build\bdist.win32\egg\pywbem\cim_constants.py to cim_constants.pyc
byte-compiling build\bdist.win32\egg\pywbem\cim_http.py to cim_http.pyc
byte-compiling build\bdist.win32\egg\pywbem\cim_obj.py to cim_obj.pyc
byte-compiling build\bdist.win32\egg\pywbem\cim_operations.py to cim_operations.pyc
byte-compiling build\bdist.win32\egg\pywbem\cim_types.py to cim_types.pyc
byte-compiling build\bdist.win32\egg\pywbem\cim_xml.py to cim_xml.pyc
byte-compiling build\bdist.win32\egg\pywbem\config.py to config.pyc
byte-compiling build\bdist.win32\egg\pywbem\exceptions.py to exceptions.pyc
byte-compiling build\bdist.win32\egg\pywbem\moflextab.py to moflextab.pyc
byte-compiling build\bdist.win32\egg\pywbem\mofparsetab.py to mofparsetab.pyc
byte-compiling build\bdist.win32\egg\pywbem\mof_compiler.py to mof_compiler.pyc
byte-compiling build\bdist.win32\egg\pywbem\tupleparse.py to tupleparse.pyc
byte-compiling build\bdist.win32\egg\pywbem\tupletree.py to tupletree.pyc
byte-compiling build\bdist.win32\egg\pywbem\_cliutils.py to _cliutils.pyc
byte-compiling build\bdist.win32\egg\pywbem\_listener.py to _listener.pyc
byte-compiling build\bdist.win32\egg\pywbem\_recorder.py to _recorder.pyc
byte-compiling build\bdist.win32\egg\pywbem\_server.py to _server.pyc
byte-compiling build\bdist.win32\egg\pywbem\_subscription_manager.py to _subscription_manager.pyc
byte-compiling build\bdist.win32\egg\pywbem\_version.py to _version.pyc
byte-compiling build\bdist.win32\egg\pywbem\__init__.py to __init__.pyc
creating build\bdist.win32\egg\EGG-INFO
installing scripts to build\bdist.win32\egg\EGG-INFO\scripts
running install_scripts
running build_scripts
creating build\bdist.win32\egg\EGG-INFO\scripts
copying build\scripts-2.7\mof_compiler -> build\bdist.win32\egg\EGG-INFO\scripts
copying build\scripts-2.7\mof_compiler.bat -> build\bdist.win32\egg\EGG-INFO\scripts
copying build\scripts-2.7\wbemcli -> build\bdist.win32\egg\EGG-INFO\scripts
copying build\scripts-2.7\wbemcli.bat -> build\bdist.win32\egg\EGG-INFO\scripts
copying build\scripts-2.7\wbemcli.py -> build\bdist.win32\egg\EGG-INFO\scripts
copying pywbem.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
copying pywbem.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
copying pywbem.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INFO
copying pywbem.egg-info\requires.txt -> build\bdist.win32\egg\EGG-INFO
copying pywbem.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO
zip_safe flag not set; analyzing archive contents...
pywbem.mof_compiler: module references __file__
creating 'dist\pywbem-0.10.0-py2.7.egg' and adding 'build\bdist.win32\egg' to it
removing 'build\bdist.win32\egg' (and everything under it)
Processing pywbem-0.10.0-py2.7.egg
removing 'c:\python27\lib\site-packages\pywbem-0.10.0-py2.7.egg' (and everything under it)
creating c:\python27\lib\site-packages\pywbem-0.10.0-py2.7.egg
Extracting pywbem-0.10.0-py2.7.egg to c:\python27\lib\site-packages
pywbem 0.10.0 is already the active version in easy-install.pth
Installing mof_compiler script to C:\Python27\Scripts
Installing mof_compiler.bat script to C:\Python27\Scripts
Installing wbemcli script to C:\Python27\Scripts
Installing wbemcli.bat script to C:\Python27\Scripts
Installing wbemcli.py script to C:\Python27\Scripts

Installed c:\python27\lib\site-packages\pywbem-0.10.0-py2.7.egg
Processing dependencies for pywbem==0.10.0
Searching for M2CryptoWin32==0.21.1.post3
Best match: M2CryptoWin32 0.21.1.post3
Adding M2CryptoWin32 0.21.1.post3 to easy-install.pth file

Using c:\python27\lib\site-packages
Searching for PyYAML==5.3.1
Best match: PyYAML 5.3.1
Adding PyYAML 5.3.1 to easy-install.pth file

Using c:\python27\lib\site-packages
Searching for ply==3.11
Best match: ply 3.11
Adding ply 3.11 to easy-install.pth file

Using c:\python27\lib\site-packages
Searching for six==1.14.0
Best match: six 1.14.0
Adding six 1.14.0 to easy-install.pth file

Using c:\python27\lib\site-packages
Finished processing dependencies for pywbem==0.10.0
build_moftab.py: Rebuilding the pywbem LEX/YACC table modules, if needed
build_moftab.py: Ensuring to build in pywbem install directory
Building LEX/YACC modules for MOF compiler in: C:\Python27\lib\site-packages\pywbem-0.10.0-py2.7.egg\pywbem
WARNING: yacc table file version is out of date
Generating LALR tables
WARNING: 4 reduce/reduce conflicts
WARNING: reduce/reduce conflict in state 61 resolved using rule (qualifierName -> ASSOCIATION)
WARNING: rejected rule (empty -> <empty>) in state 61
WARNING: reduce/reduce conflict in state 63 resolved using rule (qualifierName -> INDICATION)
WARNING: rejected rule (empty -> <empty>) in state 63
build_moftab.py: Successfully rebuilt the pywbem LEX/YACC table modules, if needed
Eureka. It completed successfully.

Now when attempting to scan the hosts they were successful in returning data.


I haven't slapped these commands into an Automate Script yet so i can run it quickly when i encounter it again but should be easy enough to accomplish. I haven't done this enough times yet to identify a common theme. I seem to see it mainly on Server 2019 so far but it could also be the firewalls we are deploying and if they are doing SSL Decryption somehow messing with it.. I also found it odd that when "pip install m2cryptowin32" executed it had no problem downloading the file (unlike the other command which failed to do so) but its possible it found it in the C:\python27 directory because i put it there in previous troubleshooting. I'll have to confirm that when i run into the next one that acts up.


Anyways hope this helps someone as its been a thorn in my side for quite some time.

User avatar
Cubert
Posts: 1483
Joined: Tue Dec 29, 2015 7:57 pm
Contact:

Re: No module named six" error when scanning ESX

Post by Cubert »

Awesome write up!

Post Reply