Пример #1
0
 private void btnNewActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnNewActionPerformed
   String name = JOptionPane.showInputDialog(null, "Footprint name");
   if (name != null && !name.isEmpty()) {
     int footprintId = DataStore.addFootprint(name);
     if (footprintId != -1) {
       Globals.setCurrentFootprintId(footprintId);
       Globals.setCurrentFootprintName(name);
       ((FootprintModel) tblFootprints.getModel()).reload();
       new StartFootprintInit().setVisible(true);
     }
   }
 } // GEN-LAST:event_btnNewActionPerformed
Пример #2
0
 private void btnCloseActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnCloseActionPerformed
   if (tblFootprints.getSelectedRowCount() == 1) {
     FootprintData fpd =
         ((FootprintData)
             ((FootprintModel) this.tblFootprints.getModel())
                 .valueAt(this.tblFootprints.getSelectedRow()));
     Globals.setCurrentFootprintId(fpd.getId());
     Globals.setCurrentFootprintName(fpd.getName());
     this.setVisible(false);
   } else {
     JOptionPane.showMessageDialog(this, "Please create or select a footprint.");
   }
 } // GEN-LAST:event_btnCloseActionPerformed
Пример #3
0
 private void formWindowClosing(
     java.awt.event.WindowEvent evt) { // GEN-FIRST:event_formWindowClosing
   if (Globals.getCurrentFootprintId() == -1) {
     JOptionPane.showMessageDialog(this, "No footprint selected, Yeti will now terminate.");
     System.exit(0);
   }
 } // GEN-LAST:event_formWindowClosing
Пример #4
0
  public void loadData() {
    DefaultListModel hostModel = new DefaultListModel();
    DefaultListModel portModel = new DefaultListModel();

    if (model != null && tblResults != null) {
      if (tblResults.getSelectedRow() >= 0
          && model.getItemAt(tblResults.getSelectedRow()) != null) {
        List<String> hosts = DataStore.getHostsPerIp(model.getItemAt(tblResults.getSelectedRow()));
        if (hosts != null && !hosts.isEmpty()) {
          for (String host : hosts) {
            hostModel.addElement(host);
          }
        }

        List<com.sensepost.yeti.persistence.entities.Port> ports =
            DataStore.getPortsForIp(
                model.getItemAt(tblResults.getSelectedRow()), Globals.getCurrentFootprintId());
        if (ports != null && !ports.isEmpty()) {
          for (com.sensepost.yeti.persistence.entities.Port p : ports) {
            portModel.addElement(p.getPortNumber());
          }
        }
      }

      lbHosts.setModel(hostModel);
      lbPorts.setModel(portModel);
      lbStats.setText(String.format("%d ips", model.getRowCount()));
    }
  }