Open d4wner opened 8 years ago
Sorry, I wanna to know if the author had seen my issue? I'm a little worried about it,so whether the issue can be solved ,I really expect you to give a response,thanks! Sincerely yours.
Hi,
Not yet. Tomorrow I'll try to investigate the issue
I have this kind of problem as well (type problems) My code straight from the examples:
from threading import Semaphore
from functools import partial
from openvas_lib import *
TARGET = "192.168.1.223"
def my_print_status(i):
print(str(i))
def my_launch_scanner():
sem = Semaphore(0)
# Configure
manager = VulnscanManager("localhost", "admin", "admin")
# Launch
scan_id, target_id = manager.launch_scan(TARGET,
profile = "Full and fast",
callback_end = partial(lambda x: x.release(), sem),
callback_progress = my_print_status)
# Wait
sem.acquire()
# Finished scan
print("finished")
print scan_id
print target_id
openvas_results = manager.get_results(str(scan_id))
def main():
my_launch_scanner()
if __name__ == "__main__":
main()
This has the following result:
python openvas.py
1.0
1.0
20.0
22.0
38.0
54.0
74.0
76.0
92.0
94.0
96.0
98.0
98.0
98.0
finished
6d0d09f0-c73e-4218-b01f-d6596bbf5f05
4af88054-ca5e-412e-8a2d-d30c87ad4d43
100.0
Traceback (most recent call last):
File "openvas.py", line 41, in <module>
File "openvas.py", line 38, in main
File "openvas.py", line 35, in my_launch_scanner
if __name__ == "__main__":
File "/usr/local/lib/python2.7/dist-packages/openvas_lib/__init__.py", line 694, in get_results
return report_parser(m_response)
File "/usr/local/lib/python2.7/dist-packages/openvas_lib/__init__.py", line 121, in report_parser
raise TypeError("Expected str or file, got '%s' instead" % type(path_or_file))
TypeError: Expected str or file, got '<type 'Element'>' instead
I am using Python 2.7.11 with Openvas 8
Well, I guess the arthur may be so busy that he forget the issue...
What a pity~~
But I still hope the arthur will solve the problem someday.
Wish this good project be better in the future!
I ended up creating my own parser in Java, this project is not compatible with OMP 6.0
The report instance actually has the attribute "find ",you can print(dir(report)),but report.find("report").text returns None,it causes the mistake.manager.get_report_html not work well,but get_report_xml seems to be fine
Well, sir , sorry to bother you again, but maybe I got a bug here.
When I use the demo file:
https://github.com/golismero/openvas_lib/blob/master/example_check_connection.py
I can't get my scan report at last, in fact I had seen scan result on the web, actually the target had been listed some vulnerabilities by openvas(web). Then it gave me this error infomation:
must be string or buffer, not None
I checked it, and I found something at function write_report:
report = manager.get_report_html(report_id)
The value report here is not str type , instead it's an element type, so when the script went to:
report.find("report").text
Now it gets error , I think 'element' type may not have "find" attribute? As a result , I can't solve this issue. I had changed some targets , unfortunately I got the same error.
Dear sir, could you give a solution for it, looking forward to your kind reply! Thank you!!!