Skip to content

Commit

Permalink
Minor UI improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
hvqzao committed Apr 16, 2018
1 parent e48b765 commit 7c3f627
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 18 deletions.
53 changes: 45 additions & 8 deletions src/hvqzao/flow/FlowExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import java.awt.Dialog;
import java.io.PrintWriter;
import java.util.List;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.RowSorter;
import javax.swing.SortOrder;
Expand All @@ -76,10 +77,12 @@

public class FlowExtension implements IBurpExtender, ITab, IHttpListener, IScopeChangeListener, IExtensionStateListener {

private final String version = "Flow v1.22 (2017-11-16)";
// Changes in v1.22:
// - "Add new sitemap issue" now supports request & response highlight marks
// - Updated coloring theme
private final String version = "Flow v1.23 (2018-04-16) (unreleased)";
// Changes in v1.23:
// - Center "Add new sitemap issue" dialog, resize according to preferred size
// - Filter by search term does not break window anymore when search is too long
// - Displaying path instead of pathQuery in URL column
// - Added out-of-scope filter
//
//private final String versionFull = "<html>" + version + ", <a href=\"https://github.com/hvqzao/burp-flow\">https://github.com/hvqzao/burp-flow</a>, MIT license</html>";
private static IBurpExtenderCallbacks callbacks;
Expand All @@ -98,6 +101,7 @@ public class FlowExtension implements IBurpExtender, ITab, IHttpListener, IScope
private boolean flowFilterPopupReady;
private JLabel flowFilter;
private JCheckBox flowFilterInscope;
private JCheckBox flowFilterOutofscope;
private JCheckBox flowFilterParametrized;
private JTextField flowFilterSearchField;
private JCheckBox flowFilterSearchCaseSensitive;
Expand Down Expand Up @@ -272,6 +276,7 @@ public void actionPerformed(ActionEvent e) {
flowFilterCaptureSourceExtender = flowFilterPopup.getFlowFilterCaptureSourceExtender();
flowFilterCaptureSourceExtenderOnly = flowFilterPopup.getFlowFilterCaptureSourceExtenderOnly();
flowFilterInscope = flowFilterPopup.getFlowFilterInscope();
flowFilterOutofscope = flowFilterPopup.getFlowFilterOutofscope();
flowFilterParametrized = flowFilterPopup.getFlowFilterParametrized();
flowFilterSearchCaseSensitive = flowFilterPopup.getFlowFilterSearchCaseSensitive();
flowFilterSearchField = flowFilterPopup.getFlowFilterSearchField();
Expand Down Expand Up @@ -354,7 +359,22 @@ private void process() {
flowFilterUpdate();
}
});
flowFilterInscope.addActionListener(flowFilterScopeUpdateAction);
//flowFilterInscope.addActionListener(flowFilterScopeUpdateAction);
//flowFilterOutofscope.addActionListener(flowFilterScopeUpdateAction);
flowFilterInscope.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flowFilterOutofscope.setSelected(false);
flowFilterUpdate();
}
});
flowFilterOutofscope.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
flowFilterInscope.setSelected(false);
flowFilterUpdate();
}
});
flowFilterParametrized.addActionListener(flowFilterScopeUpdateAction);
flowFilterSearchCaseSensitive.addActionListener(flowFilterScopeUpdateAction);
flowFilterSearchNegative.addActionListener(flowFilterScopeUpdateAction);
Expand Down Expand Up @@ -954,7 +974,9 @@ private boolean showAddNewIssueDialog() {
//
// wrap optionsPane
wrapper.getScrollPane().getViewport().add(addNewIssue);
dialog.setBounds(100, 100, 1070, 670);
//dialog.setBounds(100, 100, 1070, 670);
Dimension dim = ((JComponent) addNewIssue).getPreferredSize();
dialog.setBounds(100, 100, (int) Math.round(dim.getWidth() * 1.33), (int) Math.round(dim.getHeight() * 1.50));
dialog.setContentPane(wrapper);
//
modalResult = false;
Expand Down Expand Up @@ -988,7 +1010,7 @@ public void actionPerformed(ActionEvent e) {
dialog.dispose();
}
});
dialog.setLocationRelativeTo(flowComponent);
dialog.setLocationRelativeTo(null);
dialog.setVisible(true);
//
return modalResult;
Expand Down Expand Up @@ -1310,6 +1332,7 @@ private boolean toolFlagCaptureProcessing(int toolFlag) {
// flow filter default
private void flowFilterSetDefaults() {
flowFilterInscope.setSelected(false);
flowFilterOutofscope.setSelected(false);
flowFilterParametrized.setSelected(false);
flowFilterSearchField.setText("");
flowFilterSearchCaseSensitive.setSelected(false);
Expand Down Expand Up @@ -1389,6 +1412,10 @@ private void flowFilterUpdateDescription(boolean show) {
filterDescription.append("In-scope, ");
filterAll = false;
}
if (flowFilterOutofscope.isSelected()) {
filterDescription.append("Out-of-scope, ");
filterAll = false;
}
if (flowFilterParametrized.isSelected()) {
filterDescription.append("Parametrized only, ");
filterAll = false;
Expand Down Expand Up @@ -1594,6 +1621,10 @@ public boolean include(javax.swing.RowFilter.Entry<? extends FlowTableModel, ? e
if (result && flowFilterInscope.isSelected() && !callbacks.isInScope(flowEntry.url)) {
result = false;
}
// out-of-scope
if (result && flowFilterOutofscope.isSelected() && callbacks.isInScope(flowEntry.url)) {
result = false;
}
// parametrized
if (result && flowFilterParametrized.isSelected() && !flowEntry.hasParams) {
result = false;
Expand Down Expand Up @@ -1860,7 +1891,7 @@ public Object getValueAt(int rowIndex, int columnIndex) {
case 3:
return flowEntry.method;
case 4:
return flowEntry.getQueryPath(); //url.getPath();
return flowEntry.getPath(); //flowEntry.getQueryPath();
case 5:
return new String(new char[flowEntry.getReflections().size()]).replace("\0", "|");
case 6:
Expand Down Expand Up @@ -1936,6 +1967,7 @@ public static final class FlowEntry {
private String mime;
private final Date date;
private String comment;
private final String path;
private final String queryPath;
private final ArrayList<IParameter> reflections;
private final IHttpService service;
Expand Down Expand Up @@ -1990,6 +2022,7 @@ void onResponse(byte[] response) {
url = requestInfo.getUrl();
service = messageInfo.getHttpService();
reflections = new ArrayList<>();
path = url.getPath();
{
StringBuilder pathBuilder = new StringBuilder(url.getPath());
String query = url.getQuery();
Expand Down Expand Up @@ -2038,6 +2071,10 @@ public String getQueryPath() {
return queryPath;
}

public String getPath() {
return path;
}

public ArrayList<IParameter> getReflections() {
return reflections;
}
Expand Down
25 changes: 20 additions & 5 deletions src/hvqzao/flow/FlowFilterPopup.form
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,11 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="FlowFilterInscope" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="FlowFilterInscope" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="FlowFilterOutofscope" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="FlowFilterParametrized" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
Expand All @@ -152,7 +156,10 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="FlowFilterInscope" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="FlowFilterInscope" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="FlowFilterOutofscope" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<Component id="FlowFilterParametrized" min="-2" max="-2" attributes="0"/>
</Group>
Expand All @@ -162,7 +169,7 @@
<SubComponents>
<Component class="javax.swing.JCheckBox" name="FlowFilterInscope">
<Properties>
<Property name="text" type="java.lang.String" value="Show only in-scope items"/>
<Property name="text" type="java.lang.String" value="Show only in-scope"/>
</Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleName" type="java.lang.String" value="FlowFilterInscope"/>
Expand All @@ -173,6 +180,11 @@
<Property name="text" type="java.lang.String" value="Show only parametrized requests"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="FlowFilterOutofscope">
<Properties>
<Property name="text" type="java.lang.String" value="out-of-scope items"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="FlowFilterBySearch">
Expand All @@ -187,7 +199,6 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="FlowFilterSearchField" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
Expand All @@ -203,7 +214,11 @@
</Group>
<Component id="FlowFilterSearchNegative" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="10" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="FlowFilterSearchField" min="-2" pref="242" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down
26 changes: 21 additions & 5 deletions src/hvqzao/flow/FlowFilterPopup.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public FlowFilterPopup() {
callbacks.customizeUiComponent(FlowFilterCaptureSourceSpider);
callbacks.customizeUiComponent(FlowFilterCaptureSourceSpiderOnly);
callbacks.customizeUiComponent(FlowFilterInscope);
callbacks.customizeUiComponent(FlowFilterOutofscope);
callbacks.customizeUiComponent(FlowFilterParametrized);
callbacks.customizeUiComponent(FlowFilterSearchCaseSensitive);
callbacks.customizeUiComponent(FlowFilterSearchField);
Expand Down Expand Up @@ -150,6 +151,10 @@ public JCheckBox getFlowFilterInscope() {
return FlowFilterInscope;
}

public JCheckBox getFlowFilterOutofscope() {
return FlowFilterOutofscope;
}

public JCheckBox getFlowFilterParametrized() {
return FlowFilterParametrized;
}
Expand Down Expand Up @@ -252,6 +257,7 @@ private void initComponents() {
FlowFilterByReqType = new javax.swing.JPanel();
FlowFilterInscope = new javax.swing.JCheckBox();
FlowFilterParametrized = new javax.swing.JCheckBox();
FlowFilterOutofscope = new javax.swing.JCheckBox();
FlowFilterBySearch = new javax.swing.JPanel();
FlowFilterSearchField = new javax.swing.JTextField();
FlowFilterSearchCaseSensitive = new javax.swing.JCheckBox();
Expand Down Expand Up @@ -306,24 +312,31 @@ private void initComponents() {

FlowFilterByReqType.setBorder(javax.swing.BorderFactory.createTitledBorder("Filter by request type"));

FlowFilterInscope.setText("Show only in-scope items");
FlowFilterInscope.setText("Show only in-scope");

FlowFilterParametrized.setText("Show only parametrized requests");

FlowFilterOutofscope.setText("out-of-scope items");

javax.swing.GroupLayout FlowFilterByReqTypeLayout = new javax.swing.GroupLayout(FlowFilterByReqType);
FlowFilterByReqType.setLayout(FlowFilterByReqTypeLayout);
FlowFilterByReqTypeLayout.setHorizontalGroup(
FlowFilterByReqTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(FlowFilterByReqTypeLayout.createSequentialGroup()
.addGroup(FlowFilterByReqTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(FlowFilterInscope)
.addGroup(FlowFilterByReqTypeLayout.createSequentialGroup()
.addComponent(FlowFilterInscope)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(FlowFilterOutofscope))
.addComponent(FlowFilterParametrized))
.addGap(0, 0, Short.MAX_VALUE))
);
FlowFilterByReqTypeLayout.setVerticalGroup(
FlowFilterByReqTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(FlowFilterByReqTypeLayout.createSequentialGroup()
.addComponent(FlowFilterInscope)
.addGroup(FlowFilterByReqTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(FlowFilterInscope)
.addComponent(FlowFilterOutofscope))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(FlowFilterParametrized))
);
Expand All @@ -346,7 +359,6 @@ private void initComponents() {
FlowFilterBySearch.setLayout(FlowFilterBySearchLayout);
FlowFilterBySearchLayout.setHorizontalGroup(
FlowFilterBySearchLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(FlowFilterSearchField)
.addGroup(FlowFilterBySearchLayout.createSequentialGroup()
.addGap(1, 1, 1)
.addGroup(FlowFilterBySearchLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
Expand All @@ -359,7 +371,10 @@ private void initComponents() {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(FlowFilterSearchResponse))
.addComponent(FlowFilterSearchNegative))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(10, Short.MAX_VALUE))
.addGroup(FlowFilterBySearchLayout.createSequentialGroup()
.addComponent(FlowFilterSearchField, javax.swing.GroupLayout.PREFERRED_SIZE, 242, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
FlowFilterBySearchLayout.setVerticalGroup(
FlowFilterBySearchLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
Expand Down Expand Up @@ -645,6 +660,7 @@ private void initComponents() {
private javax.swing.JCheckBox FlowFilterCaptureSourceTarget;
private javax.swing.JCheckBox FlowFilterCaptureSourceTargetOnly;
private javax.swing.JCheckBox FlowFilterInscope;
private javax.swing.JCheckBox FlowFilterOutofscope;
private javax.swing.JCheckBox FlowFilterParametrized;
private javax.swing.JCheckBox FlowFilterSearchCaseSensitive;
private javax.swing.JTextField FlowFilterSearchField;
Expand Down

0 comments on commit 7c3f627

Please sign in to comment.