Package org.parosproxy.paros.core.scanner

Examples of org.parosproxy.paros.core.scanner.Alert


      btnOk.setPreferredSize(new java.awt.Dimension(75,30));
      btnOk.setMaximumSize(new java.awt.Dimension(100,40));
      btnOk.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent e) {
          Alert alert = alertViewPanel.getAlert();
          try {
            if (alert.getAlertId() >= 0) {
              // Its an existing alert so save it
                if (extScan == null) {
                extScan = (ExtensionScanner) Control.getSingleton().getExtensionLoader().getExtension("ExtensionScanner");
                }
              extScan.updateAlertInDB(alert);
View Full Code Here


          extHist.getHistoryList().notifyItemChanged(hRef);
        }
      }
      break;
    case ALERT:
          Alert alert = scanner.getAlert(msg);
      if (hRef != null) {
        // If the hRef has been created before msg gets updated then
        // the alerts wont have been stored in the db, so double check
        // and add in if missing
        // TODO of course this wont help if the href doesnt exist...
        alert.setSourceHistoryId(hRef.getHistoryId());
        hRef.addAlert(alert);
        extHist.getHistoryList().notifyItemChanged(hRef);
      }
        // Raise the alert
      extScan.alertFound(alert);
View Full Code Here

    build(history.getSessionId(), history.getHistoryId(), history.getHistoryType(), msg);
   
    // ZAP: Support for loading the alerts from the db
    List<RecordAlert> alerts = staticTableAlert.getAlertsBySourceHistoryId(historyId);
    for (RecordAlert alert: alerts) {
      this.addAlert(new Alert(alert, this));
    }
  }
View Full Code Here

      this.addTag(tag);
    }
    // ZAP: Support for loading the alerts from the db
    List<RecordAlert> alerts = staticTableAlert.getAlertsBySourceHistoryId(historyId);
    for (RecordAlert alert: alerts) {
      this.addAlert(new Alert(alert, this));
    }
  }
View Full Code Here

      psAlert.setInt(1, recordScan.getScanId());
      psAlert.executeQuery();
      ResultSet rs = psAlert.getResultSet();

      RecordAlert recordAlert = null;
      Alert alert = null;
      Alert lastAlert = null;

      StringBuffer sbURLs = new StringBuffer(100);
      String s = null;

      // get each alert from table
      while (rs.next()) {
        int alertId = rs.getInt(1);
        recordAlert = db.getTableAlert().read(alertId);
        alert = new Alert(recordAlert);

        // ZAP: Ignore false positives
                if (alert.getReliability() == Alert.FALSE_POSITIVE) {
                  continue;
                }

                if (lastAlert != null &&
                    (alert.getPluginId() != lastAlert.getPluginId() ||
                        alert.getRisk() != lastAlert.getRisk())) {
                    s = lastAlert.toPluginXML(sbURLs.toString());
                    sb.append(s);
                    sbURLs.setLength(0);
                }

        s = alert.getUrlParamXML();
        sbURLs.append(s);

        lastAlert = alert;

      }

      if (lastAlert != null) {
        sb.append(lastAlert.toPluginXML(sbURLs.toString()));
      }

    } catch (SQLException e) {
      e.printStackTrace();
    } finally {
View Full Code Here

    }
  }

  public Alert getAlert() {
    if (! editable && originalAlert != null) {
      Alert alert = originalAlert.newInstance();
      alert.setAlertId(originalAlert.getAlertId());
      alert.setAlert((String)alertEditName.getSelectedItem());
      alert.setParam((String)alertEditParam.getSelectedItem());
      alert.setRiskReliability(alertEditRisk.getSelectedIndex(), alertEditReliability.getSelectedIndex());
      alert.setDescription(alertDescription.getText());
      alert.setOtherInfo(alertOtherInfo.getText());
      alert.setSolution(alertSolution.getText());
      alert.setReference(alertReference.getText());
      alert.setHistoryRef(historyRef);
      return alert;
    } else {
      Alert alert = new Alert(-1, alertEditRisk.getSelectedIndex(),
          alertEditReliability.getSelectedIndex(), (String) alertEditName.getSelectedItem());
      alert.setHistoryRef(historyRef);
      if (originalAlert != null) {
        alert.setAlertId(originalAlert.getAlertId());
      }
     
      String uri = null;
      HttpMessage msg = null;
      if (historyRef != null) {
        try {
          uri = historyRef.getHttpMessage().getRequestHeader().getURI().toString();
          msg = historyRef.getHttpMessage();
        } catch (Exception e) {
          e.printStackTrace();
        }
      } else if (originalAlert != null) {
        uri = originalAlert.getUri();
        msg = originalAlert.getMessage();
      }
      alert.setDetail(alertDescription.getText(),
          uri,
          (String)alertEditParam.getSelectedItem(),
          alertOtherInfo.getText(),
          alertSolution.getText(),
          alertReference.getText(),
View Full Code Here

              // ZAP: Its a double click - edit the alert
              DefaultMutableTreeNode node = (DefaultMutableTreeNode) treeAlert.getLastSelectedPathComponent();
              if (node != null && node.getUserObject() != null) {
                  Object obj = node.getUserObject();
                  if (obj instanceof Alert) {
                      Alert alert = (Alert) obj;
                  setMessage(alert.getMessage());
                  // ZAP: Display in right panel too
                  getAlertViewPanel().displayAlert(alert);
                  } else {
                  getAlertViewPanel().clearAlert();
                  }
              } else {
                getAlertViewPanel().clearAlert();
              }
            }
        }
      });
      treeAlert.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
        public void valueChanged(javax.swing.event.TreeSelectionEvent e) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) treeAlert.getLastSelectedPathComponent();
            if (node.getUserObject() != null) {
                Object obj = node.getUserObject();
                if (obj instanceof Alert) {
                    Alert alert = (Alert) obj;
                setMessage(alert.getMessage());

                }
            }
        }
      });
View Full Code Here

    Vector<Integer> v = tableAlert.getAlertListBySession(session.getSessionId());

    for (int i = 0; i < v.size(); i++) {
      int alertId = ((Integer) v.get(i)).intValue();
      RecordAlert recAlert = tableAlert.read(alertId);
      Alert alert = new Alert(recAlert);
      addAlertToDisplay(alert);
    }
  }
View Full Code Here

            if (child.getNodeName().equals(nodeName)) {
                if (child.getUserObject() == null) {
                    return null;
                }
               
                Alert tmp = (Alert) child.getUserObject();

                if (tmp.getParam().equals(alert.getParam())) {;
                  return child;
                }
            }
        }
        return null;
View Full Code Here

        }
        AlertNode node = (AlertNode) obj;
        if (node.getUserObject() != null) {
          obj = node.getUserObject();
          if (obj instanceof Alert) {
            Alert alert = (Alert) obj;
            msg = alert.getMessage();
          } else {
            return;
          }
        }
View Full Code Here

TOP

Related Classes of org.parosproxy.paros.core.scanner.Alert

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.