Address a few remaining MsgPack/XML differences,

remove Msg warning.



git-svn-id: file:///home/svn/framework3/trunk@13649 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Weeks 2011-08-28 21:09:03 +00:00
parent b3d169b590
commit a57769f336
8 changed files with 21 additions and 32 deletions

Binary file not shown.

View File

@ -151,7 +151,8 @@ public class InteractWindow extends MsfFrame implements ClipboardOwner {
publish(received);
} catch (MsfException ex) {
MsfguiApp.showMessage(null, ex);
if(!ex.getMessage().contains("timed out")) // on timeout, just retry
if(ex.getMessage().toLowerCase().contains("unknown session") // we're dead.
|| !ex.getMessage().contains("timed out")) // on timeout, just retry
timerCommand.setCharAt(0, STOP_POLLING);
}
lock.unlock();

View File

@ -874,9 +874,6 @@
<Property name="action" type="javax.swing.Action" editor="org.netbeans.modules.swingapp.ActionEditor">
<action class="msfgui.MainFrame" id="showAboutBox" methodName="showAboutBox"/>
</Property>
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
<KeyStroke key="F1"/>
</Property>
<Property name="name" type="java.lang.String" value="aboutMenuItem" noResource="true"/>
</Properties>
<AuxValues>

View File

@ -228,7 +228,9 @@ public class MainFrame extends FrameView {
publish(sessionList);
}
//Update jobs
Map jlist = (Map) ((Map)rpcConn.execute("job.list")).get("jobs");
Map jlist = (Map) ((Map)rpcConn.execute("job.list"));
if(jlist.containsKey("jobs"))
jlist = (Map)jlist.get("jobs");
TreeMap orderedJobsList = new TreeMap();
orderedJobsList.putAll(jlist);
int i = 0;
@ -1633,13 +1635,15 @@ nameloop: for (int i = 0; i < names.length; i++) {
jobPopupMenu = new JPopupMenu();
addSessionItem("Info",jobPopupMenu,new RpcAction() {
public void action() throws Exception {
Object obj = ((Map)rpcConn.execute("job.info", clickedJob)).get("info");
Object obj = rpcConn.execute("job.info", clickedJob);
if(obj instanceof Map && ((Map)obj).containsKey("info"))
obj = ((Map)obj).get("info");
(new JobInfoPopup(null, true, obj)).setVisible(true);
}
});
addSessionItem("Stop",jobPopupMenu,new RpcAction() {
public void action() throws Exception {
if(!((Map)rpcConn.execute("job.stop", clickedJob)).get("result").equals("success"))
if(!"success".equals(((Map)rpcConn.execute("job.stop", clickedJob)).get("result")))
MsfguiApp.showMessage(null, "stop failed.");
}
});
@ -1650,9 +1654,12 @@ nameloop: for (int i = 0; i < names.length; i++) {
return;
jobsList.setSelectedIndex(indx);
clickedJob = jobsList.getSelectedValue().toString().split(" ")[0];
if(e.getClickCount() > 1)
(new JobInfoPopup(null, true,
((Map)rpcConn.execute("job.info", clickedJob)).get("info"))).setVisible(true);
if(e.getClickCount() > 1){
Object obj = rpcConn.execute("job.info", clickedJob);
if(obj instanceof Map && ((Map)obj).containsKey("info"))
obj = ((Map)obj).get("info");
(new JobInfoPopup(null, true, obj)).setVisible(true);
}
}
public void showPopup(MouseEvent e) {
jobPopupMenu.show(jobsList, e.getX(), e.getY() );

View File

@ -221,10 +221,6 @@ public class MeterpFileBrowser extends MsfFrame {
public void actionPerformed(ActionEvent e) {
try {
Map received = (Map) rpcConn.execute("session.meterpreter_read", session.get("id"));
if (! received.get("encoding").equals("base64")) {
MsfguiApp.showMessage(null, "uhoh. encoding changed. Time to update msfgui?");
return;
}
byte[] decodedBytes = RpcConnection.getData(received);
if (decodedBytes.length == 0)
return;
@ -263,7 +259,7 @@ public class MeterpFileBrowser extends MsfFrame {
}
} catch (Exception ex) {
ex.printStackTrace();
if(ex.getMessage().contains("unknown session"))
if(ex.getMessage().toLowerCase().contains("unknown session"))
readTimer.stop();
MsfguiApp.showMessage(null, ex);
}

View File

@ -243,7 +243,7 @@ public class MsfguiApp extends SingleFrameApplication {
MsfguiLog.defaultLog.logMethodCall("module.execute", new Object[]{moduleType, fullName, hash});
} else { // Non-console; just fire away
Map info = (Map) rpcConn.execute("module.execute",moduleType, fullName,hash);
if (!info.get("result").equals("success"))
if (!info.containsKey("job_id") && !info.get("result").equals("success"))
MsfguiApp.showMessage(parentFrame.getFrame(), info);
}
MsfguiApp.addRecentModule(java.util.Arrays.asList(new Object[]{moduleType, fullName, hash}), rpcConn, parentFrame);

View File

@ -357,12 +357,8 @@ public class OpenConnectionDialog extends javax.swing.JDialog {
int port = Integer.parseInt(portField.getText());
boolean ssl = checkCrypto(sslBox.isSelected());
String type = "xml";
if(msgpackButton.isSelected()){
if(JOptionPane.showConfirmDialog(this, "MsgPack RPC is not currently supported. Continue anyway?",
"Warning",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.WARNING_MESSAGE) != JOptionPane.YES_OPTION)
return;
if(msgpackButton.isSelected())
type = "msg";
}
try {
rpcConn = RpcConnection.getConn(type, username, password, host, port, ssl);
} catch (MsfException mex) {
@ -394,14 +390,10 @@ public class OpenConnectionDialog extends javax.swing.JDialog {
private void startNewButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startNewButtonActionPerformed
//Setup defaults
if(msgpackButton.isSelected()){
if(JOptionPane.showConfirmDialog(this, "MsgPack RPC is not currently supported. Continue anyway?",
"Warning",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.WARNING_MESSAGE) != JOptionPane.YES_OPTION)
return;
if(msgpackButton.isSelected())
RpcConnection.defaultType = "msg";
}else{
else
RpcConnection.defaultType = "xml";
}
RpcConnection.defaultUser = usernameField.getText();
if(passwordField.getPassword().length > 0)
RpcConnection.defaultPass = new String(passwordField.getPassword());

View File

@ -87,10 +87,6 @@ public class ProcessList extends MsfFrame {
public void actionPerformed(ActionEvent e) {
try {
Map received = (Map) rpcConn.execute("session.meterpreter_read", session.get("id"));
if (!received.get("encoding").equals("base64")) {
MsfguiApp.showMessage(null, "uhoh. encoding changed. Time to update msfgui?");
return;
}
byte[] decodedBytes = RpcConnection.getData(received);
if (decodedBytes.length == 0)
return; //no data
@ -128,7 +124,7 @@ public class ProcessList extends MsfFrame {
rpcConn.execute("session.meterpreter_run_single", session.get("id"),cmd);
} catch (Exception ex) {
MsfguiApp.showMessage(this, ex);
if (ex.getMessage().contains("unknown session"))
if (ex.getMessage().toLowerCase().contains("unknown session"))
return true;
}
return false;