bannsec / stegoVeritas

Yet another Stego Tool
GNU General Public License v2.0
349 stars 38 forks source link

Getting syntax error #26

Closed 0dayCTF closed 4 years ago

0dayCTF commented 4 years ago

I updated my Kali and Stegoveritas stopped working, I tried running it with python2/3 - Any suggestions?

Traceback (most recent call last): File "/usr/local/bin/stegoveritas", line 5, in <module> from stegoveritas.stegoveritas import main File "/usr/local/lib/python2.7/dist-packages/stegoveritas/__init__.py", line 2, in <module> from .stegoveritas import StegoVeritas File "/usr/local/lib/python2.7/dist-packages/stegoveritas/stegoveritas.py", line 213 def file_name(self) -> str: ^ SyntaxError: invalid syntax

bannsec commented 4 years ago

So that example run is python2, which I don't believe will run. Can you verify your python version is 3.5+?

0dayCTF commented 4 years ago

Yes, but I've also tried with Python3 and had a similar issue. @bannsec

bannsec commented 4 years ago

Is there a different error? The error you posted is basically python2 complaining about not understanding type hints.

Please show me the output of the following

apt-get update && apt-get install -y python3-venv python3-wheel
python3 -m venv ~/stego
source ~/stego/bin/activate
pip install stegoVeritas
python --version
stegoVeritas -h
0dayCTF commented 4 years ago

image @bannsec

0dayCTF commented 4 years ago

Also tried this @bannsec image

bannsec commented 4 years ago

Looks like apt's install of wheel isn't getting setup correctly. This should work:

apt-get update && apt-get install -y python3-venv python3-pip
python3 -m venv ~/stego
source ~/stego/bin/activate
pip install wheel
pip install stegoVeritas
python --version
stegoVeritas -h

Yep -- it cannot be run directly. It's setup to run as a package.

0dayCTF commented 4 years ago

Same error! image

I am super confused by this, I use your tool all the time. I didn't change anything, so I'm assuming others will have this problem.

bannsec commented 4 years ago

So bdist_wheel is a build command. In your output, I'm seeing "Requirement already satisfied", which means python already built (even though it failed) previously. This means that the wheel command was never called, due to you already having previously attempted to build.

Did you rm -rf ~/stego first and then re-create that virtual env?

My gut feeling here is that on the first install of stegoVeritas on your updated kali, you probably ended up using pip2 (either knowingly or otherwise) instead of pip3.

0dayCTF commented 4 years ago

It is case sensitive, you had a capital "V", I never had to run stegoveritas from a venv. How would you suggest I fix this? I appreciate the help.

image @bannsec

bannsec commented 4 years ago

Nice catch. I can add another alias if that would make it easier (i.e.: alias stegoVeritas->stegoveritas). I honestly don't think about it when I type lol.

0dayCTF commented 4 years ago

@bannsec haha, It's up to you! The way I used it prior, was as easy as typing stegoveritas file.jpg, without any virtual environments. I'd love to know what was broken, so I don't have to go through that process anytime I want to use the tool :(

bannsec commented 4 years ago

As far as i'm aware nothing is broken. My unit tests for kali still function properly. The only thing installing it to a virtualenv does is just tries to separate the libraries from the rest of your env and it's definitely not a requirement.

I just manually installed it on a bare kalilinux-rolling docker release and it installs just fine without a virtualenv.

0dayCTF commented 4 years ago

@bannsec Okay, I'll keep digging. Thank you

bannsec commented 4 years ago

np. wish i knew what was going on with your setup. For reference, here's what I did as a base test for kali:

sudo docker run -it --rm kalilinux/kali-rolling

Then inside the container

apt update && apt install python3 python3-pip
pip3 install stegoveritas
stegoveritas -h
0dayCTF commented 4 years ago

@bannsec I fixed it with

python3 -m pip install stegoveritas

So strange!

bannsec commented 4 years ago

Did you originally install as pip install? If so, your pip is probably for python2. You can check with

pip --version
0dayCTF commented 4 years ago

Yes, but I've been using StegoVeritas for at least 6 months with no issues. My pip installation is python2.7, so for newer installations I use pip3. I'm sure i'll have to figure out the actual problem soon. We'll see!

bannsec commented 4 years ago

Closing this issue for now. If you can give me steps to reproduce (inside kali docker would be easiest), then plz reopen.