DanMcInerney / icebreaker

Gets plaintext Active Directory credentials if you're on the internal network but outside the AD environment
MIT License
1.18k stars 158 forks source link

Install fails when creating virtual enviroment #2

Closed n00py closed 6 years ago

n00py commented 6 years ago

[*] Running: pipenv install --three Creating a virtualenv for this project… Using /usr/bin/python3 to create virtualenv… ⠋Traceback (most recent call last): File "/usr/local/bin/pew", line 7, in from pew.pew import pew File "/usr/local/lib/python2.7/dist-packages/pew/init.py", line 3, in from . import pew File "/usr/local/lib/python2.7/dist-packages/pew/pew.py", line 16, in from backports.shutil_get_terminal_size import get_terminal_size ImportError: No module named shutil_get_terminal_size

Virtualenv location: Creating a virtualenv for this project… ⠙Traceback (most recent call last): File "/usr/local/bin/pew", line 7, in from pew.pew import pew File "/usr/local/lib/python2.7/dist-packages/pew/init.py", line 3, in from . import pew File "/usr/local/lib/python2.7/dist-packages/pew/pew.py", line 16, in from backports.shutil_get_terminal_size import get_terminal_size ImportError: No module named shutil_get_terminal_size

on

Linux 4.14.0-kali1-amd64 #1 SMP Debian 4.14.2-1kali1 (2017-12-04) x86_64 GNU/Linux

DanMcInerney commented 6 years ago

This is a complicated namespace issue that's local to your Python installation. The quick fix is:

cd /usr/local/lib/python2.7/dist-packages/pew sed -i "s/from backports.shutil_get_terminal_size import get_terminal_size/from shutil_backports.get_terminal_size import get_terminal_size/g" *

This is some info from research I did earlier:

"Long story short, you can't ever mix pkg_resources namespaces and pkgutil namespaces. It's explained in the Python packaging guide. Attempting to import both is probably the best way to cause random breakage for everyone. You have to decide on one of them, and use it consistently across all packages using the backports namespace."

I'm not sure how to permanently fix as it's an issue with third party code combined with some kind of issue with how Python is installed locally and how it's looking up namespaces.

DanMcInerney commented 6 years ago

Backports is a weird module but this can be fixed with apt-get install python-backports-shutil-get-terminal-size. Even though backports is installed already through pip, you apparently sometimes need to install it system-wide depending on how your python environment was installed or setup or something.