Add ability to run modules in console, some other fixes.

git-svn-id: file:///home/svn/framework3/trunk@10297 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Weeks 2010-09-11 21:54:19 +00:00
parent 0d043457f6
commit cefe0ecb45
10 changed files with 198 additions and 93 deletions

Binary file not shown.

View File

@ -37,6 +37,52 @@ public class InteractWindow extends MsfFrame {
commands.add("");
}
/** Create a new console window to run a module */
public InteractWindow(final RpcConnection rpcConn, final Map session, String module, Map opts){
this(rpcConn, session, "console");
inputField.setEnabled(false);
final ArrayList autoCommands = new ArrayList();
autoCommands.add("use "+module);
if(opts.containsKey("TARGET"))
autoCommands.add("set TARGET "+opts.get("TARGET"));
if(opts.containsKey("PAYLOAD"))
autoCommands.add("set PAYLOAD "+opts.get("PAYLOAD"));
for(Object entObj : opts.entrySet()){
Map.Entry ent = (Map.Entry)entObj;
if(!(ent.getKey().toString().equals("TARGET")) && !(ent.getKey().toString().equals("PAYLOAD")))
autoCommands.add("set "+ent.getKey()+" "+ent.getValue());
}
autoCommands.add("exploit -j");
//start new thread auto
new SwingWorker() {
protected Object doInBackground() throws Exception {
//for some reason the first command doesn't usually work. Do first command twice.
try {
String data = Base64.encode((autoCommands.get(0) + "\n").getBytes());
rpcConn.execute(cmdPrefix + "write", session.get("id"), data);
} catch (MsfException ex) {
JOptionPane.showMessageDialog(null, ex);
}
for(Object cmd : autoCommands) {
try {
Thread.sleep(500);// Two commands a second
} catch (InterruptedException iex) {
}
this.publish(cmd);
}
inputField.setEnabled(true);
return null;
}
protected void process(List l){
for(Object cmd : l){
inputField.setText(cmd.toString());
doInput();
}
}
}.execute();
}
/** Creates a new window for interacting with shells/meterpreters/consoles */
public InteractWindow(final RpcConnection rpcConn, final Map session, String type) {
super(type+" interaction window");
@ -164,12 +210,33 @@ public class InteractWindow extends MsfFrame {
private void checkPrompt(Map o) {
try{
Object pobj = o.get("prompt");
if (pobj != null)
prompt = new String(Base64.decode(pobj.toString()));
if (pobj == null)
return;
prompt = new String(Base64.decode(pobj.toString()));
StringBuilder sb = new StringBuilder();
for(int i = 0; i < prompt.length(); i++)
if(!Character.isISOControl(prompt.charAt(i)))
sb.append(prompt.charAt(i));
prompt=sb.toString();
promptLabel.setText(prompt);
}catch (MsfException mex){//bad prompt: do nothing
}
}
private void doInput() {
try {
String command = inputField.getText();
commands.add(command);
String data = Base64.encode((command + "\n").getBytes());
rpcConn.execute(cmdPrefix + "write", session.get("id"), data);
outputArea.append(prompt + command + "\n");
outputArea.setCaretPosition(outputArea.getDocument().getLength());
inputField.setText("");
currentCommand = 0;
} catch (MsfException ex) {
JOptionPane.showMessageDialog(null, ex);
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
@ -264,18 +331,7 @@ public class InteractWindow extends MsfFrame {
}// </editor-fold>//GEN-END:initComponents
private void inputFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_inputFieldActionPerformed
try {
String command = inputField.getText();
commands.add(command);
String data = Base64.encode((command+"\n").getBytes());
rpcConn.execute(cmdPrefix+"write", session.get("id"),data);
outputArea.append(prompt+command+"\n");
outputArea.setCaretPosition(outputArea.getDocument().getLength());
inputField.setText("");
currentCommand = 0;
} catch (MsfException ex) {
JOptionPane.showMessageDialog(null, ex);
}
doInput();
}//GEN-LAST:event_inputFieldActionPerformed
private void submitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submitButtonActionPerformed

View File

@ -836,7 +836,7 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="statusMessageLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="698" max="32767" attributes="0"/>
<EmptySpace pref="696" max="32767" attributes="0"/>
<Component id="progressBar" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="statusAnimationLabel" min="-2" max="-2" attributes="0"/>

View File

@ -137,9 +137,13 @@ public class MainFrame extends FrameView {
} catch (Exception ex) {
}
}
/** Adds menu items for reopening and closing the console */
private void registerConsole(Map res, boolean show, String initVal) {
/** Adds window and menu items for reopening and closing the console */
public void registerConsole(Map res, boolean show, String initVal) {
final InteractWindow iw = new InteractWindow(rpcConn, res, "console", initVal);
registerConsole(res,show,iw);
}
/** Adds menu items for reopening and closing the console */
public void registerConsole(Map res, boolean show, final InteractWindow iw) {
iw.setVisible(show);
final String id = res.get("id").toString();
final JMenuItem openItem = new JMenuItem(id);
@ -306,7 +310,7 @@ public class MainFrame extends FrameView {
/** Makes a menu tree with expandList for exploits and auxiliary. Also start jobs/sessions watcher. */
public void getModules() {
searchWin = new SearchWindow(rpcConn);
MsfguiApp.addRecentModules(recentMenu, rpcConn);
MsfguiApp.addRecentModules(rpcConn, this);
//Setup consoles
try{
@ -335,7 +339,7 @@ public class MainFrame extends FrameView {
public ActionListener getActor(final String modName, final String type, final RpcConnection rpcConn) {
return new ActionListener(){
public void actionPerformed(ActionEvent e) {
new ModulePopup(modName,rpcConn,type, recentMenu).setVisible(true);
new ModulePopup(modName,rpcConn,type, me).setVisible(true);
}
};
}

View File

@ -47,9 +47,6 @@
<Property name="horizontalScrollBarPolicy" type="int" value="31"/>
<Property name="name" type="java.lang.String" value="mainScrollPane" noResource="true"/>
</Properties>
<Events>
<EventHandler event="componentResized" listener="java.awt.event.ComponentListener" parameters="java.awt.event.ComponentEvent" handler="mainScrollPaneComponentResized"/>
</Events>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
@ -74,8 +71,16 @@
<Component id="requiredLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="optionalLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="advancedLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="exploitButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="exploitButton1" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="exploitButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="consoleRunButton" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="exploitButton1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="consoleRunButton1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@ -105,9 +110,15 @@
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="advancedLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="exploitButton" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="exploitButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="consoleRunButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="exploitButton1" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="exploitButton1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="consoleRunButton1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="95" max="32767" attributes="0"/>
</Group>
</Group>
@ -222,6 +233,21 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exploitButton1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="consoleRunButton">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="consoleRunButton.text"/>
<Property name="name" type="java.lang.String" value="consoleRunButton" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="consoleRunButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="consoleRunButton1">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="consoleRunButton1.text"/>
<Property name="name" type="java.lang.String" value="consoleRunButton1" noResource="true"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>

View File

@ -43,10 +43,12 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
private ArrayList requiredOpts; // I love how these options aren't optional
private ArrayList optionalOpts;
private ArrayList advancedOpts;
private Map options;
private MainFrame parentFrame;
/** Creates new ModulePopup from recent run */
public ModulePopup(RpcConnection rpcConn, Object[] args, JMenu recentMenu) {
this(args[1].toString(), rpcConn, args[0].toString(), recentMenu);
public ModulePopup(RpcConnection rpcConn, Object[] args, MainFrame parentFrame) {
this(args[1].toString(), rpcConn, args[0].toString(), parentFrame);
Map opts = (Map)args[2];
if(args[0].toString().equals("exploit")){
//Set target
@ -74,8 +76,9 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
}
}
/** Creates new ModulePopup */
public ModulePopup(String fullName, RpcConnection rpcConn, String moduleType, JMenu recentMenu) {
this.recentMenu = recentMenu;
public ModulePopup(String fullName, RpcConnection rpcConn, String moduleType, MainFrame parentFrame) {
this.parentFrame = parentFrame;
this.recentMenu = parentFrame.recentMenu;
initComponents();
exploitButton.setText("Run "+moduleType);
exploitButton1.setText("Run "+moduleType);
@ -265,7 +268,7 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
advancedOpts.clear();
try{
//display options
Map options = (Map) rpcConn.execute("module.options", moduleType, fullName);
options = (Map) rpcConn.execute("module.options", moduleType, fullName);
// payload options
if(moduleType.equals("exploit")){
if(payload.length() <= 0){
@ -304,7 +307,7 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
if(option.get("required").equals(Boolean.TRUE)){
requiredOpts.add(containerPane);
requiredOpts.add(optionField);
}else if (option.get("advanced").equals(Boolean.FALSE)){
}else if (option.get("advanced").equals(Boolean.FALSE) && option.get("evasion").equals(Boolean.FALSE)){
optionalOpts.add(containerPane);
optionalOpts.add(optionField);
}else{
@ -319,7 +322,7 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
}
/** Runs the exploit with given options and payload. Closes window if successful. */
private void runModule() {
private void runModule(boolean console) {
try{
//Put options into request
HashMap hash = new HashMap();
@ -337,14 +340,24 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
if(!(comp instanceof JTextField))
continue;
JTextField optionField = (JTextField)comp;
if(optionField.getText().length() > 0)
hash.put(optionField.getName().substring("field".length()), optionField.getText());
String optName = optionField.getName().substring("field".length());
String optVal = optionField.getText();
Object defaultVal = ((Map)options.get(optName)).get("default");
//only need non-default vals
if((defaultVal == null && optVal.length() > 0) || (defaultVal != null && ! optVal.equals(defaultVal)))
hash.put(optName, optVal);
}
//Execute and get results
Map info = (Map) rpcConn.execute("module.execute",moduleType, fullName,hash);
if(!info.get("result").equals("success"))
JOptionPane.showMessageDialog(rootPane, info);
MsfguiApp.addRecentModule(new Object[]{moduleType, fullName,hash}, recentMenu, rpcConn);
if(console){
Map res = (Map)rpcConn.execute("console.create");
InteractWindow iw = new InteractWindow(rpcConn, res, moduleType+"/"+fullName, hash);
parentFrame.registerConsole(res, true, iw);
}else{
Map info = (Map) rpcConn.execute("module.execute",moduleType, fullName,hash);
if(!info.get("result").equals("success"))
JOptionPane.showMessageDialog(rootPane, info);
}
MsfguiApp.addRecentModule(new Object[]{moduleType, fullName,hash}, rpcConn, parentFrame);
//close out
this.setVisible(false);
@ -353,35 +366,6 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
JOptionPane.showMessageDialog(rootPane, ex);
}
}
// <editor-fold defaultstate="collapsed" desc="comment">
/* DELETEME!
private void wrapLabelText(JLabel label, String text) {
FontMetrics fm = label.getFontMetrics(label.getFont());
Container container = label.getParent().getParent();
int containerWidth = container.getWidth();
BreakIterator boundary = BreakIterator.getWordInstance();
boundary.setText(text);
StringBuffer trial = new StringBuffer();
StringBuffer real = new StringBuffer("<html>");
int start = boundary.first();
for (int end = boundary.next(); end != BreakIterator.DONE;
start = end, end = boundary.next()) {
String word = text.substring(start, end);
trial.append(word);
int trialWidth = SwingUtilities.computeStringWidth(fm, trial.toString());
if (trialWidth > containerWidth) {
trial = new StringBuffer(word);
real.append("<br>");
}
real.append(word);
}
real.append("</html>");
label.setText(real.toString());
} */// </editor-fold>
/** Reformats the view based on visible options and targetsMap. */
private void reGroup(){
@ -409,8 +393,14 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
for(Object obj : advancedOpts)
horizGroup = horizGroup.addComponent((Component) obj, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE);
horizGroup = horizGroup.addComponent(exploitButton)
.addComponent(exploitButton1);
horizGroup = horizGroup.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(exploitButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(consoleRunButton))
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(exploitButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(consoleRunButton1));
mainPanelLayout.setHorizontalGroup(mainPanelLayout.createSequentialGroup().addContainerGap()
.addGroup(horizGroup).addContainerGap());
@ -440,12 +430,16 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
}
boolean odd = false;
odd = addObjectsToVgroup(vGroup, odd, requiredLabel, requiredOpts);
vGroup = vGroup.addComponent(exploitButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED);
vGroup.addGroup(mainPanelLayout.createParallelGroup()
.addComponent(exploitButton1)
.addComponent(consoleRunButton))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED);
odd = addObjectsToVgroup(vGroup, odd, optionalLabel, optionalOpts);
odd = addObjectsToVgroup(vGroup, odd, advancedLabel, advancedOpts);
vGroup = vGroup.addComponent(exploitButton)
.addContainerGap();
vGroup = vGroup.addGroup(mainPanelLayout.createParallelGroup()
.addComponent(exploitButton)
.addComponent(consoleRunButton1))
.addContainerGap();
mainPanelLayout.setVerticalGroup(vGroup);
}
@ -488,16 +482,13 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
descriptionBox = new javax.swing.JEditorPane();
advancedLabel = new javax.swing.JLabel();
exploitButton1 = new javax.swing.JButton();
consoleRunButton = new javax.swing.JButton();
consoleRunButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
mainScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
mainScrollPane.setName("mainScrollPane"); // NOI18N
mainScrollPane.addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentResized(java.awt.event.ComponentEvent evt) {
mainScrollPaneComponentResized(evt);
}
});
mainPanel.setName("mainPanel"); // NOI18N
@ -558,6 +549,17 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
}
});
consoleRunButton.setText(resourceMap.getString("consoleRunButton.text")); // NOI18N
consoleRunButton.setName("consoleRunButton"); // NOI18N
consoleRunButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
consoleRunButtonActionPerformed(evt);
}
});
consoleRunButton1.setText(resourceMap.getString("consoleRunButton1.text")); // NOI18N
consoleRunButton1.setName("consoleRunButton1"); // NOI18N
javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
@ -575,8 +577,14 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
.addComponent(requiredLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(optionalLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(advancedLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(exploitButton)
.addComponent(exploitButton1))
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(exploitButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(consoleRunButton))
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(exploitButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(consoleRunButton1)))
.addContainerGap())
);
mainPanelLayout.setVerticalGroup(
@ -603,9 +611,13 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(advancedLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(exploitButton)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(exploitButton)
.addComponent(consoleRunButton))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(exploitButton1)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(exploitButton1)
.addComponent(consoleRunButton1))
.addContainerGap(95, Short.MAX_VALUE))
);
@ -630,21 +642,23 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
}// </editor-fold>//GEN-END:initComponents
private void exploitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exploitButtonActionPerformed
runModule();
runModule(false);
}//GEN-LAST:event_exploitButtonActionPerformed
private void mainScrollPaneComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_mainScrollPaneComponentResized
//JOptionPane.showMessageDialog(rootPane, "scrollpane size: "+mainScrollPane.getWidth()+" panel size "+mainPanel.getWidth());
}//GEN-LAST:event_mainScrollPaneComponentResized
private void exploitButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exploitButton1ActionPerformed
exploitButtonActionPerformed(evt);
}//GEN-LAST:event_exploitButton1ActionPerformed
private void consoleRunButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_consoleRunButtonActionPerformed
runModule(true);
}//GEN-LAST:event_consoleRunButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel advancedLabel;
private javax.swing.JLabel authorsLabel;
private javax.swing.ButtonGroup buttonGroup;
private javax.swing.JButton consoleRunButton;
private javax.swing.JButton consoleRunButton1;
private javax.swing.JEditorPane descriptionBox;
private javax.swing.JScrollPane descriptionPane;
private javax.swing.JButton exploitButton;

View File

@ -198,7 +198,8 @@ public class MsfguiApp extends SingleFrameApplication {
}
/** Adds a module run to the recent modules list */
public static void addRecentModule(final Object[] args, final JMenu recentMenu, final RpcConnection rpcConn) {
public static void addRecentModule(final Object[] args, final RpcConnection rpcConn, final MainFrame mf) {
final JMenu recentMenu = mf.recentMenu;
recentList.add(args);
Map hash = (Map)args[2];
StringBuilder name = new StringBuilder(args[0] + " " + args[1]);
@ -211,7 +212,7 @@ public class MsfguiApp extends SingleFrameApplication {
final JMenuItem item = new JMenuItem(name.toString());
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new ModulePopup(rpcConn, args, recentMenu).setVisible(true);
new ModulePopup(rpcConn, args, mf).setVisible(true);
recentMenu.remove(item);
recentMenu.add(item);
for(int i = 0; i < recentList.size(); i++){
@ -229,7 +230,7 @@ public class MsfguiApp extends SingleFrameApplication {
if(recentList.size() > NUM_REMEMBERED_MODULES)
recentList.remove(0);
}
public static void addRecentModules(JMenu recentMenu, final RpcConnection rpcConn) {
public static void addRecentModules(final RpcConnection rpcConn, final MainFrame mf) {
Node recentNode = null;
for(Node node = propRoot.getFirstChild(); node != null; node = node.getNextSibling())
if(node.getNodeName().equals("recent"))
@ -255,7 +256,7 @@ public class MsfguiApp extends SingleFrameApplication {
String val = prop.getAttributes().getNamedItem("val").getNodeValue();
hash.put(propName, val);
}
addRecentModule(new Object[]{moduleType, fullName,hash}, recentMenu, rpcConn);
addRecentModule(new Object[]{moduleType, fullName,hash}, rpcConn, mf);
}catch(NullPointerException nex){//if attribute doesn't exist, ignore
}
}

View File

@ -647,7 +647,7 @@ public class PayloadPopup extends MsfFrame {
options.put("WORKSPACE", MsfguiApp.workspace);
try{
Map data = (Map) rpcConn.execute("module.execute","exploit", "multi/handler", options);
MsfguiApp.addRecentModule(new Object[]{"exploit", "multi/handler", options}, mainFrame.recentMenu, rpcConn);
MsfguiApp.addRecentModule(new Object[]{"exploit", "multi/handler", options}, rpcConn, mainFrame);
}catch (MsfException ex){
JOptionPane.showMessageDialog(this, ex);
}

View File

@ -9,3 +9,5 @@ optionalLabel.text=<html><h2>Optional</h2></html>
main.icon=msf_file.png
advancedLabel.text=<html><h2>Advanced</h2></html>
exploitButton1.text=Run Exploit
consoleRunButton1.text=Run in Console
consoleRunButton.text=Run in Console

View File

@ -76,6 +76,8 @@ def service_create(name, display_name, executable_on_host,startup=2)
# SC_MANAGER_CREATE_SERVICE = 0x0002
newservice = adv.CreateServiceA(manag["return"],name,display_name,
0x0010,0X00000010,startup,0,executable_on_host,nil,nil,nil,nil,nil)
adv.CloseServiceHandle(newservice["return"])
adv.CloseServiceHandle(manag["return"])
#SERVICE_START=0x0010 SERVICE_WIN32_OWN_PROCESS= 0X00000010
#SERVICE_AUTO_START = 2 SERVICE_ERROR_IGNORE = 0
if newservice["GetLastError"] == 0