Prefer autodetect on importing, since other options are deprecated.

git-svn-id: file:///home/svn/framework3/trunk@10290 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Weeks 2010-09-11 16:13:26 +00:00
parent 995b289635
commit 711cf6d9ef
2 changed files with 11 additions and 8 deletions

Binary file not shown.

View File

@ -1219,7 +1219,17 @@ public class MainFrame extends FrameView {
private void importItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importItemActionPerformed private void importItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importItemActionPerformed
try { try {
String type = "data"; Object filetype = JOptionPane.showInputDialog(getFrame(), "Select file type. Autodetect recommended.",
"Type selection", JOptionPane.PLAIN_MESSAGE,null, new Object[]{"Autodetect","Msfe XML",
"Nexpose simpleXML","Nexpose rawXML", "Nmap XML", "Nessuse NBE","Nessus XML", "Nessus XML v2",
"Qualsys XML", "IP list", "Amap log", "Amap mlog"}, onlineHelpMenu);
String type;
if(filetype == null)
return;
else if(filetype.equals("autodetect"))
type = "data";
else
type = filetype.toString().toLowerCase().replaceAll(" ", "_");
HashMap argHash = new HashMap(); HashMap argHash = new HashMap();
if (MsfguiApp.fileChooser.showOpenDialog(getFrame()) == javax.swing.JFileChooser.CANCEL_OPTION) if (MsfguiApp.fileChooser.showOpenDialog(getFrame()) == javax.swing.JFileChooser.CANCEL_OPTION)
return; return;
@ -1228,13 +1238,6 @@ public class MainFrame extends FrameView {
byte[] data = new byte[fsize]; byte[] data = new byte[fsize];
fin.read(data); fin.read(data);
argHash.put("data", Base64.encode(data)); argHash.put("data", Base64.encode(data));
Object res = JOptionPane.showInputDialog(getFrame(), "Select file type", "Type selection", JOptionPane.PLAIN_MESSAGE,
null, new Object[]{"autodetect","msfe xml","nexpose simplexml","nexpose rawxml", "nmap xml", "nessuse nbe",
"nessus xml", "nessus xml v2","qualsys xml", "ip list", "amap log", "amap mlog"}, onlineHelpMenu);
if(res.equals("autodetect"))
type = "data";
else
type = res.toString().replaceAll(" ", "_");
rpcConn.execute("db.import_"+type,argHash); rpcConn.execute("db.import_"+type,argHash);
} catch (MsfException mex) { } catch (MsfException mex) {
JOptionPane.showMessageDialog(getFrame(), mex); JOptionPane.showMessageDialog(getFrame(), mex);