Package org.owasp.webscarab.model

Examples of org.owasp.webscarab.model.ConversationID


   
    public void run() {
        _runThread = Thread.currentThread();
        _model.setRunning(true);
        int count = 0;
        ConversationID id = null;
        ConversationModel cmodel = _model.getConversationModel();
        while (!_model.isStopping()) {
            try {
                synchronized(_lock) {
                    _lock.wait();
                }
                if (id != _selected) {
                    id = _selected;
                    _model.setBusy(true);
                    HttpUrl baseUrl = cmodel.getRequestUrl(id);
                    if (baseUrl.getQuery() != null)
                      baseUrl = baseUrl.getParentUrl();
                    Response baseResponse = cmodel.getResponse(id);
                    byte[] baseBytes = baseResponse.getContent();
                    String type = baseResponse.getHeader("Content-Type");
                    if (type == null || !type.startsWith("text")) {
                        _logger.warning("Base response is not text, skipping!");
                        return;
                    }
                    List<String> baseline = tokenize(baseBytes);
                    _diff = new LevenshteinDistance<String>(baseline);
                   
                    count = cmodel.getConversationCount();
                    _logger.info("Checking " + count + " conversaitons");
                    for (int i=0; i<count; i++) {
                        ConversationID cid = cmodel.getConversationAt(i);
                        HttpUrl curl = cmodel.getRequestUrl(cid);
                        if (curl.getQuery() != null)
                          curl = curl.getParentUrl();
                        if (!curl.equals(baseUrl))
                          continue;
                        _logger.info("Checking conversation " + i + " == " + cid);
                        if (cid.equals(id)) {
                            _model.setDistance(cid, 0);
                        } else {
                            Response response = cmodel.getResponse(cid);
                            String ctype = response.getHeader("Content-Type");
                            _logger.info("Content-type is " + ctype);
View Full Code Here


    }//GEN-END:initComponents
   
    private void requestComboBoxActionPerformed(java.awt.event.ActionEvent evt) {
        Object o = requestComboBox.getSelectedItem();
        if (o instanceof ConversationID) {
            ConversationID id = (ConversationID) o;
            Request request = _model.getConversationModel().getRequest(id);
            _manualRequest.setRequest(request);
        }
    }
View Full Code Here

                _logger.info("Selection changed");
                if (e.getValueIsAdjusting()) return;
                int row = conversationTable.getSelectedRow();
                TableModel tm = conversationTable.getModel();
                if (row >-1) {
                    ConversationID id = (ConversationID) tm.getValueAt(row, 0); // UGLY hack! FIXME!!!!
                    _showAction.putValue("CONVERSATION", id);
                    _logger.info("Conversation " + id + " selected");
                } else {
                    _showAction.putValue("CONVERSATION", null);
                }
View Full Code Here

    }//GEN-LAST:event_addHeaderButtonActionPerformed

    private void requestComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_requestComboBoxActionPerformed
        Object o = requestComboBox.getSelectedItem();
        if (o instanceof ConversationID) {
            ConversationID id = (ConversationID) o;
            _fuzzer.loadTemplateFromConversation(id);
        }
    }//GEN-LAST:event_requestComboBoxActionPerformed
View Full Code Here

            _logger.severe("error scheduling analysis task: " + ex.getMessage());
        }
    }
   
    public ConversationID addConversation(Request request, Response response, String origin) {
        ConversationID id = reserveConversationID();
        addConversation(id, new Date(), request, response, origin);
        return id;
    }
View Full Code Here

   
        baseComboBox.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Object o = baseComboBox.getSelectedItem();
                if (o instanceof ConversationID) {
                    ConversationID id = (ConversationID) o;
                    ConversationModel cModel = _model.getConversationModel();
                    Response response = cModel.getResponse(id);
                    String cType = response.getHeader("Content-Type");
                    if (cType == null || !cType.startsWith("text")) {
                        JOptionPane.showMessageDialog(ComparePanel.this, "Selected conversation is not text", "Error", JOptionPane.ERROR_MESSAGE);
                        return;
                    }
                    byte[] content = response.getContent();
                    if (content == null || content.length == 0) {
                        JOptionPane.showMessageDialog(ComparePanel.this, "Selected conversation has no content", "Error", JOptionPane.ERROR_MESSAGE);
                        return;
                    }
                    _compare.setBaseConversation(null, id);
                    _base = new String(content);
                }
            }
        });
       
        conversationTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent evt) {
                int selected = conversationTable.getSelectedRow();
                _diffPanel.clear();
                if (selected == -1) {
                    return;
                }
                selected = _conversationSorter.modelIndex(selected);
                ConversationModel cmodel = _model.getComparisonModel();
               
                ConversationID id = cmodel.getConversationAt(selected);
                Response response = cmodel.getResponse(id);
                String contentType = response.getHeader("Content-Type");
                if (contentType == null || !contentType.startsWith("text")) {
                    JOptionPane.showMessageDialog(ComparePanel.this, "Selected conversation is not text", "Error", JOptionPane.ERROR_MESSAGE);
                    return;
View Full Code Here

    } catch (IOException ioe) {
      _logger.severe("Error getting socket input and output streams! "
          + ioe);
      return;
    }
    ConversationID id = null;
    try {
      Request request = null;
      // if we do not already have a base URL (i.e. we operate as a normal
      // proxy rather than a reverse proxy), check for a CONNECT
      if (_base == null) {
View Full Code Here

            public void valueChanged(ListSelectionEvent e) {
                if (e.getValueIsAdjusting()) return;
                int row = conversationTable.getSelectedRow();
                TableModel tm = conversationTable.getModel();
                if (row >-1) {
                    ConversationID id = (ConversationID) tm.getValueAt(row, 0); // UGLY hack! FIXME!!!!
                    _showAction.putValue("CONVERSATION", id);
                } else {
                    _showAction.putValue("CONVERSATION", null);
                }
            }
View Full Code Here

                if (e.getValueIsAdjusting()) {
                    return;
                }
                int row = WSFederationPanel.this.conversationsTable.getSelectedRow();
                TableModel tm = WSFederationPanel.this.conversationsTable.getModel();
                ConversationID id;
                if (row > -1) {
                    id = (ConversationID) tm.getValueAt(
                            row, 0); // UGLY hack! FIXME!!!!
                    WSFederationPanel.this.display(id);
                } else {
View Full Code Here

   * @param request
   *            the request to log
   * @return the conversation ID
   */
  protected ConversationID gotRequest(Request request) {
    ConversationID id = _framework.reserveConversationID();
    if (_ui != null)
      _ui.requested(id, request.getMethod(), request.getURL());
    _pending++;
    _status = "Started, " + _pending + " in progress";
    return id;
View Full Code Here

TOP

Related Classes of org.owasp.webscarab.model.ConversationID

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.