Fixes #3290, allows address to be specified in an address bar and allows downloading multiple files.

git-svn-id: file:///home/svn/framework3/trunk@11229 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Weeks 2010-12-05 20:06:28 +00:00
parent 05f7a90e19
commit d28cc9bb5a
4 changed files with 85 additions and 20 deletions

Binary file not shown.

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" ?>
<?xml version="1.1" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
@ -29,10 +29,10 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="0" pref="731" max="32767" attributes="0"/>
<Component id="jScrollPane1" alignment="0" pref="739" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Component id="refreshButton" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="69" max="32767" attributes="0"/>
<EmptySpace pref="94" max="32767" attributes="0"/>
<Component id="recSearchDownloadButton" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="dirButton" min="-2" max="-2" attributes="0"/>
@ -44,9 +44,13 @@
<Component id="downloadButton" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="pwdLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="upButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="pwdLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="addressField" pref="580" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="goButton" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
@ -58,8 +62,10 @@
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="pwdLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="addressField" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="upButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="pwdLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="goButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="532" max="32767" attributes="0"/>
@ -172,5 +178,23 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="recSearchDownloadButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="addressField">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="addressField.text"/>
<Property name="name" type="java.lang.String" value="addressField" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addressFieldActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="goButton">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="goButton.text"/>
<Property name="name" type="java.lang.String" value="goButton" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="goButtonActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -188,7 +188,7 @@ public class MeterpFileBrowser extends MsfFrame {
for(String line : lines){
line = line.trim();
if(line.startsWith("Listing")){
pwdLabel.setText(line);
addressField.setText(line.substring(line.indexOf(' ')+1));
}else if(line.startsWith("Mode")){
headerNames = line;
}else if(line.startsWith("-")){
@ -255,6 +255,8 @@ public class MeterpFileBrowser extends MsfFrame {
mainTable = new javax.swing.JTable();
upButton = new javax.swing.JButton();
recSearchDownloadButton = new javax.swing.JButton();
addressField = new javax.swing.JTextField();
goButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter() {
@ -339,6 +341,22 @@ public class MeterpFileBrowser extends MsfFrame {
}
});
addressField.setText(resourceMap.getString("addressField.text")); // NOI18N
addressField.setName("addressField"); // NOI18N
addressField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addressFieldActionPerformed(evt);
}
});
goButton.setText(resourceMap.getString("goButton.text")); // NOI18N
goButton.setName("goButton"); // NOI18N
goButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
goButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
@ -346,10 +364,10 @@ public class MeterpFileBrowser extends MsfFrame {
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 731, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 739, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(refreshButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 69, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 94, Short.MAX_VALUE)
.addComponent(recSearchDownloadButton)
.addGap(18, 18, 18)
.addComponent(dirButton)
@ -360,9 +378,13 @@ public class MeterpFileBrowser extends MsfFrame {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(downloadButton))
.addGroup(layout.createSequentialGroup()
.addComponent(upButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pwdLabel)
.addGap(18, 18, 18)
.addComponent(upButton)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(addressField, javax.swing.GroupLayout.DEFAULT_SIZE, 580, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(goButton)))
.addContainerGap())
);
layout.setVerticalGroup(
@ -370,8 +392,10 @@ public class MeterpFileBrowser extends MsfFrame {
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(addressField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(upButton)
.addComponent(pwdLabel)
.addComponent(upButton))
.addComponent(goButton))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@ -436,7 +460,7 @@ public class MeterpFileBrowser extends MsfFrame {
private void recSearchDownloadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_recSearchDownloadButtonActionPerformed
try{
String currentDir = pwdLabel.getText().substring(pwdLabel.getText().indexOf(' ')+1);
String currentDir = addressField.getText();
rpcConn.execute("session.meterpreter_script", session.get("id"),
new SearchDwldOptionsDialog(this, currentDir).toString());
setVisible(false);
@ -448,10 +472,28 @@ public class MeterpFileBrowser extends MsfFrame {
}
}//GEN-LAST:event_recSearchDownloadButtonActionPerformed
//Applies given directory change
private void applyDirectoryChange(){
if(addressField.getText().equals("/"))
executeCommand("cd /../"); //Weird annonying bug. "cd /" doesn't work
else
executeCommand("cd \"" + MsfguiApp.doubleBackslashes(addressField.getText()) + "\"");
getFiles();
}
private void goButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_goButtonActionPerformed
applyDirectoryChange();
}//GEN-LAST:event_goButtonActionPerformed
private void addressFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addressFieldActionPerformed
applyDirectoryChange();
}//GEN-LAST:event_addressFieldActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField addressField;
private javax.swing.JButton deleteButton;
private javax.swing.JButton dirButton;
private javax.swing.JButton downloadButton;
private javax.swing.JButton goButton;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable mainTable;
private javax.swing.JLabel pwdLabel;
@ -461,17 +503,14 @@ public class MeterpFileBrowser extends MsfFrame {
private javax.swing.JButton uploadButton;
// End of variables declaration//GEN-END:variables
//Downloads selected files, and folders recursively if desired.
private void download() {
int indx = mainTable.getSelectedRow();
if (indx == -1)
return;
Object o = mainTable.getValueAt(indx, 0);
String clickedFile = o.toString();
fchooser.setDialogTitle("Select destination folder");
fchooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
if(fchooser.showSaveDialog(this) != JFileChooser.APPROVE_OPTION)
return;
executeCommand("lcd \""+MsfguiApp.cleanBackslashes(fchooser.getSelectedFile().toString()) + "\"");
executeCommand("download \""+clickedFile + "\"");
for(int indx : mainTable.getSelectedRows())
executeCommand("download \""+mainTable.getValueAt(indx, 0) + "\"");
}
}

View File

@ -3,6 +3,8 @@ downloadButton.text=Download
deleteButton.text=Delete
dirButton.text=Make Directory
refreshButton.text=Refresh
pwdLabel.text=Listing Current Directory
pwdLabel.text=Listing
upButton.text=Go up
recSearchDownloadButton.text=Recursive search/download
goButton.text=Go
addressField.text=