pupy icon indicating copy to clipboard operation
pupy copied to clipboard

When running create-workspace.py, Unicode decode error is raised and the installation will fail

Open Hex27 opened this issue 5 years ago • 5 comments

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. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python /usr/lib/python2.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-OU79yb/overlay --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel 'cffi>=1.4.1; python_implementation != '"'"'PyPy'"'"''
       cwd: None
  Complete output (87 lines):
  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. pip 21.0 will drop support for Python 2.7 in January 2021. 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 setuptools>=40.8.0
    Downloading setuptools-44.1.1.zip (858 kB)
  Collecting wheel
    Downloading wheel-0.34.2.tar.gz (58 kB)
  Collecting cffi>=1.4.1
    Downloading cffi-1.14.1.tar.gz (468 kB)
  Collecting pycparser
    Downloading pycparser-2.20.tar.gz (161 kB)
  Skipping wheel build for setuptools, due to binaries being disabled for it.
  Skipping wheel build for wheel, due to binaries being disabled for it.
  Skipping wheel build for cffi, due to binaries being disabled for it.
  Skipping wheel build for pycparser, due to binaries being disabled for it.
  Installing collected packages: setuptools, wheel, pycparser, cffi
      Running setup.py install for setuptools: started
      Running setup.py install for setuptools: finished with status 'done'
      Running setup.py install for wheel: started
      Running setup.py install for wheel: finished with status 'done'
      Running setup.py install for pycparser: started
      Running setup.py install for pycparser: finished with status 'done'
      Running setup.py install for cffi: started
      Running setup.py install for cffi: finished with status 'done'
  Successfully installed cffi-1.14.1 pycparser-2.20 setuptools-44.1.1 wheel-0.34.2
  Traceback (most recent call last):
    File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
      "__main__", fname, loader, pkg_name)
    File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
      exec code in run_globals
    File "/usr/lib/python2.7/site-packages/pip/__main__.py", line 26, in <module>
      sys.exit(_main())
    File "/usr/lib/python2.7/site-packages/pip/_internal/cli/main.py", line 75, in main
      return command.main(cmd_args)
    File "/usr/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 121, in main
      return self._main(args)
    File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
      self.gen.next()
    File "/usr/lib/python2.7/site-packages/pip/_internal/cli/command_context.py", line 28, in main_context
      yield
    File "/usr/lib/python2.7/site-packages/pip/_vendor/contextlib2.py", line 479, in __exit__
      _reraise_with_existing_context(exc_details)
    File "/usr/lib/python2.7/site-packages/pip/_vendor/contextlib2.py", line 353, in _reraise_with_existing_context
      exec("raise exc_type, exc_value, exc_tb")
    File "/usr/lib/python2.7/site-packages/pip/_vendor/contextlib2.py", line 468, in __exit__
      if cb(*exc_details):
    File "/usr/lib/python2.7/site-packages/pip/_vendor/contextlib2.py", line 396, in _exit_wrapper
      return cm_exit(cm, *exc_details)
    File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
      self.gen.next()
    File "/usr/lib/python2.7/site-packages/pip/_internal/utils/temp_dir.py", line 46, in global_tempdir_manager
      _tempdir_manager = old_tempdir_manager
    File "/usr/lib/python2.7/site-packages/pip/_vendor/contextlib2.py", line 479, in __exit__
      _reraise_with_existing_context(exc_details)
    File "/usr/lib/python2.7/site-packages/pip/_vendor/contextlib2.py", line 353, in _reraise_with_existing_context
      exec("raise exc_type, exc_value, exc_tb")
    File "/usr/lib/python2.7/site-packages/pip/_vendor/contextlib2.py", line 468, in __exit__
      if cb(*exc_details):
    File "/usr/lib/python2.7/site-packages/pip/_vendor/contextlib2.py", line 396, in _exit_wrapper
      return cm_exit(cm, *exc_details)
    File "/usr/lib/python2.7/site-packages/pip/_internal/utils/temp_dir.py", line 175, in __exit__
      self.cleanup()
    File "/usr/lib/python2.7/site-packages/pip/_internal/utils/temp_dir.py", line 199, in cleanup
      rmtree(ensure_text(self._path))
    File "/usr/lib/python2.7/site-packages/pip/_vendor/retrying.py", line 49, in wrapped_f
      return Retrying(*dargs, **dkw).call(f, *args, **kw)
    File "/usr/lib/python2.7/site-packages/pip/_vendor/retrying.py", line 212, in call
      raise attempt.get()
    File "/usr/lib/python2.7/site-packages/pip/_vendor/retrying.py", line 247, in get
      six.reraise(self.value[0], self.value[1], self.value[2])
    File "/usr/lib/python2.7/site-packages/pip/_vendor/retrying.py", line 200, in call
      attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
    File "/usr/lib/python2.7/site-packages/pip/_internal/utils/misc.py", line 139, in rmtree
      onerror=rmtree_errorhandler)
    File "/usr/lib/python2.7/shutil.py", line 270, in rmtree
      rmtree(fullname, ignore_errors, onerror)
    File "/usr/lib/python2.7/shutil.py", line 270, in rmtree
      rmtree(fullname, ignore_errors, onerror)
    File "/usr/lib/python2.7/shutil.py", line 270, in rmtree
      rmtree(fullname, ignore_errors, onerror)
    File "/usr/lib/python2.7/shutil.py", line 270, in rmtree
      rmtree(fullname, ignore_errors, onerror)
    File "/usr/lib/python2.7/shutil.py", line 270, in rmtree
      rmtree(fullname, ignore_errors, onerror)
    File "/usr/lib/python2.7/shutil.py", line 264, in rmtree
      fullname = os.path.join(path, name)
    File "/usr/lib/python2.7/posixpath.py", line 73, in join
      path += '/' + b
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python /usr/lib/python2.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-OU79yb/overlay --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel 'cffi>=1.4.1; python_implementation != '"'"'PyPy'"'"'' Check the logs for full command output.
Traceback (most recent call last):
  File "create-workspace.py", line 655, in <module>
    main()
  File "create-workspace.py", line 561, in main
    templates, args.image_tag, args.persistent
  File "create-workspace.py", line 249, in build_templates
    subprocess.check_call(args, stderr=subprocess.STDOUT)
  File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '[u'docker', u'run', u'--rm', u'--name=build-pupy-linux32-ffa2', u'--ulimit', u'nofile=65535:65535', u'--security-opt', u'label=disable', u'--mount', u'type=bind,src=/home/cytec/pupy,target=/build/workspace/project', u'alxchk/tc-linux32:latest', u'client/sources-linux/build-docker.sh']' returned non-zero exit status 1

Done on Ubuntu 20.04 LTS (GNU/Linux 5.4.0-42-generic x86_64. Pip built with get-pip.py, as apt-get install python-pip no longer works.

Error also occurs when running python3 create-workspace.py pupyws -E docker

Hex27 avatar Aug 13 '20 09:08 Hex27

I managed to get an installation working with no payload templates (can't gen payloads). These steps worked for me.

curl -fsSL https://get.docker.com -o get-docker.sh
systemctl start docker
systemctl enable docker
<Log out and in>
python3 create-workspace.py -NC -E docker pupyws
echo "export PATH=$PATH:/home/asddfqewfadg/.local/bin" >> ~/.profile
source ~/.profile

EDIT: Without the NC flag, the same error occurs

Hex27 avatar Aug 14 '20 01:08 Hex27

Thanks!

I'm having the same issue on ubuntu 20.04 also. Troubleshooting some more today.

reecep55 avatar Aug 14 '20 13:08 reecep55

Thanks!

I'm having the same issue on ubuntu 20.04 also. Troubleshooting some more today.

Apparently, if you run install.sh before running create workspace, it will build some payloads, but the unicodeerror still occurs. The end result is a half-functioning pupy that has most basic functions but lacks some features like (not limited to) bypassuac and .net payloads.

Hex27 avatar Aug 14 '20 14:08 Hex27

Running ./create-workspace.py -NC -E docker pupyws works, thanks for that.

I set a path to pupysh contained in the workspace directory created, I can successfully run a server that listens on the port specified in pupy.conf.

I tried generating a payload using gen -f py bind --port -t and it seemed to work. Now I'm trying to figure out how to create and use a payload to connect back to my server from another ubuntu machine, any guidance would be appreciated!

reecep55 avatar Aug 14 '20 23:08 reecep55

Looks like after some point it's not possible to install some python packages with LC_ALL=C. I pushed fixes to tc-linux*, so you need to pull latest toolchains and recreate build containers.

alxchk avatar Aug 16 '20 04:08 alxchk