greenbone / gvm-tools

Remote control your Greenbone Community Edition or Greenbone Enterprise Appliance
https://greenbone.github.io/gvm-tools/
GNU General Public License v3.0
162 stars 89 forks source link

`gvm-cli` raises an exception right while starting with error _invalid syntax_ #142

Closed tps800 closed 5 years ago

tps800 commented 5 years ago

gvm-cli raises an exception right while starting with error invalid syntax

Expected behavior

Starting gvm-cli just starts gvm-cli.

Current behavior

Right while statring gvm-cli gives an exception with error invalid syntax:

# gvm-cli
Traceback (most recent call last):
  File "/usr/local/bin/gvm-cli", line 11, in <module>
    load_entry_point('gvm-tools==2.0.0.dev1', 'console_scripts', 'gvm-cli')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 487, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2728, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2346, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2352, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python2.7/dist-packages/gvm_tools-2.0.0.dev1-py2.7.egg/gmp/clients/cli.py", line 212
    '--socketpath instead', file=sys.stderr)
                                ^
SyntaxError: invalid syntax

Steps to reproduce

  1. Checkupt sources, then configure, compile and install as adviced.
  2. call gvm-cli

GVM versions

gsad:

Greenbone Security Assistant 8.0+beta3
GIT revision 3cd5812d6-master
Copyright (C) 2010-2016 Greenbone Networks GmbH
License GPLv2+: GNU GPL version 2 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

gvmd:

Greenbone Vulnerability Manager 8.0+beta2
GIT revision 8bc90781-master
Manager DB revision 200
Copyright (C) 2010-2017 Greenbone Networks GmbH
License GPLv2+: GNU GPL version 2 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

openvassd:

OpenVAS Scanner 6.0+beta3
GIT revision b1d4ca6-master
Most new code since 2005: (C) 2018 Greenbone Networks GmbH
Nessus origin: (C) 2004 Renaud Deraison <deraison@nessus.org>
License GPLv2: GNU GPL version 2
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

node:

v11.4.0

redis-server:

Redis server v=5.0.2 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=669dbd6bdc6d120c

Environment

Operating system:

Linux gvm10 4.18.0-3-amd64 #1 SMP Debian 4.18.20-2 (2018-11-23) x86_64 GNU/Linux
buster/sid

Installation method / source:

source installation, git checkout
bjoernricks commented 5 years ago

Hi, both python-gvm and gvm-tools require python >= 3.5. We don't support python 2.

tps800 commented 5 years ago

In this case it would be best to change the chbang in all tools requiring python3 from

#!/usr/bin/python

to

#!/usr/bin/env python3

This way python3 would be used as long as it could be found within PATH.

tps800 commented 5 years ago

I've changed the shbang to #!/usr/bin/env python3. Python reports version Python 3.7.2rc1

But:

# gvm-cli
Traceback (most recent call last):
  File "/usr/local/bin/gvm-cli", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3126, in <module>
    @_call_aside
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3110, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3139, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 581, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 898, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 784, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'gvm-tools==2.0.0.dev1' distribution was not found and is required by the application

Something else must be missing too ...

bjoernricks commented 5 years ago

pkg_resources.DistributionNotFound: The 'gvm-tools==2.0.0.dev1' distribution was not found and is required by the application

I guess something is mixed up in your installation. gvm-tools 2.0.0.dev1 is an old version from master branch. Also the package name should be gvmtools nowadays.

bjoernricks commented 5 years ago

Btw. if you are installing from git/github it will be easier for you to use pipenv for installation and handling dependencies. If you are installing from pypi please use pip.