Put tables into an array.

git-svn-id: file:///home/svn/framework3/trunk@14178 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
Matt Weeks 2011-11-07 01:54:24 +00:00
parent b1bb0ae729
commit 0b4996a38c
3 changed files with 9 additions and 10 deletions

Binary file not shown.

View File

@ -39,6 +39,7 @@ public class MainFrame extends FrameView {
private JPopupMenu jobPopupMenu, shellPopupMenu, meterpreterPopupMenu, sessionPopupMenu;
private String clickedJob;
public Map[] selectedSessions;
private MsfTable[] tables;
private SearchWindow searchWin;
private javax.swing.JTable eventsTable;
private javax.swing.JScrollPane eventsPane;
@ -147,6 +148,9 @@ public class MainFrame extends FrameView {
}
}
MsfFrame.updateSizes(getFrame());
this.tables = new MsfTable[]{(MsfTable)eventsTable, (MsfTable)hostsTable,
(MsfTable)clientsTable, (MsfTable)servicesTable, (MsfTable)vulnsTable,
(MsfTable)notesTable, (MsfTable)lootsTable, (MsfTable)credsTable};
// Setup table autoquery code
((MsfTable)eventsTable).addAutoAdjuster(eventsPane);
((MsfTable)hostsTable).addAutoAdjuster(hostsPane);
@ -1321,14 +1325,10 @@ nameloop: for (int i = 0; i < names.length; i++) {
}
try { //Now load data out of current workspace
MsfguiApp.workspace = ((Map) rpcConn.execute("db.current_workspace")).get("workspace").toString();
((MsfTable)eventsTable).reAddQuery(all, 0);
((MsfTable)lootsTable).reAddQuery(all, 0);
((MsfTable)hostsTable).reAddQuery(all, 0);
((MsfTable)clientsTable).reAddQuery(all, 0);
((MsfTable)servicesTable).reAddQuery(all, 0);
((MsfTable)vulnsTable).reAddQuery(all, 0);
((MsfTable)notesTable).reAddQuery(all, 0);
((MsfTable)credsTable).reAddQuery(all, 0);
for(MsfTable table : tables){
table.rpcConn = rpcConn;
table.reAddQuery(all, 0);
}
} catch (MsfException mex) {
if(!mex.getMessage().equals("database not loaded"))
mex.printStackTrace();

View File

@ -25,7 +25,7 @@ import javax.swing.table.DefaultTableModel;
public class MsfTable extends javax.swing.JTable {
private final String[] dbNames;
private final String dbTable;
private final RpcConnection rpcConn;
public RpcConnection rpcConn;
/**
* Default constructor just takes column names
* @param colnames The names of the columns in the table
@ -121,7 +121,6 @@ public class MsfTable extends javax.swing.JTable {
row[i] = new java.util.Date(Long.parseLong(row[i].toString()) * 1000);
}catch(NumberFormatException nfex){
//don't do anything
}
}
mod.addRow(row);