Example #1
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
Example #2
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()));
    }
  }