Friday, May 20, 2022

[Solved] Fix upgrade errors in Kali Linux


If you face errors from powershell-empire while upgrading Kali Linux, upgrade the pip packages for Flask and aiohttp with root privileges.



Error - 1:

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 23, in <module>
    import flask
  File "/usr/lib/python3/dist-packages/flask/__init__.py", line 19, in <module>
    from . import json
  File "/usr/lib/python3/dist-packages/flask/json/__init__.py", line 15, in <module>
    from itsdangerous import json as _json
ImportError: cannot import name 'json' from 'itsdangerous' (/usr/lib/python3/dist-packages/itsdangerous/__init__.py)
dpkg: error processing package powershell-empire (--configure):
 installed powershell-empire package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 powershell-empire
E: Sub-process /usr/bin/dpkg returned an error code (1)


Fix - 1:

$ sudo pip3 install --upgrade Flask
Requirement already satisfied: Flask in /usr/lib/python3/dist-packages (1.1.2)
Collecting Flask
  Downloading Flask-2.1.2-py3-none-any.whl (95 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 95.2/95.2 kB 14.5 MB/s eta 0:00:00
Requirement already satisfied: click>=8.0 in /usr/lib/python3/dist-packages (from Flask) (8.0.3)
Requirement already satisfied: importlib-metadata>=3.6.0 in /usr/lib/python3/dist-packages (from Flask) (4.6.4)
Requirement already satisfied: itsdangerous>=2.0 in /usr/lib/python3/dist-packages (from Flask) (2.1.2)
Requirement already satisfied: Jinja2>=3.0 in /usr/lib/python3/dist-packages (from Flask) (3.0.3)
Requirement already satisfied: Werkzeug>=2.0 in /usr/lib/python3/dist-packages (from Flask) (2.0.2)
Installing collected packages: Flask
  Attempting uninstall: Flask
    Found existing installation: Flask 1.1.2
    Not uninstalling flask at /usr/lib/python3/dist-packages, outside environment /usr
    Can't uninstall 'Flask'. No files were found to uninstall.
Successfully installed Flask-2.1.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv


Error - 2:

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 25, in <module>
    import socketio
  File "/usr/lib/python3/dist-packages/socketio/__init__.py", line 3, in <module>
    from .client import Client
  File "/usr/lib/python3/dist-packages/socketio/client.py", line 7, in <module>
    import engineio
  File "/usr/lib/python3/dist-packages/engineio/__init__.py", line 8, in <module>
    from .asyncio_client import AsyncClient
  File "/usr/lib/python3/dist-packages/engineio/asyncio_client.py", line 7, in <module>
    import aiohttp
  File "/usr/lib/python3/dist-packages/aiohttp/__init__.py", line 6, in <module>
    from .client import (
  File "/usr/lib/python3/dist-packages/aiohttp/client.py", line 35, in <module>
    from . import hdrs, http, payload
  File "/usr/lib/python3/dist-packages/aiohttp/http.py", line 7, in <module>
    from .http_parser import (
  File "/usr/lib/python3/dist-packages/aiohttp/http_parser.py", line 15, in <module>
    from .helpers import NO_EXTENSIONS, BaseTimerContext
  File "/usr/lib/python3/dist-packages/aiohttp/helpers.py", line 667, in <module>
    class CeilTimeout(async_timeout.timeout):
TypeError: function() argument 'code' must be code, not str
dpkg: error processing package powershell-empire (--configure):
 installed powershell-empire package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 powershell-empire
E: Sub-process /usr/bin/dpkg returned an error code (1)


Fix - 2:

$ sudo pip3 install --upgrade aiohttp
Requirement already satisfied: aiohttp in /usr/lib/python3/dist-packages (3.7.4)
Collecting aiohttp
  Downloading aiohttp-3.8.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 6.5 MB/s eta 0:00:00
Collecting frozenlist>=1.1.1
  Downloading frozenlist-1.3.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (156 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 156.2/156.2 kB 26.6 MB/s eta 0:00:00
Collecting aiosignal>=1.1.2
  Downloading aiosignal-1.2.0-py3-none-any.whl (8.2 kB)
Requirement already satisfied: multidict<7.0,>=4.5 in /usr/lib/python3/dist-packages (from aiohttp) (5.1.0)
Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /usr/lib/python3/dist-packages (from aiohttp) (4.0.1)
Requirement already satisfied: yarl<2.0,>=1.0 in /usr/lib/python3/dist-packages (from aiohttp) (1.7.2)
Collecting charset-normalizer<3.0,>=2.0
  Downloading charset_normalizer-2.0.12-py3-none-any.whl (39 kB)
Requirement already satisfied: attrs>=17.3.0 in /usr/lib/python3/dist-packages (from aiohttp) (21.2.0)
Installing collected packages: frozenlist, charset-normalizer, aiosignal, aiohttp
  Attempting uninstall: aiohttp
    Found existing installation: aiohttp 3.7.4
    Not uninstalling aiohttp at /usr/lib/python3/dist-packages, outside environment /usr
    Can't uninstall 'aiohttp'. No files were found to uninstall.
Successfully installed aiohttp-3.8.1 aiosignal-1.2.0 charset-normalizer-2.0.12 frozenlist-1.3.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.