我连接到openvas,并成功运行扫描。但是,如果没有task_id,我无法显示结果。我如何找到task_id?
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_id而不是scan_id。那么如何找到task_id?
from openvas_lib import VulnscanManager, VulnscanException
scanner = VulnscanManager(HOST, USER, PASSWORD, PORT, TIMEOUT)
openvas_results = scanner.get_results(SCAN_ID)
答案 0 :(得分:1)
还有另一个例子,在同一页面上稍早一点:
https://github.com/golismero/openvas_lib#launch-a-simple-scan
基本上,launch_scan方法返回扫描ID和任务ID,作为元组。