Send-schedules.gmp.py works but no schedule created in GSA

Hello all,

I am trying to use the script send-schedules.gmp.py from the gvm-tools. I run the command and get the correct output on the command line saying ‘Schedule(s) created!’, but when I log in on the GSA to see if it was created, I can not see the desired schedule. The input XML-File looks like this:

<?xml version="1.0"?>

<create_schedule>
<name>First Schedule</name>
<timezone>Europe/Berlin</timezone>
<icalendar>
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//ICalendarCreator//NONSGML//EN
BEGIN:VEVENT
DTSTART:20220408T153000
DTEND:20220408T160000
RRULE:FREQ=DAILY;INTERVAL=1
SUMMARY:Subnet 192.168.10.
LOCATION:Hamburg
DESCRIPTION:Schedule for Scan of Subnet 192.8.10.
END:VEVENT
END:VCALENDAR
</icalendar>
</create_schedule>

Maybe the XML-File was created wrong? I used https://icalendar-creator.herokuapp.com/ to create a simple icalendar file of which I just copied the content into the <icalendar> parameter of the XML file. Any help would be appreciated.

Hi @Don :slight_smile:

I’m bumping this to see if anyone has insight.

Hi @DeeAnn ,

thank you :slight_smile: any insights until now?

Hi @Don,

It doesn’t look like it so far (meaning, no one else has jumped in) :slight_smile:

Hi again,

I have solved it by writing my own parser. While debugging the execution, I noticed, that the debugger did not jump into the parse_send_xml_tree(gmp: Gmp, xml_tree: Element) function and so did not return anything (no error, no output…). I think the problem is, that the create_xml_tree(xml_doc) function returns an instance of Element and not ElementTree, so the parse could not actually traverse the tree and read out the values of the XML-Tags. If anyone else has the same issue I will provide my code below:

from lxml import etree
import sys
import xml.etree.ElementTree as ET
from gvm.protocols.latest import Gmp
from argparse import Namespace


def create_xml_tree(gmp, xml_doc):

    xml_tree = ET.parse(xml_doc)
    tree_root = xml_tree.getroot()
    global name, comment, timezone, icalendar


    for child in tree_root.findall("./name"):
        name = child.text

    for child in tree_root.findall("./comment"):
        comment = child.text

    for child in tree_root.findall("./timezone"):
        timezone = child.text

    for child in tree_root.findall("./icalendar"):
        icalendar = child.text

    gmp.create_schedule(name=name, comment=comment, timezone=timezone, icalendar=icalendar)

def main(gmp, args):

    xml_doc = args.script[1]
    print("\n Sending schedule...")
    create_xml_tree(gmp, xml_doc)
    print("\n Schedule created! \n")


if __name__ == "__gmp__":
   main(gmp, args)

1 Like