Skip to content

Commit e6208a7

Browse files
committed
Merge branch 'guiOptions' of git://github.com/scriptjunkie/metasploit-framework into scriptjunkie-guiOptions
2 parents 35b3bf4 + 39dee75 commit e6208a7

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

data/gui/msfgui.jar

769 Bytes
Binary file not shown.

external/source/gui/msfguijava/src/msfgui/MainFrame.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,12 @@ protected Void doInBackground() throws Exception {
423423
public ActionListener getActor(final String modName, final String type, final RpcConnection rpcConn) {
424424
return new ActionListener(){
425425
public void actionPerformed(ActionEvent e) {
426-
new ModulePopup(modName,rpcConn,type, MainFrame.this).setVisible(true);
426+
//If we have saved options for this module, use those
427+
Object modOptions = MsfguiApp.getPropertiesNode().get("modOptions");
428+
if(modOptions != null && ((Map)modOptions).containsKey(type+" "+modName))
429+
new ModulePopup(rpcConn, ((List)((Map)modOptions).get(type+" "+modName)).toArray(), MainFrame.this).setVisible(true);
430+
else //otherwise go with the default
431+
new ModulePopup(modName,rpcConn,type, MainFrame.this).setVisible(true);
427432
}
428433
};
429434
}

external/source/gui/msfguijava/src/msfgui/MsfguiApp.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,19 @@ public static void addRecentModule(final List args, final RpcConnection rpcConn,
287287
}
288288
Map hash = (Map)args.get(2);
289289
StringBuilder name = new StringBuilder(args.get(0) + " " + args.get(1));
290+
//Save these options
291+
if(!propRoot.containsKey("modOptions")) //first ensure option map exists
292+
propRoot.put("modOptions", new HashMap());
293+
((Map)propRoot.get("modOptions")).put(name.toString(), args);
294+
295+
//Generate display name
290296
for(Object ento : hash.entrySet()){
291297
Entry ent = (Entry)ento;
292298
String propName = ent.getKey().toString();
293299
if(propName.endsWith("HOST") || propName.endsWith("PORT") || propName.equals("PAYLOAD"))
294300
name.append(" ").append(propName).append("-").append(ent.getValue());
295301
}
302+
//Make menu item
296303
final JMenuItem item = new JMenuItem(name.toString());
297304
item.addActionListener(new ActionListener() {
298305
public void actionPerformed(ActionEvent e) {

0 commit comments

Comments
 (0)