Open liuyoyi opened 7 years ago
I dig into the code actually report_parser
expecting a file or string as argument, but the get_result
method giving and Element
object. so I comment it out the parse part
and I wrote my own function to parse the result as follow
def parse(res):
output = []
results = res.getchildren()
for result in results:
children = result.getchildren()
obj = {}
for child in children:
obj[child.tag] = child.text
output.append(obj)
return output
I can now call it like this
parse(scanner.get_results(scan_id))
which returns a python list contains all results
I don't know how to fix the original parse function, I believe they will patch it soon :sparkle:
Hello, I would like to know where do you write this code in the __init___.py file ?
Thanks
Sylvain
i'm facing same issue:
File "/Users/openvas-stuffs/lib/python2.7/site-packages/openvas_lib/ompv7.py", line 1099, in get_report_xml raise TypeError("Expected string, got %r instead" % type(report_id)) TypeError: Expected string, got <type 'NoneType'> instead
openvas_results = scanner.get_report_id(scan_id)
print openvas_results
Returns
TypeError: Expected str or file, got '<type 'Element'>' instead
Why??????