예제 #1
0
  /** Initializes and returns the Packet View Table. */
  private JTable getJPacketViewTable() {
    if (jPacketViewTable == null) {
      jPacketViewTable = new DataTable<PacketInfo>(jPacketViewTableModel);
      jPacketViewTable.setAutoCreateRowSorter(true);
      jPacketViewTable.setGridColor(Color.LIGHT_GRAY);
      jPacketViewTable
          .getSelectionModel()
          .addListSelectionListener(
              new ListSelectionListener() {
                PacketInfo packetInfo;

                @Override
                public synchronized void valueChanged(ListSelectionEvent arg0) {
                  PacketInfo packetInfo = jPacketViewTable.getSelectedItem();
                  if (packetInfo != null && packetInfo != this.packetInfo) {
                    double crossHairValue = packetInfo.getTimeStamp();
                    boolean centerGraph =
                        !(crossHairValue <= graphPanel.getViewportUpperBound()
                            && crossHairValue >= graphPanel.getViewportLowerBound());
                    graphPanel.setGraphView(crossHairValue, centerGraph);
                    getJHttpReqResPanel().select(packetInfo.getRequestResponseInfo());
                    if (aroVideoPlayer != null) {
                      aroVideoPlayer.setMediaDisplayTime(graphPanel.getCrosshair());
                    }
                  }
                  this.packetInfo = packetInfo;
                }
              });
    }
    return jPacketViewTable;
  }
예제 #2
0
  /** Method to set the time on graph panel. */
  private synchronized void setTimeLineLinkedComponents(
      double timeStamp, double dTimeRangeInterval) {

    if (analysisData != null) {
      boolean bTCPTimeStampFound = false;
      boolean bExactMatch = false;

      // Do exact match of dTimeInterval == 0.0;
      // If dTimeInterval < 0.0, don't try to match up with the TCP_Flow
      // or packets when click comes from graph or video
      if (dTimeRangeInterval == 0.0) {
        bExactMatch = true;
      } else if (dTimeRangeInterval < 0.0) {
        repaint();
        return;
      }

      // Attempt to find corresponding packet for time.
      double packetTimeStamp = 0.0;
      double packetTimeStampDiff = 0.0;
      double previousPacketTimeStampDiff = 9999.0;
      TCPSession bestMatchingTcpSession = null;
      PacketInfo bestMatchingPacketInfo = null;
      for (TCPSession tcpSess : analysisData.getTcpSessions()) {
        PacketInfo packetInfo =
            getBestMatchingPacketInTcpSession(tcpSess, bExactMatch, timeStamp, dTimeRangeInterval);
        if (packetInfo != null) {
          packetTimeStamp = packetInfo.getTimeStamp();
          packetTimeStampDiff = timeStamp - packetTimeStamp;
          if (packetTimeStampDiff < 0.0) {
            packetTimeStampDiff *= -1.0;
          }
          if (packetTimeStampDiff < previousPacketTimeStampDiff) {
            bestMatchingTcpSession = tcpSess;
            bestMatchingPacketInfo = packetInfo;
            bTCPTimeStampFound = true;
          }
        }
      }

      if (bTCPTimeStampFound) {
        getJTCPFlowsTable().selectItem(bestMatchingTcpSession);
        jPacketViewTable.selectItem(bestMatchingPacketInfo);
        jPacketViewTable.setGridColor(Color.LIGHT_GRAY);
        if (bestMatchingPacketInfo != null) {
          jHttpReqResPanel.select(bestMatchingPacketInfo.getRequestResponseInfo());
        } else {
          jHttpReqResPanel.select(null);
        }
      } else {
        getJTCPFlowsTable().selectItem(null);
        jPacketViewTable.selectItem(null);
        jHttpReqResPanel.select(null);
        if (aroVideoPlayer != null) {
          aroVideoPlayer.setMediaDisplayTime(graphPanel.getCrosshair());
        }
      }
    }
  }
  /**
   * Initializes and returns the the DataTable that contains Http request and response informations.
   */
  private DataTable<HttpRequestResponseInfo> getJRequestResponseTable() {
    if (jRequestResponseTable == null) {
      jRequestResponseTable = new DataTable<HttpRequestResponseInfo>(jRequestResponseTableModel);
      jRequestResponseTable.setAutoCreateRowSorter(true);
      jRequestResponseTable.setGridColor(Color.LIGHT_GRAY);
      jRequestResponseTable
          .getSelectionModel()
          .addListSelectionListener(
              new ListSelectionListener() {

                @Override
                public void valueChanged(ListSelectionEvent e) {
                  // Enable view and save as buttons appropriately
                  HttpRequestResponseInfo httpRRInfo = jRequestResponseTable.getSelectedItem();
                  boolean enabled =
                      httpRRInfo != null
                          && httpRRInfo.getContentLength() > 0
                          && httpRRInfo.getDirection() == Direction.RESPONSE
                          && httpRRInfo.getStatusCode() != 0;
                  getViewBtn().setEnabled(enabled);
                  getSaveBtn().setEnabled(enabled);
                }
              });
      jRequestResponseTable.addMouseListener(
          new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
              if (e.getClickCount() == 2 && getViewBtn().isEnabled()) {
                try {
                  viewContent(jRequestResponseTable.getSelectedItem());
                } catch (IOException ex) {
                  MessageDialogFactory.showUnexpectedExceptionDialog(
                      RequestResponseDetailsPanel.this.getTopLevelAncestor(), ex);
                }
              }
            }
          });
    }
    return jRequestResponseTable;
  }
예제 #4
0
  /** Initializes and returns the Scroll Pane for the TCP flows table. */
  private DataTable<TCPSession> getJTCPFlowsTable() {
    if (jTCPFlowsTable == null) {
      jTCPFlowsTable = new DataTable<TCPSession>(jTCPFlowsTableModel);
      jTCPFlowsTable.setAutoCreateRowSorter(true);
      jTCPFlowsTable.setGridColor(Color.LIGHT_GRAY);
      jTCPFlowsTable
          .getSelectionModel()
          .addListSelectionListener(
              new ListSelectionListener() {
                private TCPSession tcp;

                @Override
                public synchronized void valueChanged(ListSelectionEvent arg0) {
                  TCPSession tcp = jTCPFlowsTable.getSelectedItem();
                  if (tcp != this.tcp) {
                    if (tcp != null) {
                      jPacketViewTableModel.setData(tcp.getPackets());
                      jPacketViewTable.setGridColor(Color.LIGHT_GRAY);
                      if (!tcp.getPackets().isEmpty()) {
                        jPacketViewTable.getSelectionModel().setSelectionInterval(0, 0);
                      }
                      if (jTCPFlowsContentTabbedPane.getSelectedComponent()
                          == getJContentViewScrollPane()) {
                        jContentTextArea.setText(tcp.getDataText());
                      }
                      jContentTextArea.setCaretPosition(0);
                      getJHttpReqResPanel().setData(tcp.getRequestResponseInfo());
                    } else {
                      jPacketViewTableModel.removeAllRows();
                      getJHttpReqResPanel().setData(null);
                      jContentTextArea.setText(null);
                    }
                    this.tcp = tcp;
                  }
                }
              });
    }
    return jTCPFlowsTable;
  }
 /**
  * Convenience method to select the specified row in the table.
  *
  * @param rrInfo An HttpRequestResponseInfo object that indicates the specified row.
  */
 public void select(HttpRequestResponseInfo rrInfo) {
   jRequestResponseTable.selectItem(rrInfo);
 }