Example #1
0
 /// <summary>
 /// Sets the alert threshold of a specific passive scanner.
 /// </summary>
 /// <param name="id">The ID of the passive scanner.</param>
 /// <param name="alertThreshold">The alert threshold.</param>
 public void SetScannerAlertThreshold(int id, AlertThreshold alertThreshold)
 {
     CallAction("setScannerAlertThreshold", new Parameters
     {
         { "id", id },
         { "alertThreshold", alertThreshold }
     });
 }
Example #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            AlertThreshold alertThreshold = db.AlertThresholds.Find(id);

            db.AlertThresholds.Remove(alertThreshold);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #3
0
        /// <summary>
        /// Sets the alert threshold of the passive scanner with the given ID, accepted values for alert threshold: OFF, DEFAULT, LOW, MEDIUM and HIGH
        /// </summary>
        /// <param name="apikey">The api key for the Zap-server</param>
        /// <param name="id">ID of the passive scanner</param>
        /// <param name="alertThreshold">Accepted values for alert threshold: OFF, DEFAULT, LOW, MEDIUM and HIGH</param>
        /// <returns>Result of the action</returns>
        public IApiResult SetScannerAlertThreshold(string apikey, string id, AlertThreshold alertThreshold)
        {
            var parameters = ApikeyHelper.ReturnParameterDictFromApikey(apikey);

            parameters.Add("id", id);
            parameters.Add("alertThreshold", alertThreshold.ToString());
            return(_zapClient.CallApi(Component, ActionTypes.Action, "setScannerAlertThreshold", parameters));
        }
 /// <summary>
 /// Sets the alert threshold for a specific scanner. Optionally filtered by a scan policy.
 /// </summary>
 /// <param name="scannerId">The ID of the scanner.</param>
 /// <param name="alertThreshold">The alert threshold.</param>
 /// <param name="scanPolicyName">Optional scan policy name.</param>
 public void SetScannerAlertThreshold(int scannerId, AlertThreshold alertThreshold, string scanPolicyName = null)
 {
     CallAction("setScannerAlertThreshold", new Parameters
     {
         { "id", scannerId },
         { "alertThreshold", alertThreshold },
         { "scanPolicyName", scanPolicyName }
     });
 }
Example #5
0
 public ActionResult Edit([Bind(Include = "Id,PercentDowntimeThreshold,AditionalAlertNotes")] AlertThreshold alertThreshold)
 {
     if (ModelState.IsValid)
     {
         db.Entry(alertThreshold).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(alertThreshold));
 }
Example #6
0
        public ActionResult Create([Bind(Include = "Id,PercentDowntimeThreshold,AditionalAlertNotes")] AlertThreshold alertThreshold)
        {
            if (ModelState.IsValid)
            {
                db.AlertThresholds.Add(alertThreshold);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(alertThreshold));
        }
Example #7
0
        // GET: AlertThresholds/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AlertThreshold alertThreshold = db.AlertThresholds.Find(id);

            if (alertThreshold == null)
            {
                return(HttpNotFound());
            }
            return(View(alertThreshold));
        }
        private void SetRegistrySettings()
        {
            try
            {
                RegistryKey currentUserKey = Registry.CurrentUser;
                RegistryKey petKey         = currentUserKey.CreateSubKey(LocalSettingsSubKey);

                petKey.SetValue("TimerInterval", TimerInterval.ToString());
                petKey.SetValue("WarnInterval", WarnInterval.ToString());
                petKey.SetValue("WarnThreshold", WarnThreshold.ToString());
                petKey.SetValue("AlertInterval", AlertInterval.ToString());
                petKey.SetValue("AlertThreshold", AlertThreshold.ToString());
                petKey.SetValue("Action", Action);

                petKey.Close();
                currentUserKey.Close();
            }
            catch (Exception)
            {
                throw;
            }
        }
        public void SetScannerAlertThreshold(
            [Frozen] Mock <IHttpClient> httpClientMock,
            [Greedy] PassiveScannerComponent sut,
            int id,
            AlertThreshold alertThreshold)
        {
            // ARRANGE
            httpClientMock.SetupApiCall(sut, CallType.Action, "setScannerAlertThreshold",
                                        new Parameters
            {
                { "id", id },
                { "alertThreshold", alertThreshold }
            })
            .ReturnsOkResult()
            .Verifiable();

            // ACT
            sut.SetScannerAlertThreshold(id, alertThreshold);

            // ASSERT
            httpClientMock.Verify();
        }
        public void SetScannerAlertThreshold(
            [Frozen] Mock <IHttpClient> httpClientMock,
            [Greedy] ActiveScannerComponent sut,
            int scannerId,
            AlertThreshold alertThreshold,
            string scanPolicyName)
        {
            // ARRANGE
            httpClientMock.SetupApiCall(sut, CallType.Action, "setScannerAlertThreshold",
                                        new Parameters
            {
                { "id", scannerId },
                { "alertThreshold", alertThreshold },
                { "scanPolicyName", scanPolicyName }
            })
            .ReturnsOkResult()
            .Verifiable();

            // ACT
            sut.SetScannerAlertThreshold(scannerId, alertThreshold, scanPolicyName);

            // ASSERT
            httpClientMock.Verify();
        }
Example #11
0
 private string GenerateMessage(Server server, Alert alert, AlertThreshold thresHold)
 {
     return(string.Format("{0} - {1} - {2} - {3}", server.Name, alert.Alias.PadRight(7), alert.Dataset, thresHold.Level));
 }