diff --git a/data/gui/msfgui.jar b/data/gui/msfgui.jar index 9b8b55e5fa..2184bf91b9 100644 Binary files a/data/gui/msfgui.jar and b/data/gui/msfgui.jar differ diff --git a/external/source/gui/msfguijava/src/msfgui/DbConnectDialog.java b/external/source/gui/msfguijava/src/msfgui/DbConnectDialog.java index 7884b95019..5e05c4ab14 100644 --- a/external/source/gui/msfguijava/src/msfgui/DbConnectDialog.java +++ b/external/source/gui/msfguijava/src/msfgui/DbConnectDialog.java @@ -7,7 +7,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; -import javax.swing.JOptionPane; import javax.swing.JTextField; /** @@ -253,9 +252,9 @@ public class DbConnectDialog extends OptionsDialog { Map res = (Map)rpcConn.execute("db.connect",opts); success = "success".equals(res.get("result")); if(!success) - JOptionPane.showMessageDialog(myParent, res); + MsfguiApp.showMessage(myParent, res); }catch(MsfException mex){ - JOptionPane.showMessageDialog(myParent, mex); + MsfguiApp.showMessage(myParent, mex); } setVisible(false); }//GEN-LAST:event_connectButtonActionPerformed diff --git a/external/source/gui/msfguijava/src/msfgui/InteractWindow.java b/external/source/gui/msfguijava/src/msfgui/InteractWindow.java index 310857b060..7113b2c84e 100644 --- a/external/source/gui/msfguijava/src/msfgui/InteractWindow.java +++ b/external/source/gui/msfguijava/src/msfgui/InteractWindow.java @@ -14,7 +14,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.concurrent.locks.ReentrantLock; -import javax.swing.JOptionPane; import org.jdesktop.swingworker.SwingWorker; /** @@ -55,7 +54,7 @@ public class InteractWindow extends MsfFrame implements ClipboardOwner { if(autoCommands.get(0).toString().startsWith("use")) rpcConn.execute(cmdPrefix + "write", session.get("id"), data); } catch (MsfException ex) { - JOptionPane.showMessageDialog(null, ex); + MsfguiApp.showMessage(null, ex); } for(Object cmd : autoCommands) { try { @@ -155,7 +154,7 @@ public class InteractWindow extends MsfFrame implements ClipboardOwner { publish(received); } catch (MsfException ex) { if(!ex.getMessage().equals("unknown session")) - JOptionPane.showMessageDialog(null, ex); + MsfguiApp.showMessage(null, ex); if(!ex.getMessage().contains("timed out")) // on timeout, just retry timerCommand.setCharAt(0, STOP_POLLING); } @@ -231,7 +230,7 @@ public class InteractWindow extends MsfFrame implements ClipboardOwner { inputField.setText(""); currentCommand = 0; } catch (MsfException ex) { - JOptionPane.showMessageDialog(null, ex); + MsfguiApp.showMessage(null, ex); } } /** This method is called from within the constructor to @@ -370,7 +369,7 @@ public class InteractWindow extends MsfFrame implements ClipboardOwner { outputArea.append("backgrounding session...\n"); } } catch (MsfException ex) { - JOptionPane.showMessageDialog(null, ex); + MsfguiApp.showMessage(null, ex); } } }//GEN-LAST:event_inputFieldKeyPressed diff --git a/external/source/gui/msfguijava/src/msfgui/MainFrame.form b/external/source/gui/msfguijava/src/msfgui/MainFrame.form index 1d8c9ccebb..5126107c19 100644 --- a/external/source/gui/msfguijava/src/msfgui/MainFrame.form +++ b/external/source/gui/msfguijava/src/msfgui/MainFrame.form @@ -935,7 +935,6 @@ - @@ -945,7 +944,7 @@ - + diff --git a/external/source/gui/msfguijava/src/msfgui/MainFrame.java b/external/source/gui/msfguijava/src/msfgui/MainFrame.java index 4ea6d76b29..bd2014a081 100644 --- a/external/source/gui/msfguijava/src/msfgui/MainFrame.java +++ b/external/source/gui/msfguijava/src/msfgui/MainFrame.java @@ -143,6 +143,7 @@ public class MainFrame extends FrameView { rpcConn.execute("auth.logout"); else return false; + MsfguiApp.shuttingDown = true; } catch (Exception ex) { } return true; @@ -356,7 +357,7 @@ nameloop: for (int i = 0; i < names.length; i++) { for (Object console : consoles) registerConsole((Map)console,false, ""); }catch (MsfException mex){ - JOptionPane.showMessageDialog(getFrame(), mex); + MsfguiApp.showMessage(getFrame(), mex); } } @@ -389,6 +390,7 @@ nameloop: for (int i = 0; i < names.length; i++) { }; //Exploits and auxiliary get modulepopups; payloads get payloadpopups duh setMessage("Getting exploits"); + statusAnimationLabel.setText(""); expandList((List) ((Map)rpcConn.execute("module.exploits")).get("modules"), exploitsMenu, moduleFactory, "exploit"); setProgress(0.3f); setMessage("Getting auxiliary modules"); @@ -1213,9 +1215,9 @@ nameloop: for (int i = 0; i < names.length; i++) { try{ java.awt.Desktop.getDesktop().browse(new URI("http://www.metasploit.com/framework/support")); } catch (IOException ex){ - JOptionPane.showMessageDialog(this.getFrame(), "Can't open browser. See http://www.metasploit.com/framework/support"); + MsfguiApp.showMessage(this.getFrame(), "Can't open browser. See http://www.metasploit.com/framework/support"); } catch ( URISyntaxException usx){ - JOptionPane.showMessageDialog(this.getFrame(), "Can't find the URL. This really should never happen. Report this bug."); + MsfguiApp.showMessage(this.getFrame(), "Can't find the URL. This really should never happen. Report this bug."); } }//GEN-LAST:event_onlineHelpMenuActionPerformed @@ -1230,7 +1232,7 @@ nameloop: for (int i = 0; i < names.length; i++) { java.awt.Desktop.getDesktop().browse(new URI("file://"+MsfguiLog.defaultLog.save( MsfguiApp.cleanBackslashes(MsfguiApp.fileChooser.getSelectedFile().getAbsolutePath())))); }catch (Exception ex){ - JOptionPane.showMessageDialog(getFrame(), "Problem "+ex); + MsfguiApp.showMessage(getFrame(), "Problem "+ex); } } }//GEN-LAST:event_logGenerateMenuItemActionPerformed @@ -1250,7 +1252,7 @@ nameloop: for (int i = 0; i < names.length; i++) { Map res = (Map)rpcConn.execute("console.create"); registerConsole(res, true, ""); }catch(MsfException mex){ - JOptionPane.showMessageDialog(getFrame(), mex); + MsfguiApp.showMessage(getFrame(), mex); } }//GEN-LAST:event_newConsoleItemActionPerformed @@ -1319,9 +1321,9 @@ nameloop: for (int i = 0; i < names.length; i++) { argHash.put("data", Base64.encode(data)); rpcConn.execute("db.import_"+type,argHash); } catch (MsfException mex) { - JOptionPane.showMessageDialog(getFrame(), mex); + MsfguiApp.showMessage(getFrame(), mex); } catch (IOException iex) { - JOptionPane.showMessageDialog(getFrame(), iex); + MsfguiApp.showMessage(getFrame(), iex); } }//GEN-LAST:event_importItemActionPerformed @@ -1329,16 +1331,16 @@ nameloop: for (int i = 0; i < names.length; i++) { try { rpcConn.execute("db.disconnect"); } catch (MsfException mex) { - JOptionPane.showMessageDialog(getFrame(), mex); + MsfguiApp.showMessage(getFrame(), mex); } }//GEN-LAST:event_disconnectItemActionPerformed private void loadPlugin(String plugin){ try { rpcConn.execute("plugin.load",plugin, new HashMap()); - JOptionPane.showMessageDialog(getFrame(), "Plugin "+plugin+" loaded."); + MsfguiApp.showMessage(getFrame(), "Plugin "+plugin+" loaded."); } catch (MsfException mex) { - JOptionPane.showMessageDialog(getFrame(), mex); + MsfguiApp.showMessage(getFrame(), mex); } } private void otherPluginItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_otherPluginItemActionPerformed @@ -1380,7 +1382,7 @@ nameloop: for (int i = 0; i < names.length; i++) { return; rpcConn.execute("plugin.unload",plugin); } catch (MsfException mex) { - JOptionPane.showMessageDialog(getFrame(), mex); + MsfguiApp.showMessage(getFrame(), mex); } }//GEN-LAST:event_unloadPluginItemActionPerformed @@ -1402,7 +1404,7 @@ nameloop: for (int i = 0; i < names.length; i++) { map.put(colNames[i], tab.getValueAt(row,i)); rpcConn.execute("db.del_"+name,map); } catch (MsfException mex) { - JOptionPane.showMessageDialog(getFrame(), mex); + MsfguiApp.showMessage(getFrame(), mex); } }//delete then readd reAddQuery(tab,name+"s",colNames); @@ -1447,7 +1449,7 @@ nameloop: for (int i = 0; i < names.length; i++) { MsfguiApp.getPropertiesNode().put("workspace", MsfguiApp.workspace); reloadDb(); } catch (MsfException mex) { - JOptionPane.showMessageDialog(getFrame(), mex); + MsfguiApp.showMessage(getFrame(), mex); } }//GEN-LAST:event_currWorkspaceItemActionPerformed @@ -1460,7 +1462,7 @@ nameloop: for (int i = 0; i < names.length; i++) { rpcConn.execute("db.set_workspace", name); reloadDb(); } catch (MsfException mex) { - JOptionPane.showMessageDialog(getFrame(), mex); + MsfguiApp.showMessage(getFrame(), mex); } }//GEN-LAST:event_addWorkspaceItemActionPerformed @@ -1480,7 +1482,7 @@ nameloop: for (int i = 0; i < names.length; i++) { reloadDb(); } } catch (MsfException mex) { - JOptionPane.showMessageDialog(getFrame(), mex); + MsfguiApp.showMessage(getFrame(), mex); } }//GEN-LAST:event_delWorkspaceItemActionPerformed @@ -1558,9 +1560,9 @@ nameloop: for (int i = 0; i < names.length; i++) { "db_export -f "+type+" "+MsfguiApp.escapeBackslashes( MsfguiApp.fileChooser.getSelectedFile().getCanonicalPath()))); } catch (MsfException mex) { - JOptionPane.showMessageDialog(getFrame(), mex); + MsfguiApp.showMessage(getFrame(), mex); } catch (IOException iex) { - JOptionPane.showMessageDialog(getFrame(), iex); + MsfguiApp.showMessage(getFrame(), iex); } }//GEN-LAST:event_dbExportItemActionPerformed @@ -1602,7 +1604,7 @@ nameloop: for (int i = 0; i < names.length; i++) { addSessionItem("Stop",jobPopupMenu,new RpcAction() { public void action() throws Exception { if(!((Map)rpcConn.execute("job.stop", clickedJob)).get("result").equals("success")) - JOptionPane.showMessageDialog(null, "stop failed."); + MsfguiApp.showMessage(null, "stop failed."); } }); jobsList.addMouseListener( new PopupMouseListener() { @@ -1904,7 +1906,7 @@ nameloop: for (int i = 0; i < names.length; i++) { private javax.swing.JMenuItem socketLoggerItem; private javax.swing.JMenuItem soundItem; private javax.swing.JMenuItem startRpcMenuItem; - private javax.swing.JLabel statusAnimationLabel; + public javax.swing.JLabel statusAnimationLabel; private javax.swing.JLabel statusMessageLabel; private javax.swing.JPanel statusPanel; public javax.swing.JTabbedPane tabbedPane; diff --git a/external/source/gui/msfguijava/src/msfgui/MeterpFileBrowser.java b/external/source/gui/msfguijava/src/msfgui/MeterpFileBrowser.java index 6b21322868..fc129560bf 100644 --- a/external/source/gui/msfguijava/src/msfgui/MeterpFileBrowser.java +++ b/external/source/gui/msfguijava/src/msfgui/MeterpFileBrowser.java @@ -93,7 +93,7 @@ public class MeterpFileBrowser extends MsfFrame { tempFile.delete(); } catch (IOException iox){ tempIcon = null; - JOptionPane.showMessageDialog(null, "Cannot create temp file. Weird."); + MsfguiApp.showMessage(null, "Cannot create temp file. Weird."); } fileIcon = tempIcon; tempFile.delete(); @@ -167,7 +167,7 @@ public class MeterpFileBrowser extends MsfFrame { try{ rpcConn.execute("session.meterpreter_run_single", session.get("id"), cmd); } catch (Exception ex) { - JOptionPane.showMessageDialog(this, ex); + MsfguiApp.showMessage(this, ex); } } /** Handles click events, like popup menu and double-click navigation */ @@ -221,7 +221,7 @@ public class MeterpFileBrowser extends MsfFrame { try { Map received = (Map) rpcConn.execute("session.meterpreter_read", session.get("id")); if (! received.get("encoding").equals("base64")) { - JOptionPane.showMessageDialog(null, "uhoh. encoding changed. Time to update msfgui?"); + MsfguiApp.showMessage(null, "uhoh. encoding changed. Time to update msfgui?"); return; } byte[] decodedBytes = Base64.decode(received.get("data").toString()); @@ -264,7 +264,7 @@ public class MeterpFileBrowser extends MsfFrame { ex.printStackTrace(); if(ex.getMessage().equals("unknown session")) readTimer.stop(); - JOptionPane.showMessageDialog(null, ex); + MsfguiApp.showMessage(null, ex); } } @@ -516,7 +516,7 @@ public class MeterpFileBrowser extends MsfFrame { DraggableTabbedPane.show(interactPane); }catch (NullPointerException nex){//cancelled }catch (Exception ex){ - JOptionPane.showMessageDialog(null, ex); + MsfguiApp.showMessage(null, ex); } }//GEN-LAST:event_recSearchDownloadButtonActionPerformed diff --git a/external/source/gui/msfguijava/src/msfgui/ModuleInfoWindow.java b/external/source/gui/msfguijava/src/msfgui/ModuleInfoWindow.java index f6826f7774..5bfe7a711f 100644 --- a/external/source/gui/msfguijava/src/msfgui/ModuleInfoWindow.java +++ b/external/source/gui/msfguijava/src/msfgui/ModuleInfoWindow.java @@ -12,7 +12,6 @@ import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JFormattedTextField; import javax.swing.JLabel; -import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; @@ -193,7 +192,7 @@ public abstract class ModuleInfoWindow extends MsfFrame { } } } catch (MsfException ex) { - JOptionPane.showMessageDialog(rootPane, ex); + MsfguiApp.showMessage(rootPane, ex); } updateSizes(this); } @@ -279,7 +278,7 @@ public abstract class ModuleInfoWindow extends MsfFrame { } else { // Non-console; just fire away Map info = (Map) rpcConn.execute("module.execute",moduleType, fullName,hash); if (!info.get("result").equals("success")) - JOptionPane.showMessageDialog(rootPane, info); + MsfguiApp.showMessage(rootPane, info); } MsfguiApp.addRecentModule(java.util.Arrays.asList(new Object[]{moduleType, fullName, hash}), rpcConn, parentFrame); } diff --git a/external/source/gui/msfguijava/src/msfgui/ModulePopup.java b/external/source/gui/msfguijava/src/msfgui/ModulePopup.java index e9484e2121..a74790d3ce 100644 --- a/external/source/gui/msfguijava/src/msfgui/ModulePopup.java +++ b/external/source/gui/msfguijava/src/msfgui/ModulePopup.java @@ -15,7 +15,6 @@ import javax.swing.GroupLayout.SequentialGroup; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JMenu; -import javax.swing.JOptionPane; import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.event.TreeSelectionEvent; @@ -126,7 +125,7 @@ public class ModulePopup extends ModuleInfoWindow implements TreeSelectionListen //Targets Map targetsMap = (Map) info.get("targets"); if(targetsMap == null){ - JOptionPane.showMessageDialog(this, "No Targets. ??"); + MsfguiApp.showMessage(this, "No Targets. ??"); }else{ String defaultTarget=""; if(info.get("default_target") != null) @@ -154,7 +153,7 @@ public class ModulePopup extends ModuleInfoWindow implements TreeSelectionListen showOptions(); } } catch (MsfException ex) { - JOptionPane.showMessageDialog(rootPane, ex); + MsfguiApp.showMessage(rootPane, ex); } reGroup(); updateSizes(mainPanel); @@ -213,7 +212,7 @@ public class ModulePopup extends ModuleInfoWindow implements TreeSelectionListen payloadTree.setRootVisible(false); payloadTree.revalidate(); } catch (MsfException ex) { - JOptionPane.showMessageDialog(rootPane, ex); + MsfguiApp.showMessage(rootPane, ex); } } @@ -235,7 +234,7 @@ public class ModulePopup extends ModuleInfoWindow implements TreeSelectionListen //Add exploit only options if(moduleType.equals("exploit")){ if(payload.length() <= 0){ - JOptionPane.showMessageDialog(rootPane, "You must select a payload"); + MsfguiApp.showMessage(rootPane, "You must select a payload"); return; } hash.put("PAYLOAD",payload.toString()); @@ -249,7 +248,7 @@ public class ModulePopup extends ModuleInfoWindow implements TreeSelectionListen this.setVisible(false); this.dispose(); } catch (MsfException ex) { - JOptionPane.showMessageDialog(rootPane, ex); + MsfguiApp.showMessage(rootPane, ex); } } diff --git a/external/source/gui/msfguijava/src/msfgui/MsfFrame.java b/external/source/gui/msfguijava/src/msfgui/MsfFrame.java index 544152d186..1b34ae283f 100644 --- a/external/source/gui/msfguijava/src/msfgui/MsfFrame.java +++ b/external/source/gui/msfguijava/src/msfgui/MsfFrame.java @@ -5,7 +5,6 @@ import java.awt.Component; import java.awt.HeadlessException; import java.util.Map; import javax.swing.JComponent; -import javax.swing.JOptionPane; import javax.swing.UIManager; import javax.swing.UIManager.LookAndFeelInfo; import javax.swing.plaf.ColorUIResource; @@ -72,7 +71,7 @@ public class MsfFrame extends javax.swing.JFrame{ props.put("LnF", newLnF); } } catch (Exception e) { - JOptionPane.showMessageDialog(null, e); + MsfguiApp.showMessage(null, e); e.printStackTrace(); } } diff --git a/external/source/gui/msfguijava/src/msfgui/MsfguiApp.java b/external/source/gui/msfguijava/src/msfgui/MsfguiApp.java index 0ed6241239..4ce8d37a88 100644 --- a/external/source/gui/msfguijava/src/msfgui/MsfguiApp.java +++ b/external/source/gui/msfguijava/src/msfgui/MsfguiApp.java @@ -40,6 +40,7 @@ public class MsfguiApp extends SingleFrameApplication { public static String workspace = "default"; public static final String confFilename = System.getProperty("user.home")+File.separatorChar+".msf3"+File.separatorChar+"msfgui"; public static MainFrame mainFrame; + public static boolean shuttingDown = false; static{ //get saved properties file Map props; @@ -60,6 +61,10 @@ public class MsfguiApp extends SingleFrameApplication { } }); } + public static void showMessage(java.awt.Component parent, Object message){ + if(!shuttingDown) + JOptionPane.showMessageDialog(parent, message); + } /** * Saves the properties node as an XML file specified by confFilename @@ -257,7 +262,7 @@ public class MsfguiApp extends SingleFrameApplication { temp.delete(); return path; }catch(IOException ex){ - JOptionPane.showMessageDialog(null, "Cannot create temp file. This is a bad and unexpected error. What is wrong with your system?!"); + MsfguiApp.showMessage(null, "Cannot create temp file. This is a bad and unexpected error. What is wrong with your system?!"); return null; } } @@ -270,7 +275,7 @@ public class MsfguiApp extends SingleFrameApplication { temp.delete(); return path; }catch(IOException ex){ - JOptionPane.showMessageDialog(null, "Cannot create temp file. This is a bad and unexpected error. What is wrong with your system?!"); + MsfguiApp.showMessage(null, "Cannot create temp file. This is a bad and unexpected error. What is wrong with your system?!"); return null; } } diff --git a/external/source/gui/msfguijava/src/msfgui/OpenConnectionDialog.java b/external/source/gui/msfguijava/src/msfgui/OpenConnectionDialog.java index 6aacb05a84..ed5573cf87 100644 --- a/external/source/gui/msfguijava/src/msfgui/OpenConnectionDialog.java +++ b/external/source/gui/msfguijava/src/msfgui/OpenConnectionDialog.java @@ -2,7 +2,6 @@ package msfgui; import java.io.File; import java.util.Map; import javax.swing.JFileChooser; -import javax.swing.JOptionPane; import javax.swing.JTextField; /** @@ -44,7 +43,7 @@ public class OpenConnectionDialog extends javax.swing.JDialog { */ public static RpcConnection getConnection(MainFrame mainframe) { if(mainframe.rpcConn != null){ - JOptionPane.showMessageDialog(mainframe.getFrame(), "You are already connected!\n" + MsfguiApp.showMessage(mainframe.getFrame(), "You are already connected!\n" + "Exit before making a new connection."); throw new RuntimeException("Already connected"); } @@ -58,8 +57,9 @@ public class OpenConnectionDialog extends javax.swing.JDialog { boolean ssl = Boolean.parseBoolean(info.get("ssl").toString()); return new RpcConnection(username, password.toCharArray(), host, port, ssl); } catch (MsfException mex) { - if(mex.getMessage().contains("Authentication Error")) - System.err.println("Error authenticating; wrong saved credentials."); + if(mex.getMessage().toLowerCase().contains("authentication error")) + mainframe.statusAnimationLabel.setText("Error authenticating; msfrpcd is running " + +"but you did not enter the right credentials."); } catch (NullPointerException nex) {//generated when attributes dont exist. } //Darn. open the gui anyway @@ -331,7 +331,7 @@ public class OpenConnectionDialog extends javax.swing.JDialog { return; MsfguiApp.getPropertiesNode().put("commandPrefix", MsfguiApp.fileChooser.getCurrentDirectory().getPath()+File.separator); - JOptionPane.showMessageDialog(this, "Will now try running \n" + MsfguiApp.showMessage(this, "Will now try running \n" +MsfguiApp.getPropertiesNode().get("commandPrefix")+"msfrpcd\n" +"and "+ MsfguiApp.getPropertiesNode().get("commandPrefix")+"ruby /msf3/msfrpcd\n" + "when starting new daemon. Note: for the second to work on Windows,\n" diff --git a/external/source/gui/msfguijava/src/msfgui/PayloadPopup.java b/external/source/gui/msfguijava/src/msfgui/PayloadPopup.java index d293426377..422d827665 100644 --- a/external/source/gui/msfguijava/src/msfgui/PayloadPopup.java +++ b/external/source/gui/msfguijava/src/msfgui/PayloadPopup.java @@ -13,7 +13,6 @@ import javax.swing.GroupLayout; import javax.swing.GroupLayout.ParallelGroup; import javax.swing.GroupLayout.SequentialGroup; import javax.swing.JFileChooser; -import javax.swing.JOptionPane; /** * Popup for generating payloads and starting handlers. @@ -533,9 +532,9 @@ public class PayloadPopup extends ModuleInfoWindow { } outputPane.append("\n\nruby\n"+rubyHex); } catch (MsfException ex) { - JOptionPane.showMessageDialog(this, ex); + MsfguiApp.showMessage(this, ex); } catch (IOException ex) { - JOptionPane.showMessageDialog(this, ex); + MsfguiApp.showMessage(this, ex); } }//GEN-LAST:event_generateButtonActionPerformed diff --git a/external/source/gui/msfguijava/src/msfgui/PopupMouseListener.java b/external/source/gui/msfguijava/src/msfgui/PopupMouseListener.java index 78ceaa18f5..40076ec97a 100644 --- a/external/source/gui/msfguijava/src/msfgui/PopupMouseListener.java +++ b/external/source/gui/msfguijava/src/msfgui/PopupMouseListener.java @@ -2,7 +2,6 @@ package msfgui; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import javax.swing.JOptionPane; /** * Convenient handler for showing popup windows from mouse clicks @@ -22,7 +21,7 @@ public abstract class PopupMouseListener extends MouseAdapter{ if(e.getClickCount() == 2) doubleClicked(e); }catch(MsfException xre){ - JOptionPane.showMessageDialog(null, "action failed " + xre); + MsfguiApp.showMessage(null, "action failed " + xre); } } public void doubleClicked (MouseEvent e) throws MsfException{//empty by default diff --git a/external/source/gui/msfguijava/src/msfgui/ProcessList.java b/external/source/gui/msfguijava/src/msfgui/ProcessList.java index 7e5c76016e..471e978562 100755 --- a/external/source/gui/msfguijava/src/msfgui/ProcessList.java +++ b/external/source/gui/msfguijava/src/msfgui/ProcessList.java @@ -8,7 +8,6 @@ import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.util.Map; import java.util.concurrent.locks.ReentrantLock; -import javax.swing.JOptionPane; import javax.swing.Timer; import javax.swing.table.DefaultTableModel; @@ -81,7 +80,7 @@ public class ProcessList extends MsfFrame { try { Map received = (Map) rpcConn.execute("session.meterpreter_read", session.get("id")); if (!received.get("encoding").equals("base64")) { - JOptionPane.showMessageDialog(null, "uhoh. encoding changed. Time to update msfgui?"); + MsfguiApp.showMessage(null, "uhoh. encoding changed. Time to update msfgui?"); return; } byte[] decodedBytes = Base64.decode(received.get("data").toString()); @@ -108,7 +107,7 @@ public class ProcessList extends MsfFrame { ex.printStackTrace(); if (ex.getMessage().equals("unknown session")) readTimer.stop(); - JOptionPane.showMessageDialog(null, ex.getMessage()); + MsfguiApp.showMessage(null, ex.getMessage()); } } }); @@ -120,7 +119,7 @@ public class ProcessList extends MsfFrame { try { rpcConn.execute("session.meterpreter_run_single", session.get("id"),cmd); } catch (Exception ex) { - JOptionPane.showMessageDialog(this, ex); + MsfguiApp.showMessage(this, ex); if (ex.getMessage().equals("unknown session")) return true; } diff --git a/external/source/gui/msfguijava/src/msfgui/RpcAction.java b/external/source/gui/msfguijava/src/msfgui/RpcAction.java index 24a4545733..4550a27990 100644 --- a/external/source/gui/msfguijava/src/msfgui/RpcAction.java +++ b/external/source/gui/msfguijava/src/msfgui/RpcAction.java @@ -3,7 +3,6 @@ package msfgui; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Map; -import javax.swing.JOptionPane; /** * Provides an ActionListener for running a meterpreter script on each selected session. Each time @@ -34,7 +33,7 @@ public class RpcAction implements ActionListener { action(session); }catch(Exception ex){ if(!ex.getMessage().equals("cancelled")){ - JOptionPane.showMessageDialog(null, "Error in RPC call: "+ex); + MsfguiApp.showMessage(null, "Error in RPC call: "+ex); ex.printStackTrace(); } } diff --git a/external/source/gui/msfguijava/src/msfgui/RpcConnection.java b/external/source/gui/msfguijava/src/msfgui/RpcConnection.java index 2fa92e404f..c8df51e0d1 100644 --- a/external/source/gui/msfguijava/src/msfgui/RpcConnection.java +++ b/external/source/gui/msfguijava/src/msfgui/RpcConnection.java @@ -20,7 +20,6 @@ import java.util.Random; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; -import javax.swing.JOptionPane; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; @@ -377,7 +376,7 @@ public class RpcConnection { /** Attempts to start msfrpcd and connect to it.*/ public static Task startRpcConn(final MainFrame mainFrame){ if(mainFrame.rpcConn != null){ - JOptionPane.showMessageDialog(mainFrame.getFrame(), "You are already connected!\n" + MsfguiApp.showMessage(mainFrame.getFrame(), "You are already connected!\n" + "Exit before making a new connection."); throw new RuntimeException("Already connected"); } @@ -420,6 +419,11 @@ public class RpcConnection { connected = true; break; } catch (MsfException mex) { + if(mex.getMessage().toLowerCase().contains("authentication error")){ + mex.printStackTrace(); + setMessage("Cannot connect to started msfrpcd."); + throw mex; + } } try { Thread.sleep(200); //Wait for msfrpcd to be ready diff --git a/external/source/gui/msfguijava/src/msfgui/SearchWindow.java b/external/source/gui/msfguijava/src/msfgui/SearchWindow.java index 1fdbf5b8e6..b812fea15f 100755 --- a/external/source/gui/msfguijava/src/msfgui/SearchWindow.java +++ b/external/source/gui/msfguijava/src/msfgui/SearchWindow.java @@ -8,7 +8,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.swing.DefaultListModel; -import javax.swing.JOptionPane; /** * Window for searching for modules by name or details @@ -269,7 +268,7 @@ public class SearchWindow extends MsfFrame { mod.addElement(modInfo[1]+" - "+Rank.toString(info.get("rank"))); } } catch (MsfException ex) { - JOptionPane.showMessageDialog(rootPane, ex); + MsfguiApp.showMessage(rootPane, ex); } } }//GEN-LAST:event_searchButtonActionPerformed diff --git a/external/source/gui/msfguijava/src/msfgui/WebcamFrame.java b/external/source/gui/msfguijava/src/msfgui/WebcamFrame.java index 5201772189..25541ff20a 100755 --- a/external/source/gui/msfguijava/src/msfgui/WebcamFrame.java +++ b/external/source/gui/msfguijava/src/msfgui/WebcamFrame.java @@ -6,7 +6,6 @@ import java.net.DatagramSocket; import java.net.SocketException; import java.util.Map; import javax.swing.ImageIcon; -import javax.swing.JOptionPane; import javax.swing.SwingWorker; /** @@ -169,11 +168,11 @@ public class WebcamFrame extends MsfFrame { }; sw.execute(); } catch(NumberFormatException nex){ - JOptionPane.showMessageDialog(this, "Please enter a valid delay interval between frames!"); + MsfguiApp.showMessage(this, "Please enter a valid delay interval between frames!"); } catch(MsfException mex) { - JOptionPane.showMessageDialog(this, mex); + MsfguiApp.showMessage(this, mex); } catch (SocketException sox) { - JOptionPane.showMessageDialog(this, sox); + MsfguiApp.showMessage(this, sox); } }//GEN-LAST:event_startButtonActionPerformed