Skip to content

Commit

Permalink
save log levels
Browse files Browse the repository at this point in the history
  • Loading branch information
moloch-- committed Oct 15, 2020
1 parent d374d62 commit f5e5e04
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 30 deletions.
5 changes: 5 additions & 0 deletions src/burp/BurpExtender.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ public class BurpExtender implements IBurpExtender, ITab {
public void registerExtenderCallbacks(IBurpExtenderCallbacks callbacks) {
BurpExtender.callbacks = callbacks;
BurpExtender.logger = new MultiplayerLogger(callbacks);
String logLevel = callbacks.loadExtensionSetting("multiplayer.logLevel");
if (logLevel != null) {
BurpExtender.logger.info("Log Level -> %s", logLevel);
BurpExtender.logger.setLevel(logLevel);
}
logger.info("Multiplayer plugin loading ...");
BurpExtender.callbacks.setExtensionName(BurpExtender.name);

Expand Down
4 changes: 1 addition & 3 deletions src/burp/Multiplayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,7 @@ public void addIgnoredStatusCodes(String statusCode) {
return;
}
ignoredStatusCodes.addElement(statusCode);
} catch (NumberFormatException e) {
return;
}
} catch (NumberFormatException e) { }
}

public void removeIgnoredStatusCodes(String statusCode) {
Expand Down
4 changes: 4 additions & 0 deletions src/burp/MultiplayerLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public void setLevel(String level) {
}
}

public String getLevel() {
return currentLevel;
}

private int currentLevelIndex() {
return levels.indexOf(currentLevel);
}
Expand Down
8 changes: 0 additions & 8 deletions src/burp/gui/InScopePane.form
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
<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 @@ -56,7 +54,6 @@
<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 @@ -178,10 +175,5 @@
<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>
15 changes: 4 additions & 11 deletions src/burp/gui/InScopePane.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
*/
public final class InScopePane extends javax.swing.JPanel implements TableModelListener {

private Multiplayer multiplayer;
private IBurpExtenderCallbacks callbacks;
private ListSelectionListener rowSelectionListener;
private final Multiplayer multiplayer;
private final IBurpExtenderCallbacks callbacks;
private final ListSelectionListener rowSelectionListener;
private TableRowSorter<TableModel> sorter;
private final MultiplayerLogger logger;

Expand Down Expand Up @@ -437,7 +437,6 @@ 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 @@ -500,8 +499,6 @@ 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 @@ -525,8 +522,6 @@ 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 @@ -542,8 +537,7 @@ 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(jButton1))
.addComponent(stateProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(parentSplitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 682, Short.MAX_VALUE)
.addContainerGap())
Expand Down Expand Up @@ -596,7 +590,6 @@ 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
25 changes: 22 additions & 3 deletions src/burp/gui/OptionsPane.form
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
<Component id="logLevelComboBox" alignment="0" max="32767" attributes="0"/>
<Component id="loggingLabel" alignment="0" max="32767" attributes="0"/>
</Group>
<Component id="overwriteDuplicatesCheckBox" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="includeQueryParametersCheckBox" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
Expand All @@ -65,7 +67,7 @@
<Component id="jScrollPane3" min="-2" pref="146" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="133" max="32767" attributes="0"/>
<EmptySpace pref="228" max="32767" attributes="0"/>
<Component id="disconnectButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
Expand Down Expand Up @@ -121,11 +123,15 @@
<Component id="ignoreScannerCheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="sendToInProgressCheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="overwriteDuplicatesCheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="includeQueryParametersCheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="11" max="-2" attributes="0"/>
<Component id="loggingLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="logLevelComboBox" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="129" max="32767" attributes="0"/>
<EmptySpace pref="119" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down Expand Up @@ -326,5 +332,18 @@
<Property name="text" type="java.lang.String" value="Ignore URL Patterns"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="overwriteDuplicatesCheckBox">
<Properties>
<Property name="text" type="java.lang.String" value="Always Overwrite Duplicates"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="includeQueryParametersCheckBox">
<Properties>
<Property name="text" type="java.lang.String" value="Include Query Parameters in Unqiueness"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="includeQueryParametersCheckBoxActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>
37 changes: 32 additions & 5 deletions src/burp/gui/OptionsPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class OptionsPane extends javax.swing.JPanel {
* @param logger
*/
public OptionsPane(Multiplayer multiplayer, MultiplayerLogger logger) {
logger.setLevel(MultiplayerLogger.INFO);
logger.debug("Initializing options panel");
this.multiplayer = multiplayer;
this.callbacks = logger.callbacks;
Expand Down Expand Up @@ -65,6 +64,10 @@ private void initLoadSettings() {

loadIgnoredFileExtensionList();
loadIgnoredStatusCodesList();

String level = logger.getLevel();
logger.debug("Init log level '%s'", level);
logLevelComboBox.setSelectedItem(level);
}

private void saveExtensionSetting(String name, String value) {
Expand Down Expand Up @@ -160,6 +163,8 @@ private void initComponents() {
jScrollPane3 = new javax.swing.JScrollPane();
ignoreURLPatternJList = new javax.swing.JList<>();
jLabel1 = new javax.swing.JLabel();
overwriteDuplicatesCheckBox = new javax.swing.JCheckBox();
includeQueryParametersCheckBox = new javax.swing.JCheckBox();

ignoreFileExtensionLabel.setFont(new java.awt.Font(".SF NS Text", 1, 13)); // NOI18N
ignoreFileExtensionLabel.setText("Ignore File Extensions");
Expand Down Expand Up @@ -268,6 +273,15 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
jLabel1.setFont(new java.awt.Font(".SF NS Text", 1, 13)); // NOI18N
jLabel1.setText("Ignore URL Patterns");

overwriteDuplicatesCheckBox.setText("Always Overwrite Duplicates");

includeQueryParametersCheckBox.setText("Include Query Parameters in Unqiueness");
includeQueryParametersCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
includeQueryParametersCheckBoxActionPerformed(evt);
}
});

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
Expand All @@ -290,7 +304,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(sendToInProgressCheckBox)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(logLevelComboBox, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(loggingLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addComponent(loggingLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(overwriteDuplicatesCheckBox)
.addComponent(includeQueryParametersCheckBox)))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(removeIgnoreStatusCodeButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
Expand All @@ -309,7 +325,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 133, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 228, Short.MAX_VALUE)
.addComponent(disconnectButton)
.addContainerGap())
);
Expand Down Expand Up @@ -353,11 +369,15 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(ignoreScannerCheckBox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(sendToInProgressCheckBox)
.addGap(18, 18, 18)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(overwriteDuplicatesCheckBox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(includeQueryParametersCheckBox)
.addGap(11, 11, 11)
.addComponent(loggingLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(logLevelComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(129, Short.MAX_VALUE))
.addContainerGap(119, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents

Expand Down Expand Up @@ -408,6 +428,7 @@ private void sendToInProgressCheckBoxActionPerformed(java.awt.event.ActionEvent
private void logLevelComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logLevelComboBoxActionPerformed
String level = (String) logLevelComboBox.getSelectedItem();
logger.setLevel(level);
callbacks.saveExtensionSetting("multiplayer.logLevel", level);
}//GEN-LAST:event_logLevelComboBoxActionPerformed

private void addIgnoreURLPatternButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addIgnoreURLPatternButtonActionPerformed
Expand All @@ -432,6 +453,10 @@ private void removeIgnoreURLPatternButtonActionPerformed(java.awt.event.ActionEv
});
}//GEN-LAST:event_removeIgnoreURLPatternButtonActionPerformed

private void includeQueryParametersCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_includeQueryParametersCheckBoxActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_includeQueryParametersCheckBoxActionPerformed


// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton addIgnoreFileExtensionButton;
Expand All @@ -444,6 +469,7 @@ private void removeIgnoreURLPatternButtonActionPerformed(java.awt.event.ActionEv
private javax.swing.JList<Pattern> ignoreURLPatternJList;
private javax.swing.JList<String> ignoredFileExtensionJList;
private javax.swing.JList<String> ignoredStatusCodesJList;
private javax.swing.JCheckBox includeQueryParametersCheckBox;
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
Expand All @@ -452,6 +478,7 @@ private void removeIgnoreURLPatternButtonActionPerformed(java.awt.event.ActionEv
private javax.swing.JComboBox<String> logLevelComboBox;
private javax.swing.JLabel loggingLabel;
private javax.swing.JLabel otherOptionsLabel;
private javax.swing.JCheckBox overwriteDuplicatesCheckBox;
private javax.swing.JButton removeIgnoreFileExtensionButton;
private javax.swing.JButton removeIgnoreStatusCodeButton;
private javax.swing.JButton removeIgnoreURLPatternButton;
Expand Down

0 comments on commit f5e5e04

Please sign in to comment.