Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maybe something wrong with "example_check_connection.py" #7

Open
d4wner opened this issue Jul 13, 2016 · 6 comments
Open

Maybe something wrong with "example_check_connection.py" #7

d4wner opened this issue Jul 13, 2016 · 6 comments

Comments

@d4wner
Copy link

d4wner commented Jul 13, 2016

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!!!

@d4wner
Copy link
Author

d4wner commented Jul 17, 2016

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.

@cr0hn
Copy link
Member

cr0hn commented Jul 17, 2016

Hi,

Not yet. Tomorrow I'll try to investigate the issue

@kapoios
Copy link

kapoios commented Jul 27, 2016

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

@d4wner
Copy link
Author

d4wner commented Aug 12, 2016

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!

@kapoios
Copy link

kapoios commented Aug 12, 2016

I ended up creating my own parser in Java, this project is not compatible with OMP 6.0

@WenhaoYu
Copy link

WenhaoYu commented Sep 8, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants