Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundErrors #33

Open
danicastone opened this issue Apr 10, 2022 · 3 comments
Open

ModuleNotFoundErrors #33

danicastone opened this issue Apr 10, 2022 · 3 comments

Comments

@danicastone
Copy link

danicastone commented Apr 10, 2022

root: source bin/activate
[] Preparing environment...
[
] SSL Enabled: Y
[] Hostname: [redacted]
[
] Two-factor: Y
[] Loading Module: gmail
[
] Port: 443
[] Destination URL: [redacted]
[
] Starting credsniper w/ flags: --ssl --twofactor --verbose
[] Adding Let's Encypt repository...
Traceback (most recent call last):
File "/usr/bin/lsb_release", line 25, in
import lsb_release
ModuleNotFoundError: No module named 'lsb_release'
Traceback (most recent call last):
File "/usr/bin/lsb_release", line 25, in
import lsb_release
ModuleNotFoundError: No module named 'lsb_release'
Traceback (most recent call last):
File "/usr/bin/lsb_release", line 25, in
import lsb_release
ModuleNotFoundError: No module named 'lsb_release'
Traceback (most recent call last):
File "/usr/bin/lsb_release", line 25, in
import lsb_release
ModuleNotFoundError: No module named 'lsb_release'
Traceback (most recent call last):
File "/usr/bin/lsb_release", line 25, in
import lsb_release
ModuleNotFoundError: No module named 'lsb_release'
Traceback (most recent call last):
File "/usr/bin/lsb_release", line 25, in
import lsb_release
ModuleNotFoundError: No module named 'lsb_release'
Hit:1 https://repos-droplet.digitalocean.com/apt/droplet-agent main InRelease
Hit:2 https://packages.microsoft.com/ubuntu/20.04/prod focal InRelease
Hit:3 http://mirrors.digitalocean.com/ubuntu focal InRelease
Get:4 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:5 http://archive.ubuntu.com/ubuntu focal InRelease
Ign:6 http://ppa.launchpad.net/certbot/certbot/ubuntu focal InRelease
Get:7 http://mirrors.digitalocean.com/ubuntu focal-updates InRelease [114 kB]
Get:8 http://mirrors.digitalocean.com/ubuntu focal-backports InRelease [108 kB]
Ign:9 http://ppa.launchpad.net/certbot/certbot/ubuntu jammy InRelease
Get:10 http://mirrors.digitalocean.com/ubuntu focal-updates/main amd64 Packages [1712 kB]
Err:11 http://ppa.launchpad.net/certbot/certbot/ubuntu focal Release
404 Not Found [IP: 2001:67c:1560:8008::19 80]
Err:12 http://ppa.launchpad.net/certbot/certbot/ubuntu jammy Release
404 Not Found [IP: 2001:67c:1560:8008::19 80]
Get:13 http://mirrors.digitalocean.com/ubuntu focal-updates/universe amd64 Packages [916 kB]
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/certbot/certbot/ubuntu focal Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://ppa.launchpad.net/certbot/certbot/ubuntu jammy Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
[
] Updating Apt...
E: The repository 'http://ppa.launchpad.net/certbot/certbot/ubuntu focal Release' does not have a Release file.
E: The repository 'http://ppa.launchpad.net/certbot/certbot/ubuntu jammy Release' does not have a Release file.
[] Installing pre-reqs...
[
] Creating & activating virtual environment...
[] Enabling port binding for Python...
[
] Installing required Python modules...
ERROR: Exception:
Traceback (most recent call last):
File "/root/CredSniper/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
status = self.run(options, args)
File "/root/CredSniper/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 305, in run
session = self.get_default_session(options)
File "/root/CredSniper/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 74, in get_default_session
self._session = self.enter_context(self._build_session(options))
File "/root/CredSniper/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 84, in _build_session
session = PipSession(
File "/root/CredSniper/lib/python3.8/site-packages/pip/_internal/network/session.py", line 241, in init
self.headers["User-Agent"] = user_agent()
File "/root/CredSniper/lib/python3.8/site-packages/pip/_internal/network/session.py", line 132, in user_agent
zip(["name", "version", "id"], distro.linux_distribution()),
File "/usr/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl/distro.py", line 122, in linux_distribution
return _distro.linux_distribution(full_distribution_name)
File "/usr/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl/distro.py", line 677, in linux_distribution
self.version(),
File "/usr/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl/distro.py", line 737, in version
self.lsb_release_attr('release'),
File "/usr/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl/distro.py", line 899, in lsb_release_attr
return self._lsb_release_info.get(attribute, '')
File "/usr/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl/distro.py", line 552, in get
ret = obj.dict[self._fname] = self._f(obj)
File "/usr/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl/distro.py", line 1012, in _lsb_release_info
stdout = subprocess.check_output(cmd, stderr=devnull)
File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
return run(popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
[
] Creating & installing SSL certificates...
An unexpected error occurred:
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
Please see the logfile '/tmp/tmpnng48ye8/log' for more details.

Upon running with Python3, I encounter the following:
[] ###################################################
[
] Successfully installed everything!
[] To run manually just:
[
] ~/CredSniper$ source bin/activate
[] (CredSniper) ~/CredSniper$ python credsniper.py
[
] ###################################################
[*] Launching CredSniper...
Traceback (most recent call last):
File "credsniper.py", line 1, in
from flask import Flask, jsonify, request, abort, Response
ModuleNotFoundError: No module named 'flask'

No problem right? pip install flask!
But then....

ERROR: Exception:
Traceback (most recent call last):
File "/root/CredSniper/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
status = self.run(options, args)
File "/root/CredSniper/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 305, in run
session = self.get_default_session(options)
File "/root/CredSniper/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 74, in get_default_session
self._session = self.enter_context(self._build_session(options))
File "/root/CredSniper/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 84, in _build_session
session = PipSession(
File "/root/CredSniper/lib/python3.8/site-packages/pip/_internal/network/session.py", line 241, in init
self.headers["User-Agent"] = user_agent()
File "/root/CredSniper/lib/python3.8/site-packages/pip/_internal/network/session.py", line 132, in user_agent
zip(["name", "version", "id"], distro.linux_distribution()),
File "/usr/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl/distro.py", line 122, in linux_distribution
return _distro.linux_distribution(full_distribution_name)
File "/usr/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl/distro.py", line 677, in linux_distribution
self.version(),
File "/usr/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl/distro.py", line 737, in version
self.lsb_release_attr('release'),
File "/usr/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl/distro.py", line 899, in lsb_release_attr
return self._lsb_release_info.get(attribute, '')
File "/usr/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl/distro.py", line 552, in get
ret = obj.dict[self._fname] = self._f(obj)
File "/usr/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl/distro.py", line 1012, in _lsb_release_info
stdout = subprocess.check_output(cmd, stderr=devnull)
File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.

@danicastone
Copy link
Author

It looks like the lack of lsb_release is a common problem; it's no longer included in Python. But the common solutions (symlinking an updated version of Python to it, changing what version of Python lsb_release uses, updating Python) didn't work either.

Neither did git cloning flask. But it did lead me to the correct solution:
apt install python3-flask

Now I'll go back up the chain to see if that resolves anything else....

@danicastone danicastone changed the title ValueError: The 'credsniper' package was not installed in a way that PackageLoader understands. ModuleNotFoundErrors Apr 10, 2022
@danicastone
Copy link
Author

source bin/activate works just fine now.

python credsniper.py still throwing this error:

Traceback (most recent call last):
File "credsniper.py", line 1, in
from flask import Flask, jsonify, request, abort, Response
ModuleNotFoundError: No module named 'flask'

But if I open a python interactive shell, and type "from flask import Flask," it gives me no trouble at all.

@danicastone
Copy link
Author

Okay. Trying this solution....

pip3 install Flask
pip3 install jsonify
pip3 install Response
pip3 install -U pipenv && pipenv install && pipenv shell

Works! Gonna see if I can tweak it to avoid throwing these errors in the first place....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant