Msfgui fixes:

Make module window work better with smaller screens. 
Fix option title display issues on GTK and in smaller windows. 
RPC backend handles tabs and avoids crash on embedded nulls. 
Cancelling exit confirmation aborts exit. 
Reopening file browser and other session windows is faster and saves location. 
Remove defunct vendor on about window.



git-svn-id: file:///home/svn/framework3/trunk@11461 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Weeks 2011-01-02 22:34:27 +00:00
parent 0b2f68aa3b
commit 99ab6a59dd
14 changed files with 168 additions and 185 deletions

Binary file not shown.

View File

@ -36,7 +36,7 @@ import org.jdesktop.swingworker.SwingWorker;
public class MainFrame extends FrameView {
public static final int MENU_SIZE_LIMIT = 25;
public HashMap sessionPopupMap;
public HashMap sessionWindowMap;
public RpcConnection rpcConn;
private SwingWorker sessionsPollTimer;
private SessionsTable sessionsTableModel;
@ -49,7 +49,7 @@ public class MainFrame extends FrameView {
super(app);
initComponents();
sessionsTableModel = null;
sessionPopupMap = new HashMap();
sessionWindowMap = new HashMap();
//Set up action for starting RPC
startRpcMenuItem.setAction(getContext().getActionMap(this).get("startRpc"));
@ -118,7 +118,8 @@ public class MainFrame extends FrameView {
connectRpc();
getFrame().addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
confirmStop();
if(!confirmStop())
throw new RuntimeException("Closing aborted.");
}
});
//Setup icon
@ -128,16 +129,20 @@ public class MainFrame extends FrameView {
tabbedPane.setEnabledAt(i, false);
}
/** Before exit, check whether the daemon should be stopped or just the session terminated */
private void confirmStop() {
private boolean confirmStop() {
if (rpcConn == null)
return;
return true;
try {
if(JOptionPane.showConfirmDialog(getFrame(), "Stop msfrpcd?") == JOptionPane.YES_OPTION)
int choice = JOptionPane.showConfirmDialog(getFrame(), "Stop msfrpcd?");
if(choice == JOptionPane.YES_OPTION)
rpcConn.execute("core.stop");
else
else if(choice == JOptionPane.NO_OPTION)
rpcConn.execute("auth.logout");
else
return false;
} catch (Exception ex) {
}
return true;
}
/** Adds window and menu items for reopening and closing the console */
public void registerConsole(Map res, boolean show, String initVal) {
@ -186,8 +191,8 @@ public class MainFrame extends FrameView {
MsfguiLog.defaultLog.logSession(session);
sessionList.add(slist.get(sid));
if((session.get("type").equals("meterpreter") || session.get("type").equals("shell"))
&& sessionPopupMap.get(session.get("uuid")) == null)
sessionPopupMap.put(session.get("uuid"), new InteractWindow(
&& sessionWindowMap.get(session.get("id")+"console") == null)
sessionWindowMap.put(session.get("id")+"console", new InteractWindow(
rpcConn, session, session.get("type").toString()));
}
MsfguiLog.defaultLog.checkSessions(slist);//Alert the logger
@ -1141,8 +1146,8 @@ nameloop: for (int i = 0; i < names.length; i++) {
}// </editor-fold>//GEN-END:initComponents
private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
confirmStop();
System.exit(0);
if(confirmStop())
System.exit(0);
}//GEN-LAST:event_exitMenuItemActionPerformed
private void connectRpcMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_connectRpcMenuItemActionPerformed
@ -1446,7 +1451,7 @@ nameloop: for (int i = 0; i < names.length; i++) {
}
public void showInteractWindow() {
for(Map session : selectedSessions)
((InteractWindow)(sessionPopupMap.get(session.get("uuid")))).setVisible(true);
((InteractWindow)(sessionWindowMap.get(session.get("id")+"console"))).setVisible(true);
}
/* Master function to setup popup menus for jobs and sessions
* First handles jobs, then shell sessions, then meterpreter sessions,
@ -1535,12 +1540,12 @@ nameloop: for (int i = 0; i < names.length; i++) {
meterpreterPopupMenu = new JPopupMenu();
addSessionItem("Access Filesystem",meterpreterPopupMenu,new RpcAction(this) {
public void action(Map session) throws Exception {
new MeterpFileBrowser(rpcConn, session, sessionPopupMap).setVisible(true);
MeterpFileBrowser.showBrowser(rpcConn, session, sessionWindowMap);
}
});
addSessionItem("Processes",meterpreterPopupMenu,new RpcAction(this) {
public void action(Map session) throws Exception {
new ProcessList(rpcConn,session,sessionPopupMap).setVisible(true);
ProcessList.showList(rpcConn,session,sessionWindowMap);
}
});
addScript("Shell",meterpreterPopupMenu,new RpcAction(this) {
@ -1577,7 +1582,7 @@ nameloop: for (int i = 0; i < names.length; i++) {
addScript("Screenshot",monitorMenu,"multi_console_command -cl \"screenshot\"");
addSessionItem("View webcam",monitorMenu,new RpcAction(this) {
public void action(Map session) throws Exception {
new WebcamFrame(rpcConn,session).setVisible(true);
WebcamFrame.showWebcam(rpcConn,session,sessionWindowMap);
}
});

View File

@ -8,8 +8,9 @@
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<Events>
<EventHandler event="windowClosed" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosed"/>
<EventHandler event="windowGainedFocus" listener="java.awt.event.WindowFocusListener" parameters="java.awt.event.WindowEvent" handler="formWindowGainedFocus"/>
<EventHandler event="windowOpened" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowOpened"/>
<EventHandler event="windowClosed" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosed"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="2"/>

View File

@ -40,12 +40,22 @@ public class MeterpFileBrowser extends MsfFrame {
protected final DefaultTableModel model;
protected InteractWindow interactWin;
/** Shows file interaction window for a session, creating one if necessary */
static void showBrowser(RpcConnection rpcConn, Map session, Map sessionWindowMap) {
Object browserWindow = sessionWindowMap.get(session.get("id")+"fileBrowser");
if(browserWindow == null){
browserWindow = new MeterpFileBrowser(rpcConn,session,sessionWindowMap);
sessionWindowMap.put(session.get("id")+"fileBrowser",browserWindow);
}
((MsfFrame)browserWindow).setVisible(true);
}
/** Creates a new window for interacting with filesystem */
public MeterpFileBrowser(final RpcConnection rpcConn, final Map session, Map sessionPopupMap) {
super("Meterpreter remote file browsing");
this.rpcConn = rpcConn;
this.session = session;
this.interactWin = ((InteractWindow)sessionPopupMap.get(session.get("uuid")));
this.interactWin = ((InteractWindow)sessionPopupMap.get(session.get("id")+"console"));
this.lock = interactWin.lock;
files = new HashMap();
fileVector = new Vector(100);
@ -207,12 +217,14 @@ public class MeterpFileBrowser extends MsfFrame {
}
readTimer.stop();
TableHelper.fitColumnWidths(model, mainTable);
int nameColumn = mainTable.getColumnCount()-1;
int nameColumn = -1;
for(int i = 0; i < mainTable.getColumnCount(); i++)
if(mainTable.getColumnName(i).equals("Name"))
nameColumn = i;
mainTable.moveColumn(nameColumn, 0);
readTimer.stop();
if(nameColumn != -1){
mainTable.moveColumn(nameColumn, 0);
readTimer.stop();
}
} catch (Exception ex) {
ex.printStackTrace();
if(ex.getMessage().equals("unknown session"))
@ -259,13 +271,20 @@ public class MeterpFileBrowser extends MsfFrame {
goButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent evt) {
formWindowClosed(evt);
addWindowFocusListener(new java.awt.event.WindowFocusListener() {
public void windowGainedFocus(java.awt.event.WindowEvent evt) {
formWindowGainedFocus(evt);
}
public void windowLostFocus(java.awt.event.WindowEvent evt) {
}
});
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
}
public void windowClosed(java.awt.event.WindowEvent evt) {
formWindowClosed(evt);
}
});
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(msfgui.MsfguiApp.class).getContext().getResourceMap(MeterpFileBrowser.class);
@ -488,6 +507,11 @@ public class MeterpFileBrowser extends MsfFrame {
applyDirectoryChange();
}//GEN-LAST:event_addressFieldActionPerformed
private void formWindowGainedFocus(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowGainedFocus
if(!lock.isHeldByCurrentThread())
lock.lock();
}//GEN-LAST:event_formWindowGainedFocus
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField addressField;
private javax.swing.JButton deleteButton;

View File

@ -26,25 +26,18 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="mainScrollPane" pref="919" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Component id="mainScrollPane" alignment="0" pref="539" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="mainScrollPane" pref="884" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Component id="mainScrollPane" alignment="0" pref="536" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="mainScrollPane">
<Properties>
<Property name="horizontalScrollBarPolicy" type="int" value="31"/>
<Property name="name" type="java.lang.String" value="mainScrollPane" noResource="true"/>
</Properties>
@ -61,12 +54,12 @@
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="descriptionPane" alignment="0" pref="906" max="32767" attributes="0"/>
<Component id="descriptionPane" alignment="0" pref="497" max="32767" attributes="0"/>
<Component id="authorsLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="licenseLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="versionLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="targetsLabel" alignment="0" min="-2" pref="431" max="-2" attributes="0"/>
<Component id="payloadScrollPane" alignment="0" pref="906" max="32767" attributes="0"/>
<Component id="payloadScrollPane" alignment="0" pref="497" max="32767" attributes="0"/>
<Component id="titleLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="requiredLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="optionalLabel" alignment="0" min="-2" max="-2" attributes="0"/>
@ -119,7 +112,7 @@
<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"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>

View File

@ -17,11 +17,9 @@ import java.util.Map;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.ParallelGroup;
import javax.swing.GroupLayout.SequentialGroup;
import javax.swing.JEditorPane;
import javax.swing.JMenu;
import javax.swing.JOptionPane;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
@ -283,22 +281,15 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
encodingOpt.put("evasion", Boolean.TRUE);
options.put("Encoder", encodingOpt);
}
//Display each option
for (Object optionName : options.keySet()) {
Map option = (Map)options.get(optionName); //{desc=blah, evasion=fals, advanced=false, required=true, type=port, default=blah}
JScrollPane containerPane = new JScrollPane();
containerPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
JEditorPane tempText = new JEditorPane();
tempText.setContentType("text/html");
tempText.setEditable(false);
javax.swing.JLabel tempText = new javax.swing.JLabel();
tempText.setText("<html><b>"+optionName.toString()+"</b> " + option.get("desc") + "</html>");
containerPane.setViewportView(tempText);
containerPane.setViewportBorder(null);
containerPane.setBorder(null);
tempText.setBorder(null);
mainPanel.add(containerPane);
tempText.setBackground(authorsLabel.getBackground());
tempText.setPreferredSize(new java.awt.Dimension(descriptionBox.getWidth(),authorsLabel.getHeight()*2));
tempText.setVerticalAlignment(javax.swing.JLabel.BOTTOM);
mainPanel.add(tempText);//mainPanel.add(containerPane);
tempText.setFont(authorsLabel.getFont());
JTextField optionField = new JTextField();
if (option.get("default") != null) {
@ -311,13 +302,13 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
optionField.setName("field" + optionName);
mainPanel.add(optionField);
if(option.get("required").equals(Boolean.TRUE)){
requiredOpts.add(containerPane);
requiredOpts.add(tempText);
requiredOpts.add(optionField);
}else if (option.get("advanced").equals(Boolean.FALSE) && option.get("evasion").equals(Boolean.FALSE)){
optionalOpts.add(containerPane);
optionalOpts.add(tempText);
optionalOpts.add(optionField);
}else{
advancedOpts.add(containerPane);
advancedOpts.add(tempText);
advancedOpts.add(optionField);
}
}
@ -394,14 +385,14 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
GroupLayout mainPanelLayout = (GroupLayout)mainPanel.getLayout();
ParallelGroup horizGroup = mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(titleLabel)
.addComponent(descriptionPane, javax.swing.GroupLayout.DEFAULT_SIZE, 526, Short.MAX_VALUE)
.addComponent(descriptionPane, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
.addComponent(authorsLabel)
.addComponent(licenseLabel)
.addComponent(versionLabel);
//Exploit only stuff
if(moduleType.equals("exploit")){
horizGroup.addComponent(targetsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 431, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(payloadScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 529, Short.MAX_VALUE);
horizGroup.addComponent(targetsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(payloadScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE);
}
horizGroup.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);
@ -429,13 +420,9 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
SequentialGroup vGroup = mainPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(titleLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(descriptionPane, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(authorsLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(licenseLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(versionLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED);
//Exploit only stuff
@ -450,15 +437,15 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
vGroup = vGroup.addComponent(payloadScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 296, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED);
}
boolean odd = false;
odd = addObjectsToVgroup(vGroup, odd, requiredLabel, requiredOpts);
addObjectsToVgroup(vGroup, requiredLabel, requiredOpts);
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.addGroup(mainPanelLayout.createParallelGroup()
addObjectsToVgroup(vGroup, optionalLabel, optionalOpts);
addObjectsToVgroup(vGroup, advancedLabel, advancedOpts);
vGroup = vGroup.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup()
.addComponent(exploitButton)
.addComponent(consoleRunButton1))
.addContainerGap();
@ -466,16 +453,10 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
}
//helper for grouping
private boolean addObjectsToVgroup(SequentialGroup vGroup, boolean odd, Component label, ArrayList opts) {
vGroup = vGroup.addComponent(label, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED);
for (Object obj : opts) {
private void addObjectsToVgroup(SequentialGroup vGroup, Component label, ArrayList opts) {
vGroup = vGroup.addComponent(label, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE);
for (Object obj : opts)
vGroup.addComponent((Component) obj, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE);
if (odd)
vGroup.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED);
odd = !odd;
}
return odd;
}
/** This method is called from within the constructor to
@ -509,7 +490,6 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
mainScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
mainScrollPane.setName("mainScrollPane"); // NOI18N
mainPanel.setName("mainPanel"); // NOI18N
@ -594,12 +574,12 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
.addGroup(mainPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(descriptionPane, javax.swing.GroupLayout.DEFAULT_SIZE, 906, Short.MAX_VALUE)
.addComponent(descriptionPane, javax.swing.GroupLayout.DEFAULT_SIZE, 497, Short.MAX_VALUE)
.addComponent(authorsLabel)
.addComponent(licenseLabel)
.addComponent(versionLabel)
.addComponent(targetsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 431, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(payloadScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 906, Short.MAX_VALUE)
.addComponent(payloadScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 497, Short.MAX_VALUE)
.addComponent(titleLabel)
.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)
@ -645,7 +625,7 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(exploitButton1)
.addComponent(consoleRunButton1))
.addContainerGap(95, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
mainScrollPane.setViewportView(mainPanel);
@ -654,15 +634,11 @@ public class ModulePopup extends MsfFrame implements TreeSelectionListener{
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(mainScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 919, Short.MAX_VALUE)
.addContainerGap())
.addComponent(mainScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 539, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(mainScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 884, Short.MAX_VALUE)
.addContainerGap())
.addComponent(mainScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 536, Short.MAX_VALUE)
);
pack();

View File

@ -27,34 +27,30 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="imageLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="appTitleLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="appDescLabel" alignment="0" pref="290" max="32767" attributes="0"/>
<Component id="closeButton" alignment="1" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="versionLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="vendorLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="homepageLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="versionLabel" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="appVersionLabel" alignment="0" min="-2" max="-2" attributes="1"/>
<Component id="appHomepageLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Component id="appVersionLabel" alignment="0" max="32767" attributes="1"/>
<Component id="appVendorLabel" alignment="0" max="32767" attributes="1"/>
</Group>
</Group>
</Group>
<Component id="appTitleLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="appDescLabel" alignment="0" pref="266" max="32767" attributes="0"/>
<Component id="closeButton" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="imageLabel" min="-2" pref="302" max="32767" attributes="0"/>
<Component id="imageLabel" min="-2" pref="305" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="appTitleLabel" min="-2" max="-2" attributes="0"/>
@ -65,17 +61,12 @@
<Component id="versionLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="appVersionLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="vendorLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="appVendorLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="homepageLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="appHomepageLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="128" max="32767" attributes="0"/>
<EmptySpace pref="134" max="32767" attributes="0"/>
<Component id="closeButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
@ -127,31 +118,6 @@
<Property name="name" type="java.lang.String" value="appVersionLabel" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="vendorLabel">
<Properties>
<Property name="font" type="java.awt.Font" noResource="true" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="true" component="vendorLabel" property="font" relativeSize="true" size="0"/>
</FontInfo>
</Property>
<Property name="text" type="java.lang.String" resourceKey="vendorLabel.text"/>
<Property name="name" type="java.lang.String" value="vendorLabel" noResource="true"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="appVendorLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="Application.vendor"/>
<Property name="name" type="java.lang.String" value="appVendorLabel" noResource="true"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="homepageLabel">
<Properties>
<Property name="font" type="java.awt.Font" noResource="true" editor="org.netbeans.modules.form.editors2.FontEditor">

View File

@ -33,8 +33,6 @@ public class MsfguiAboutBox extends javax.swing.JDialog {
javax.swing.JLabel appTitleLabel = new javax.swing.JLabel();
javax.swing.JLabel versionLabel = new javax.swing.JLabel();
appVersionLabel = new javax.swing.JLabel();
javax.swing.JLabel vendorLabel = new javax.swing.JLabel();
javax.swing.JLabel appVendorLabel = new javax.swing.JLabel();
javax.swing.JLabel homepageLabel = new javax.swing.JLabel();
javax.swing.JLabel appHomepageLabel = new javax.swing.JLabel();
javax.swing.JLabel appDescLabel = new javax.swing.JLabel();
@ -61,13 +59,6 @@ public class MsfguiAboutBox extends javax.swing.JDialog {
appVersionLabel.setText(resourceMap.getString("Application.version")); // NOI18N
appVersionLabel.setName("appVersionLabel"); // NOI18N
vendorLabel.setFont(vendorLabel.getFont().deriveFont(vendorLabel.getFont().getStyle() | java.awt.Font.BOLD));
vendorLabel.setText(resourceMap.getString("vendorLabel.text")); // NOI18N
vendorLabel.setName("vendorLabel"); // NOI18N
appVendorLabel.setText(resourceMap.getString("Application.vendor")); // NOI18N
appVendorLabel.setName("appVendorLabel"); // NOI18N
homepageLabel.setFont(homepageLabel.getFont().deriveFont(homepageLabel.getFont().getStyle() | java.awt.Font.BOLD));
homepageLabel.setText(resourceMap.getString("homepageLabel.text")); // NOI18N
homepageLabel.setName("homepageLabel"); // NOI18N
@ -89,25 +80,22 @@ public class MsfguiAboutBox extends javax.swing.JDialog {
.addComponent(imageLabel)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(appTitleLabel, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(appDescLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 290, Short.MAX_VALUE)
.addComponent(closeButton)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(versionLabel)
.addComponent(vendorLabel)
.addComponent(homepageLabel))
.addComponent(homepageLabel)
.addComponent(versionLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(appHomepageLabel)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(appVersionLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(appVendorLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addComponent(appTitleLabel, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(appDescLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 266, Short.MAX_VALUE)
.addComponent(closeButton))
.addComponent(appVersionLabel)
.addComponent(appHomepageLabel))))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(imageLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 302, Short.MAX_VALUE)
.addComponent(imageLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 305, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(appTitleLabel)
@ -118,14 +106,10 @@ public class MsfguiAboutBox extends javax.swing.JDialog {
.addComponent(versionLabel)
.addComponent(appVersionLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(vendorLabel)
.addComponent(appVendorLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(homepageLabel)
.addComponent(appHomepageLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 128, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 134, Short.MAX_VALUE)
.addComponent(closeButton)
.addContainerGap())
);

View File

@ -82,7 +82,7 @@ public class PayloadPopup extends MsfFrame {
ParallelGroup labelGroup = mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING);
//make label group
for(int i = 0; i < elementVector.size(); i++)
labelGroup = labelGroup.addComponent(((Component[])elementVector.get(i))[0]);
labelGroup = labelGroup.addComponent(((Component[])elementVector.get(i))[0], javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE);
//make text box group
ParallelGroup textBoxGroup = mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING);
for(int i = 0; i < elementVector.size(); i++)
@ -240,7 +240,7 @@ public class PayloadPopup extends MsfFrame {
private void addOption(Object optionName, Map option) {
JLabel lab = new JLabel();
mainPanel.add(lab);
lab.setText(optionName + " " + option.get("desc"));
lab.setText("<html><b>"+optionName.toString()+"</b> " + option.get("desc") + "</html>");
lab.setName(optionName.toString());
JTextField optionField = new JTextField();
if (option.get("default") != null)

View File

@ -3,6 +3,7 @@ package msfgui;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;
import javax.swing.JOptionPane;
@ -20,6 +21,16 @@ public class ProcessList extends MsfFrame {
protected final DefaultTableModel model;
protected Timer readTimer = null;
/** Shows process list window for a session, creating one if necessary */
static void showList(RpcConnection rpcConn, Map session, Map sessionWindowMap) {
Object processListWindow = sessionWindowMap.get(session.get("id")+"procList");
if(processListWindow == null){
processListWindow = new ProcessList(rpcConn,session,sessionWindowMap);
sessionWindowMap.put(session.get("id")+"procList",processListWindow);
}
((MsfFrame)processListWindow).setVisible(true);
}
/** Creates new form ProcessList */
public ProcessList(final RpcConnection rpcConn, final Map session, Map sessionPopupMap) {
super("Meterpreter remote process list");
@ -34,7 +45,7 @@ public class ProcessList extends MsfFrame {
processTable.setShowVerticalLines(false);
this.rpcConn = rpcConn;
this.session = session;
this.lock = ((InteractWindow)sessionPopupMap.get(session.get("uuid"))).lock;
this.lock = ((InteractWindow)sessionPopupMap.get(session.get("id")+"console")).lock;
}
/** Lists the processes that are running */

View File

@ -19,6 +19,7 @@ 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;
@ -195,29 +196,34 @@ public class RpcConnection {
}
/** Receives an XMLRPC response and converts to an object */
protected Object readResp() throws Exception{
//read bytes
ByteArrayOutputStream cache = new ByteArrayOutputStream();
int val;
try{
while((val = sin.read()) != 0){
if(val == -1)
throw new MsfException("Stream died.");
cache.write(val);
}
} catch (IOException ex) {
throw new MsfException("Error reading response.");
}
//parse the response: <methodResponse><params><param><value>...
ByteArrayInputStream is = new ByteArrayInputStream(cache.toByteArray());
//Will store our response
StringBuilder sb = new StringBuilder();
int a = is.read();
while(a != -1){
if(!Character.isISOControl(a))
sb.append((char)a);
//else
// sb.append("&#x").append(Integer.toHexString(a)).append(';');
a = is.read();
}
int len;
do{
//read bytes
ByteArrayOutputStream cache = new ByteArrayOutputStream();
int val;
try{
while((val = sin.read()) != 0){
if(val == -1)
throw new MsfException("Stream died.");
cache.write(val);
}
} catch (IOException ex) {
throw new MsfException("Error reading response.");
}
//parse the response: <methodResponse><params><param><value>...
ByteArrayInputStream is = new ByteArrayInputStream(cache.toByteArray());
int a = is.read();
while(a != -1){
if(!Character.isISOControl(a) || a == '\t')
sb.append((char)a);
//else
// sb.append("&#x").append(Integer.toHexString(a)).append(';');
a = is.read();
}
len = sb.length();//Check to make sure we aren't stopping on an embedded null
} while (sb.lastIndexOf("</methodResponse>") < len - 20 || len < 30);
Document root = DocumentBuilderFactory.newInstance().newDocumentBuilder()
.parse(new ByteArrayInputStream(sb.toString().getBytes()));
@ -309,10 +315,15 @@ public class RpcConnection {
keysb.append(params[i].toString());
String key = keysb.toString();
Object result = callCache.get(key);
if(result != null)
return result;
result = exec(methodName, params);
callCache.put(key, result);
if(result == null){
result = exec(methodName, params);
callCache.put(key, result);
}
if(result instanceof Map){
HashMap clone = new HashMap();
clone.putAll((Map)result);
return clone;
}
return result;
}
return exec(methodName, params);
@ -320,6 +331,11 @@ 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"
+ "Exit before making a new connection.");
throw new RuntimeException("Already connected");
}
return new Task<RpcConnection, Void>(mainFrame.getApplication()){
private RpcConnection myRpcConn;
@Override

View File

@ -29,6 +29,16 @@ public class WebcamFrame extends MsfFrame {
imageCommand = new StringBuffer("r");
}
/** Shows webcam window for a session, creating one if necessary */
static void showWebcam(RpcConnection rpcConn, Map session, Map sessionWindowMap) {
Object webcamWindow = sessionWindowMap.get(session.get("id")+"webcam");
if(webcamWindow == null){
webcamWindow = new WebcamFrame(rpcConn,session);
sessionWindowMap.put(session.get("id")+"webcam",webcamWindow);
}
((MsfFrame)webcamWindow).setVisible(true);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is

View File

@ -6,8 +6,6 @@ appDescLabel.text=<html>A Java GUI to the Metasploit Framework created by script
versionLabel.text=Version\:
vendorLabel.text=Vendor\:
homepageLabel.text=Homepage\:
#NOI18N

View File

@ -2,8 +2,7 @@
Application.name = msfguiJDesktop
Application.title = msfgui
Application.version = 5
Application.vendor = Metasploit LLC
Application.version = 3
Application.homepage = http\://www.metasploit.com/
Application.description = A Java GUI to the Metasploit Framework.
Application.vendorId = Metasploit