Trying to install powershellempire on Kali Linux but getting a lot of error in pip.I think its a broken module lib has no attribute ERRload RANDstring - python-3.x

I am showing you here, step by step, what I did.
First, I install:
apt install powershell-empire starkiller
It successfully installed. But When I try to run with the server, I receive this error:
> powershell-empire server
Traceback (most recent call last):
File "/usr/share/powershell-empire/empire.py", line 11, in <module>
import empire.server.server as server
File "/usr/share/powershell-empire/empire/server/server.py", line 40, in <module>
from empire.server.common import empire, helpers
File "/usr/share/powershell-empire/empire/server/common/empire.py", line 25, in <module>
from pydispatch import dispatcher
ModuleNotFoundError: No module named 'pydispatch'
I tried to search for this, but it brought up another error.
sudo python -m easy_install --upgrade pyOpenSSL
/usr/bin/python: No module named easy_install
pip uninstall pyopenssl
/usr/local/bin/python: No module named easy_install
I also tried with python3:
sudo python3 -m easy_install --upgrade pyOpenSSL
/usr/local/bin/python3: No module named easy_install
pip2 uninstall pyopenssl
/usr/bin/python: No module named easy_install
Nothing worked, so I try to find solution for easy install
python -m pip install requests
import OpenSSL.SSL
File "/usr/local/lib/python3.10/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/usr/local/lib/python3.10/dist-packages/OpenSSL/rand.py", line 169, in <module>
_lib.ERR_load_RAND_strings()
AttributeError: module 'lib' has no attribute 'ERR_load_RAND_strings'
Back to the first error. This mistake loops. My opensshl lib error comes first, followed by an easy install, and then it comes back. Lib Lib
One more thing is I even not able to show version of pip or pip3
Traceback (most recent call last):
File "/usr/bin/pip3", line 5, in <module>
from pip._internal.cli.main import main
File "/usr/local/lib/python3.10/dist-packages/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/local/lib/python3.10/dist-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/local/lib/python3.10/dist-packages/pip/_internal/cli/main_parser.py", line 12, in <module>
from pip._internal.commands import (
File "/usr/local/lib/python3.10/dist-packages/pip/_internal/commands/__init__.py", line 6, in <module>
from pip._internal.commands.completion import CompletionCommand
File "/usr/local/lib/python3.10/dist-packages/pip/_internal/commands/completion.py", line 6, in <module>
from pip._internal.cli.base_command import Command
File "/usr/local/lib/python3.10/dist-packages/pip/_internal/cli/base_command.py", line 18, in <module>
from pip._internal.download import PipSession
File "/usr/local/lib/python3.10/dist-packages/pip/_internal/download.py", line 15, in <module>
from pip._vendor import requests, six, urllib3
File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/requests/__init__.py", line 97, in <module>
from pip._vendor.urllib3.contrib import pyopenssl
File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/usr/local/lib/python3.10/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/usr/local/lib/python3.10/dist-packages/OpenSSL/rand.py", line 169, in <module>
_lib.ERR_load_RAND_strings()
AttributeError: module 'lib' has no attribute 'ERR_load_RAND_strings'

Related

cannot import name 'PackageFinder' from 'pip._internal.index' pip3

On my mac, pip3 exists in /usr/bin. When I try to install any package using pip3, it is failing. Even simple 'pip3' also failing with below error.
Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/usr/bin/pip3", line 6, in <module>
from pip._internal import main
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 11, in <module>
from pip._internal.commands import (
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/commands/__init__.py", line 6, in <module>
from pip._internal.commands.completion import CompletionCommand
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/commands/completion.py", line 6, in <module>
from pip._internal.cli.base_command import Command
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 26, in <module>
from pip._internal.index import PackageFinder
ImportError: cannot import name 'PackageFinder' from 'pip._internal.index' (/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/index/__init__.py)
I tried to remove /usr/bin/pip3. But it is saying operation is not permitted. I am unable to remove pip3. Can any one please let me know how to fix this issue.
Note: I went through some stack overflow questions related to this. Most of the answers suggested to uninstall and install pip3. But I am unable to remove pip3.

Why am I getting invalid syntax error while installing packages with pip

In Debian server when I am installing boto3 using pip I get the following error:
$ python3.2 -m pip install boto3
Traceback (most recent call last):
File "/usr/lib/python3.2/runpy.py", line 161, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python3.2/runpy.py", line 74, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.2/dist-packages/pip/__main__.py", line 16, in <module>
from pip._internal import main as _main # isort:skip # noqa
File "/usr/local/lib/python3.2/dist-packages/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/local/lib/python3.2/dist-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/local/lib/python3.2/dist-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/usr/local/lib/python3.2/dist-packages/pip/_internal/cli/cmdoptions.py", line 17, in <module>
from pip._internal.locations import USER_CACHE_DIR, src_prefix
File "/usr/local/lib/python3.2/dist-packages/pip/_internal/locations.py", line 13, in <module>
from pip._internal.utils import appdirs
File "/usr/local/lib/python3.2/dist-packages/pip/_internal/utils/appdirs.py", line 12, in <module>
from pip._internal.utils.compat import WINDOWS, expanduser
File "/usr/local/lib/python3.2/dist-packages/pip/_internal/utils/compat.py", line 62
return u"".join(u"\\x%x" % c for c in raw_bytes), err.end
^
SyntaxError: invalid syntax
Note: pip version is 18.1
I figured it out. The syntax - u"".join is not supported in python3.2.
pip3(which was same as pip3.2) while running the scripts for installing boto3 faced the syntax and threw the exception.
I installed python 3.6 and on running "pip3.6 install boto3", it worked.
Note: My python project is new and small one, so changing from python3.2 to python3.6 did not affect much, but with large or existing project this may not be feasible. Just want anyone who may face the situation to know the reason for this issue.

Cannot use most python apps after updating to Ubuntu 18.04

After updating to Ubuntu 18.04 LTS I can no longer use most Python apps including pip (to install or uninstall). I get the following error in command-line:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 11, in <module> load_entry_point('pip==10.0.1', 'console_scripts', 'pip')()
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 572, in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2755, in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2408, in load
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2414, in resolve
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/__init__.py", line 42, in <module>
from pip._internal import cmdoptions
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cmdoptions.py", line 16, in <module>
from pip._internal.index import (
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/index.py", line 15, in <module>
from pip._vendor import html5lib, requests, six
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py", line 86, in <module>
from pip._vendor.urllib3.contrib import pyopenssl
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 105, in <module>
SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'
After Googling the errors it appears that the version of pyopenssl is out of date, but I've tried to manually download an installpyopenssl18 through a TGZ file or through easy_install and neither have worked.
I cannot install/uninstall via pip because I get the above error. Any suggestions? I'd like to avoid having to reinstall Python or even the OS itself.
After trying the manual install of pyopenssl 18 again I noticed the path it was installing to: /usr/local/lib/python2.7/dist-packages
So I went digging in that directory and saw a folder called:
OpenSSL
which was referenced in the error. I renamed this folder and re-installed pyopenssl and the error is cleared. I don't have any issues accessing HTTPS sites so it is possible this is a deprecated module replaced by pyOpenSSL?

Scrapy 1.2.0 in Python 3.5

Was trying to play with Scrapy for the first time. Switched to my python 3.5 environment created by Anaconda and installed scrapy 1.2.0 per scrapy website:
$conda install -c scrapinghub scrapy
Now when I try to do
$scrapy startproject tutorial
I get the following traceback:
Traceback (most recent call last):
File "/Users/bonjuice/anaconda/envs/py35/bin/scrapy", line 7, in <module>
from scrapy.cmdline import execute
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/scrapy/cmdline.py", line 9, in <module>
from scrapy.crawler import CrawlerProcess
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/scrapy/crawler.py", line 6, in <module>
from twisted.internet import reactor, defer
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/twisted/internet/reactor.py", line 38, in <module>
from twisted.internet import default
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/twisted/internet/default.py", line 56, in <module>
install = _getInstallFunction(platform)
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/twisted/internet/default.py", line 50, in _getInstallFunction
from twisted.internet.selectreactor import install
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/twisted/internet/selectreactor.py", line 18, in <module>
from twisted.internet import posixbase
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/twisted/internet/posixbase.py", line 18, in <module>
from twisted.internet import error, udp, tcp
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/twisted/internet/tcp.py", line 28, in <module>
from twisted.internet._newtls import (
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/twisted/internet/_newtls.py", line 21, in <module>
from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/twisted/protocols/tls.py", line 41, in <module>
from OpenSSL.SSL import Error, ZeroReturnError, WantReadError
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/OpenSSL/rand.py", line 12, in <module>
from OpenSSL._util import (
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/OpenSSL/_util.py", line 6, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 234, in <module>
Binding.init_static_locks()
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 180, in init_static_locks
cls._ensure_ffi_initialized()
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 167, in _ensure_ffi_initialized
cls.lib = build_conditional_library(lib, CONDITIONAL_NAMES)
File "/Users/bonjuice/anaconda/envs/py35/lib/python3.5/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 104, in build_conditional_library
if not getattr(lib, condition):
AttributeError: cffi library '_openssl' has no function, constant or global variable named 'Cryptography_HAS_RSA_OAEP_MD'
I looked around the web but no one seems to be having similar issues, could anyone please point me to the right direction? Much obliged!
It seems to be related to cryptography and openssl.
Official documentation page covers this issue pretty well. Make sure you have all of non-python dependencies.
This is the important bit from the documentation:
sudo apt-get install build-essential libssl-dev libffi-dev python-dev
Also there are specific intructions for conda/anaconda installs:
Because of a bug in conda, attempting to install cryptography out of the box will result in an error. This can be resolved by setting the library path environment variable for your platform.
env LD_LIBRARY_PATH="$HOME/anaconda/lib" pip install cryptography

Odoo installation Magento Connector

I am new to Odoo/OpenERP. I am trying to install odoo and odoo-magento-connector in ubuntu 14.04 using this tutorial http://www.theopensourcerer.com/2014/09/how-to-install-openerp-odoo-8-on-ubuntu-server-14-04-lts/ I am getting stuck in Step 6, /opt/odoo/openerp-server after typing this command i get error shown in the below
Traceback (most recent call last):
File "/opt/odoo/openerp-server", line 2, in
import openerp
File "/opt/odoo/openerp/init.py", line 76, in
import modules
File "/opt/odoo/openerp/modules/init.py", line 27, in
from . import db, graph, loading, migration, module, registry
File "/opt/odoo/openerp/modules/loading.py", line 44, in
from openerp.modules.module import initialize_sys_path, \
File "/opt/odoo/openerp/modules/module.py", line 37, in
import unittest2
File "/usr/local/lib/python2.7/dist-packages/unittest2-1.1.0-py2.7.egg
/unittest2/init.py", line 40, in
from unittest2.collector import collector
File "/usr/local/lib/python2.7/dist-packages/unittest2-1.1.0-py2.7.egg/
unittest2/collector.py", line 3, in
from unittest2.loader import defaultTestLoader
File "/usr/local/lib/python2.7/dist-packages/unittest2-1.1.0-py2.7.egg/
unittest2/loader.py", line 13, in
from unittest2 import case, suite, util
File "/usr/local/lib/python2.7/dist-packages/unittest2-1.1.0-py2.7.egg
/unittest2/case.py", line 10, in
import traceback2 as traceback
ImportError: No module named traceback2`
Just saw this old when i had the same issue
It is a python module
pip search traceback2
You can install like this (use sudo)
pip install traceback2

Resources