Coder Social home page Coder Social logo

Comments (14)

nickkilla avatar nickkilla commented on July 20, 2024

Saw same issue in closed, will try solution there.

from poshc2.

nickkilla avatar nickkilla commented on July 20, 2024

nickkilla@box:~$ sudo posh
Traceback (most recent call last):
File "start.py", line 8, in
run()
File "/opt/PoshC2/poshc2/init.py", line 10, in run
client.start()
File "/opt/PoshC2/poshc2/client/init.py", line 5, in start
from poshc2.client.command_handlers.ImplantHandler import main
File "/opt/PoshC2/poshc2/client/command_handlers/ImplantHandler.py", line 5, in
from poshc2.server.DB import update_item, get_c2server_all, get_implants_all, get_tasks, get_implantdetails, new_urldetails
File "/opt/PoshC2/poshc2/server/DB.py", line 4, in
from poshc2.server.Config import Database
File "/opt/PoshC2/poshc2/server/Config.py", line 1, in
import os, yaml
ModuleNotFoundError: No module named 'yaml'

from poshc2.

nickkilla avatar nickkilla commented on July 20, 2024

So tried the steps in the other Yaml closed issue. I did the pip install requirements and redid the ./Install and still shows no yaml when trying to run posh lister

from poshc2.

nickkilla avatar nickkilla commented on July 20, 2024

Not sure if this is the issue

Package libicu63 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'libicu63' has no installation candidate

from poshc2.

m3ldis avatar m3ldis commented on July 20, 2024

I had the same issue (I didn't see the libicu63 problem). After running python3 -m pip install --force-reinstall -r requirements.txt it showed that PyYAML had been installed by distutils and couldn't be installed by pip. So I did apt remove PyYAML, re-ran the pip command, and updated posh. It worked for me. I am using the docker install.

Warning, if you see this in the next few hours, see my other issue regarding the kali docker build.

Edit: there's probably a better way to do this, i.e., tell pip or pipenv or whatever to use the system PyYAML, but this was the quickest fix.

from poshc2.

riskydissonance avatar riskydissonance commented on July 20, 2024

Thanks @clhefton. @nickkilla are you able to confirm if this fixed the issue?

Unfortunately we can't account for what's installed on the OS and if it clashes. You can try docker if it still doesn't work.

from poshc2.

m3ldis avatar m3ldis commented on July 20, 2024

@m0rv4i this issue happens with the docker installation. I don't know about the normal one. I just re-tried the fix I mentioned and I'm not sure how it happened the first time, but it didn't work this time.

Different fix.

@nickkilla I did actually notice the libicu63 error but it doesn't affect anything. The root issue is actually with pipenv somehow not calling the right python, even though I only have one on my system. Maybe it was using some random version within the docker build and that version can't find anything installed with pip?

To get it to work, in /usr/bin/posh-server, change the following:

    python3 -m pipenv run python3 -u start.py --server 2>&1 | tee -a "$POSH_PROJECT_DIR/poshc2_server.log"

to:

    python3 -m /usr/bin/pipenv run python3 -u start.py --server 2>&1 | tee -a "$POSH_PROJECT_DIR/poshc2_server.log"

from poshc2.

nickkilla avatar nickkilla commented on July 20, 2024

@clhefton The solution yesterday solved the issue.

from poshc2.

yg-ht avatar yg-ht commented on July 20, 2024

I have hitting my head against this issue and trying to work through it and suddenly realised that I was running Install.sh as non-priv user with sudo... This sets up a Virtualenv for the low-priv user which means when you come to run the service as root it can't find the libraries.

It might be a good idea to stick a flag in Install.sh for "don't use sudo" or to change the venv creation process to cope. Off the top of my head though, I don't know how to do this...

(edited for grammar)

from poshc2.

riskydissonance avatar riskydissonance commented on July 20, 2024

I agree I think I need to investigate the sudo/pipenv behaviour, will add that to the shortlist

from poshc2.

riskydissonance avatar riskydissonance commented on July 20, 2024

@yg-ht i'm actually confused a little by your last comment, as if you're using a none-priv user and sudo to install the script then are you not using that same low privileged user to run PoshC2 (using sudo again)? If so it should be using the same environment. Either way it would be recommended to use the same technique for installing and running PoshC2.

Having done some testing across OSs and users, my observations are:

  • Running install as sudo creates the virtual environment under /root
  • Running posh- commands using sudo uses the same virtualenv and it works
  • Running the posh- commands without sudo or as a different user doesn't work, as the virtual env is not set up for that user
    image

Is that inline with what you're seeing?

from poshc2.

yg-ht avatar yg-ht commented on July 20, 2024

from poshc2.

ramoncjs3 avatar ramoncjs3 commented on July 20, 2024

Because postgresql is supported in the configuration, and postgresql is not installed in Kali, an error is reported during the automatic installation process because psycopg2 is not installed successfully.
The solution is as follows:
apt-get install postgresql
apt-get install python-psycopg2
apt-get install libpq-dev
python3 -m pip install --force-reinstall -r requirements.txt

from poshc2.

riskydissonance avatar riskydissonance commented on July 20, 2024

👍 thanks ramoncjs3

from poshc2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.