Skip to content

Commit

Permalink
Added ignore url pattern option
Browse files Browse the repository at this point in the history
  • Loading branch information
moloch-- committed Oct 15, 2020
1 parent d448cf9 commit 2a09d85
Show file tree
Hide file tree
Showing 5 changed files with 311 additions and 106 deletions.
32 changes: 30 additions & 2 deletions src/burp/Multiplayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.DefaultListModel;

/**
Expand All @@ -33,13 +35,15 @@ public class Multiplayer implements IHttpListener, OnEditCallback {
private Boolean ignoreScanner = true;
private Boolean sendToImpliesInProgress = true;

private DefaultListModel<Pattern> ignoredURLPatterns = new DefaultListModel<>();

private DefaultListModel<String> ignoredExtensions = new DefaultListModel<>();
private List<String> defaultIgnoredExtensions = new ArrayList<String>(Arrays.asList(
private final List<String> defaultIgnoredExtensions = new ArrayList<>(Arrays.asList(
"js", "woff", "woff2", "jpg", "jpeg", "png", "gif", "css", "txt"
));

private DefaultListModel<String> ignoredStatusCodes = new DefaultListModel<>();
private final List<String> defaultIgnoredStatusCodes = new ArrayList<String>(Arrays.asList(
private final List<String> defaultIgnoredStatusCodes = new ArrayList<>(Arrays.asList(
"404"
));

Expand Down Expand Up @@ -202,6 +206,18 @@ public void removeIgnoredStatusCodes(String statusCode) {
public void clearIgnoredStatusCodes() {
ignoredStatusCodes.removeAllElements();
}

public void addIgnoredURLPattern(Pattern pattern) {
ignoredURLPatterns.addElement(pattern);
}

public void removeIgnoredURLPattern(Pattern pattern) {
ignoredURLPatterns.removeElement(pattern);
}

public DefaultListModel<Pattern> getIgnoredURLPatterns() {
return ignoredURLPatterns;
}

// Burp HTTP Callback
@Override
Expand Down Expand Up @@ -234,6 +250,18 @@ public void processHttpMessage(int toolFlag, boolean messageIsRequest, IHttpRequ
logger.debug("Ignore: file ext (%s)", getFileExtension(url));
return;
}

// Is ignored URL pattern?
if (0 < ignoredURLPatterns.size()) {
for (int index = 0; index < ignoredURLPatterns.size(); ++index) {
Pattern pattern = ignoredURLPatterns.getElementAt(index);
Matcher matcher = pattern.matcher(url.toString());
if (matcher.find()) {
logger.debug("Ignore: url pattern '%s'", pattern);
return;
}
}
}

http().insert(reqRespToRethink(burpReqResp)).run(dbConn);
}
Expand Down
8 changes: 8 additions & 0 deletions src/burp/gui/InScopePane.form
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="stateProgressBar" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="exportSpreadsheetButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
Expand All @@ -54,6 +56,7 @@
<Component id="blockedStateCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="stateProgressBar" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="parentSplitPane" pref="682" max="32767" attributes="0"/>
Expand Down Expand Up @@ -175,5 +178,10 @@
<Property name="stringPainted" type="boolean" value="true"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" value="jButton1"/>
</Properties>
</Component>
</SubComponents>
</Form>
19 changes: 15 additions & 4 deletions src/burp/gui/InScopePane.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public final class InScopePane extends javax.swing.JPanel implements TableModelL

/**
* Creates new form InScopePane
* @param multiplayer
* @param logger
*/
public InScopePane(Multiplayer multiplayer, MultiplayerLogger logger) {
this.callbacks = logger.callbacks;
Expand All @@ -71,7 +73,7 @@ public InScopePane(Multiplayer multiplayer, MultiplayerLogger logger) {
setMinColumnWidths();

// Highlight column
int highlightColumnIndex = multiplayer.history.columns.indexOf(HTTPHistory.Highlight);
int highlightColumnIndex = HTTPHistory.columns.indexOf(HTTPHistory.Highlight);
TableColumn highlightColumn = inScopeTable.getColumnModel().getColumn(highlightColumnIndex);
JComboBox highlightComboBox = new JComboBox();
for (String colorName : multiplayer.history.highlights) {
Expand All @@ -80,7 +82,7 @@ public InScopePane(Multiplayer multiplayer, MultiplayerLogger logger) {
highlightColumn.setCellEditor(new DefaultCellEditor(highlightComboBox));

// Assessment column
int assessmentColumnIndex = multiplayer.history.columns.indexOf(HTTPHistory.Assessment);
int assessmentColumnIndex = HTTPHistory.columns.indexOf(HTTPHistory.Assessment);
TableColumn assessmentColumn = inScopeTable.getColumnModel().getColumn(assessmentColumnIndex);
JComboBox assessmentStateComboBox = new JComboBox();
for (String state : multiplayer.history.assessmentStates) {
Expand All @@ -94,6 +96,7 @@ public InScopePane(Multiplayer multiplayer, MultiplayerLogger logger) {

// Row Selection Listener
rowSelectionListener = new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent event) {
if (!event.getValueIsAdjusting()) {
String reqRespId = (String) inScopeTable.getValueAt(inScopeTable.getSelectedRow(), 0);
Expand Down Expand Up @@ -162,10 +165,11 @@ private void applyRowFilter() {
}
sorter.setRowFilter(new RowFilter<TableModel, Integer>() {

@Override
public boolean include(Entry<? extends TableModel, ? extends Integer> entry) {
Integer rowNumber = entry.getIdentifier();
TableModel model = entry.getModel();
int assessmentColumnIndex = multiplayer.history.columns.indexOf(multiplayer.history.Assessment);
int assessmentColumnIndex = HTTPHistory.columns.indexOf(HTTPHistory.Assessment);
String state = (String) model.getValueAt(rowNumber, assessmentColumnIndex);
return getEnabledFilters().contains(state);
}
Expand Down Expand Up @@ -433,6 +437,7 @@ public Component prepareRenderer(TableCellRenderer renderer, int row, int column
blockedStateCheckBox = new javax.swing.JCheckBox();
jLabel1 = new javax.swing.JLabel();
stateProgressBar = new javax.swing.JProgressBar();
jButton1 = new javax.swing.JButton();

parentSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);

Expand Down Expand Up @@ -495,6 +500,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {

stateProgressBar.setStringPainted(true);

jButton1.setText("jButton1");

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
Expand All @@ -518,6 +525,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(stateProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(exportSpreadsheetButton)
.addContainerGap())
);
Expand All @@ -533,7 +542,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(doneStateCheckBox)
.addComponent(blockedStateCheckBox)
.addComponent(jLabel1)
.addComponent(stateProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(stateProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(parentSplitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 682, Short.MAX_VALUE)
.addContainerGap())
Expand Down Expand Up @@ -586,6 +596,7 @@ private void exportSpreadsheetButtonActionPerformed(java.awt.event.ActionEvent e
private javax.swing.JCheckBox inProgressStateCheckBox;
private javax.swing.JTable inScopeTable;
private javax.swing.JScrollPane inScopeTablePane;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JCheckBox newStateCheckBox;
private javax.swing.JSplitPane parentSplitPane;
Expand Down

0 comments on commit 2a09d85

Please sign in to comment.