Example #1
0
def get_last_reports(instance, processed_reports):
    with Client(
            instance['host'],
            username=instance['username'],
            password=instance['password'],
            port=instance['port']
    ) as cli:
        return get_report_from_task(cli.list_tasks().data, processed_reports)
Example #2
0
def download_report_as_csv(report_id, instance):
    with Client(
            instance['host'],
            username=instance['username'],
            password=instance['password'],
            port=instance['port']
    ) as cli:
        return cli.download_report(
            report_id,
            format_uuid=instance['format_uuid']
        )
Example #3
0
def test_client_authenticate():
    client = Client(HOST)
    client.socket = None

    response = client.authenticate(username=USERNAME, password=PASSWORD)
    assert response.ok

    client.username = USERNAME
    client.password = PASSWORD
    response = client.authenticate()
    assert response.ok

    with pytest.raises(exceptions.AuthenticationError):
        client.authenticate(username=USERNAME, password="******")
Example #4
0
def client(request):
    with Client(HOST, username=USERNAME, password=PASSWORD) as cli:
        yield cli
Example #5
0
 def open_connection(self, *args, **kwargs):
     if not self.openvasClient:
         self.openvasClient = Client(self.host, self.username, self.password)
     with self.openvasClient:
         result = command(self, *args, **kwargs)
     return result