mpicard / pyvas

OpenVAS Management Protocol Client for Python
MIT License
23 stars 10 forks source link

Usage doesn't work #2

Closed p420lch3 closed 7 years ago

p420lch3 commented 7 years ago

from pyvas import client with client(hostname, username='username', password='password') as cli: r = cli.list_tasks() r.ok

TypeError: 'module' object is not callable

It should be :

from pyvas import *__ with Client**(hostname, username='username', password='password') as cli:

OR:

import pyvas with pyvas.Client("127.0.0.1", username='admin', password='123123') as cli:

mpicard commented 7 years ago

Thanks, fixed!

On Thu, 10 Aug 2017 at 04:31 p420lch3 notifications@github.com wrote:

from pyvas import client with client(hostname, username='username', password='password') as cli: r = cli.list_tasks() r.ok

TypeError: 'module' object is not callable

It should be :

from pyvas import ** with Client*(hostname, username='username', password='password') as cli:

OR:

import pyvas with pyvas.Client("127.0.0.1", username='admin', password='123123') as cli:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mpicard/pyvas/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/AHHYRnXakycolZIQJzRjBV_V0mqXfpz9ks5sWnmkgaJpZM4Oy5nk .

mpicard commented 7 years ago

Do you use this library? I'd be curious to know if there's anything missing, I don't have the full protocol implemented but I was going to eventually do some transformation of the spec into generic pythonic interfaces when I had the time.

p420lch3 commented 7 years ago

I would like to use this library to build auto scanning program. Can you provide some examples to create scanning task.

mpicard commented 7 years ago

You can look at the tests for examples, basically you need to create or get a config, get or create a target then create a task with the target and the config, usually there is a "default" config when you install OpenVAS, I always use that one. Then start/stop/resume the task. Then you can get the task results and reports, etc, perhaps download it using client.download_report(uuid=report_id, format_uuid=report_format_id)

config = client.create_config(name='name')
target = client.create_target(name='', hosts='0.0.0.0,127.0.1.1')
task = client.create_task(name='task', target_uuid=["@id"], config_uuid=config["@id"]) 
resp = client.start_task(uuid=task["@id"])
assert resp.ok
print(resp)

https://github.com/mpicard/pyvas/blob/master/tests/test_client.py