示例#1
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()));
    }
  }
示例#2
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
示例#3
0
 private void miDeleteActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_miDeleteActionPerformed
   if (JOptionPane.showConfirmDialog(
           null,
           "Are you sure you want to delete this ip, \nand all it's hosts/subdomains?",
           "Confirmation",
           JOptionPane.YES_NO_OPTION)
       == JOptionPane.YES_OPTION) {
     String ip =
         ((IpModel) tblResults.getModel()).getValueAt(tblResults.getSelectedRow(), 0).toString();
     DataStore.deleteIpFromFootprint(ip);
     model.loadData();
     lbStats.setText(String.format("%d ips", model.getRowCount()));
   }
 } // GEN-LAST:event_miDeleteActionPerformed