如何在openvas_lib for python中获取任务的标识?

2024-05-16 08:52:37 发布

您现在位置:Python中文网/ 问答频道 /正文

我连接到openvas,成功地运行了扫描。但是,如果没有任务标识,就无法显示结果。如何找到任务标识?在

from threading import Semaphore
from functools import partial

from openvas_lib import VulnscanManager, VulnscanException

def my_print_status(i):
    print str(i)

def my_launch_scanner():

Sem = Semaphore(0)

# Configure
manager = VulnscanManager("localhost", "admin", "admin")

# Launch
manager.launch_scan(target,
                    profile = "empty",
                    callback_end = partial(lambda x: x.release(), sem),
                    callback_progress = my_print_status)

# Wait
Sem.acquire()

# Finished scan
print "finished"

代码来自:https://pypi.python.org/pypi/openvas_lib/1.0。该网站建议使用以下代码;但是,当我使用它时,它显示task not found。我相信它应该使用任务标识而不是扫描标识。那么我如何找到任务标识呢?在

^{pr2}$

Picture of error


Tags: fromimportmylibdefstatusmanagerlaunch