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
167 stars 90 forks source link

'Gmp' object has no attribute 'types' #534

Closed Anurag0987 closed 3 years ago

Anurag0987 commented 3 years ago

Expected behavior

Hi everyone, I wanted to run the start-alert-scan.gmp.py script but facing some error. I tried my best to solve the error but couldn't, I was able to run other scripts without any issues like creating tasks, report generation etc.... But this particular script gives me the error: 'Gmp' object has no attribute 'types'. Below I have mentioned all my tools versions that I am currently using.

I am new to the OpenVAS/gvm, please kindly apologize if I make any mistake or misuse any terminology.
I really hope to get some help here, Thanks in advance.


Current behavior

I get error at this point

from typing import List
from argparse import ArgumentParser, Namespace, RawTextHelpFormatter
from gvm.protocols.gmp import Gmp
.
.
 if len(alert) == 0:
        print(f"creating new alert {alert_name}")
        gmp.create_alert(
            name=alert_name,
------->            event=gmp.types.AlertEvent.TASK_RUN_STATUS_CHANGED,     <-------
            event_data={"status": "Done"},
            condition=gmp.types.AlertCondition.ALWAYS,
            method=gmp.types.AlertMethod.EMAIL,
            method_data={
                """Task '$n': $e

I didn't find any solution regarding this on google or in the issue tab.


Steps to reproduce

  1. I have installed the gvm-tools and python-gvm as mentioned in the github page.
  2. I tried executing this code start-alert-scan.gmp.py.
  3. I have used the gvm-script cmd to run the script as I did to other scripts. here is my cmd : gvm-script --gmp-username {username} --gmp-password {password} socket --socketpath /opt/gvm/var/run/gvmd.sock start-alert-scan.gmp.py ++hosts {Host IP} ++target-name {name_of_the_target} ++port-list-id {port_list_id} +R {receivers_email} +S {senders_email}
  4. And then I get the error : 'Gmp' object has no attribute 'types'

output:

New target 'name_of_the_target' created.
creating new alert {email_address}
'Gmp' object has no attribute 'types'

GVM versions

gsa: (gsad --version) Greenbone Security Assistant 21.4.1~dev1

gvm: (gvmd --version) Greenbone Vulnerability Manager 21.4.2~git-09bdb532f-HEAD

openvas-scanner: (openvassd --version) OpenVAS 21.4.1~git-81c6a4e8-HEAD

gvm-libs: gvm-libs 21.4.1~git-f10b1be1-HEAD

gvm-tools: (gvm-cli --version) gvm-cli 21.6.1 (API version 21.6.0)

Environment

Operating system: Ubuntu 20.04.3 LTS - VM 64-bit

Installation method / source: (packages, source installation) I have installed gvm from this page https://github.com/yu210148/gvm_install

I once again apologize if I make any mistake as this is my first ever post on GitHub, I really appreciate if I could get any help, Thanks in Advance.

Anurag0987 commented 3 years ago

Hi @y0urself, thanks for noticing my issue. May I ask if this can be solved in quick time?

y0urself commented 3 years ago

@Anurag0987 yes I think so.