i hope this issue has not been written before.
i want to create a target via gvm-cli.
To do so i created a port list, but now i am facing some xml syntax problems.
gvm-cli socket --socketpath /opt/gvm/var/run/gvmd.sock --xml "<create_target><name>Suspect Host</name><hosts>"a.b.c.d"</hosts><port_list id="2c59d819-2a03-4086-9f78-540fac3727b2"></port_list></create_target>"
I simply added the tag <port_list> with the created id to my command.
Can someone give me a hint or some advice?
In addition to a port list i tried to create a port range and add it to my port list with the following command, which i got from https://docs.greenbone.net/API/GMP/gmp-8.0.html#command_create_port_range:
gvm-cli socket --socketpath /opt/gvm/var/run/gvmd.sock --xml "<create_port_range><port_list id="2c59d819-2a03-4086-9f78-540fac3727b2"/><start>1</start><end>1023</end><type>TCP</type></create_port_range>"
It returns me
I dont understand why it is not valid.
You might want to get a regular understanding of bash, command line usage, etc. first?
If you want to pass an xml string within double quotes
"", your string will end if you use double quotes again. You will probably find out, where your string ends and thus why it will result in an invalid string?
You can use single quotes
' or escaped double quotes
\" within your xml string.
Thank you! i really didnt think about the quotes!
Now it works.