Merge pull request #137 from scriptjunkie/master

Get output format list in msfgui dynamically from RPC.
unstable
sinn3r 2012-01-29 02:28:49 -08:00
commit 34666ef6f7
6 changed files with 15 additions and 3 deletions

0
data/gui/lib/appframework-1.0.3.jar Executable file → Normal file
View File

0
data/gui/lib/msgpack-0.5.1-devel.jar Executable file → Normal file
View File

0
data/gui/lib/swing-worker-1.1.jar Executable file → Normal file
View File

BIN
data/gui/msfgui.jar Executable file → Normal file

Binary file not shown.

View File

@ -46,6 +46,18 @@ public class PayloadPopup extends ModuleInfoWindow {
encoderCombo.setSelectedIndex(defaultEncoder);
}catch(MsfException xre){
}
//get formats
try{
Object[] formats = ((List)rpcConn.execute("module.encode_formats")).toArray();
int defaultFormat = 0;
for(int i = 0; i < formats.length; i++)
if(formats[i].toString().equals("exe"))
defaultFormat = i;
outputCombo.setModel(new DefaultComboBoxModel(formats));
outputCombo.setSelectedIndex(defaultFormat);
}catch(MsfException xre){
xre.printStackTrace();
}
mainScrollPane.getVerticalScrollBar().setUnitIncrement(40);
}

View File

@ -84,7 +84,7 @@ public abstract class RpcConnection {
String message = "";
try {
connect();
Map results = exec("auth.login",new Object[]{username, this.password});
Map results = (Map)exec("auth.login",new Object[]{username, this.password});
rpcToken=results.get("token").toString();
haveRpcd=results.get("result").equals("success");
} catch (MsfException xre) {
@ -211,11 +211,11 @@ public abstract class RpcConnection {
}
/** Method that handles synchronization and error handling for calls */
private Map exec (String methname, Object[] params) throws MsfException{
private Object exec (String methname, Object[] params) throws MsfException{
synchronized(lockObject){ //Only one method call at a time!
try{
writeCall(methname, params);
return (Map)readResp();
return readResp();
}catch(Exception ex){ //any weirdness gets wrapped in a MsfException
try{
if(ex instanceof java.net.SocketTimeoutException)