public async Task <OmpVersion> GetOmpVersion()
        {
            var result = await Omp.QueryAsync <Responses.get_version_response>(this.Address, new Requests.get_version());

            return(new OmpVersion {
                Version = result?.version?.FirstOrDefault().ToString()
            });
        }
        public async Task <GetReportsResponse> GetReports(GetReportsRequest request)
        {
            var @params = new Requests.get_reports();

            if (null != request)
            {
                CopyPropertiesFrom(@params, request);
            }
            var result = await Omp.QueryAsync <Responses.get_reports_response>(this.Address, @params);

            return(result?.Beautify());
        }
Beispiel #3
0
        public async Task <GenericResponse> StartTask(string taskId)
        {
            if (String.IsNullOrEmpty(taskId))
            {
                throw new ArgumentNullException(nameof(taskId));
            }

            var result = await Omp.QueryAsync <Responses.start_task_response>(this.Address, new Requests.start_task {
                TaskId = taskId
            });

            return(Generic(result));
        }
Beispiel #4
0
        public async Task <CreateCommandResponse> CreateTask(CreateTaskRequest request)
        {
            var @params = new Requests.create_task();

            if (null != request)
            {
                CopyPropertiesFrom(@params, request);
            }

            var result = await Omp.QueryAsync <Responses.create_task_response>(this.Address, @params);

            return(CreateCommand(result));
        }
Beispiel #5
0
        public async Task <GenericResponse> DeleteTarget(DeleteTargetRequest request)
        {
            var @params = new Requests.delete_target();

            if (null != request)
            {
                CopyPropertiesFrom(@params, request);
            }

            var result = await Omp.QueryAsync <Responses.delete_target_response>(this.Address, @params);

            return(Generic(result));
        }
Beispiel #6
0
        public async Task <GenericResponse> Sync(OpenvasSyncType syncType)
        {
            Responses.Response ret = null;
            if (syncType.HasFlag(OpenvasSyncType.SyncCert))
            {
                ret = await Omp.QueryAsync <Responses.sync_cert_response>(this.Address, new Requests.sync_cert());
            }
            if (syncType.HasFlag(OpenvasSyncType.SyncFeed))
            {
                ret = await Omp.QueryAsync <Responses.sync_feed_response>(this.Address, new Requests.sync_feed());
            }
            if (syncType.HasFlag(OpenvasSyncType.SyncScap))
            {
                ret = await Omp.QueryAsync <Responses.sync_scap_response>(this.Address, new Requests.sync_scap());
            }

            return(Generic(ret));
        }
        public async Task <GetNvtFamiliesResponse> GetNvtFamilies()
        {
            var result = await Omp.QueryAsync <Responses.get_nvt_families_response>(this.Address, new Requests.get_nvt_families());

            return(result?.Beautify());
        }
        public async Task <GetConfigResponse> GetConfig()
        {
            var result = await Omp.QueryAsync <Responses.get_configs_response>(this.Address, new Requests.get_configs());

            return(result?.Beautify());
        }
        public async Task <GetCredentialResponse> GetCredential()
        {
            var result = await Omp.QueryAsync <Responses.get_credentials_response>(this.Address, new Requests.get_credentials());

            return(result?.Beautify());
        }