Projects STRLCPY LoggerPlusPlus Commits 756f4a2c
🤬
  • Add feature to not log entries matching a filter.

  • Loading...
  • Corey committed 1 year ago
    756f4a2c
    1 parent cb3e1968
  • ■ ■ ■ ■ ■
    src/main/java/com/nccgroup/loggerplusplus/filter/FilterExpression.java
    skipped 1 lines
    2 2   
    3 3  import com.nccgroup.loggerplusplus.LoggerPlusPlus;
    4 4  import com.nccgroup.loggerplusplus.filter.parser.*;
     5 +import com.nccgroup.loggerplusplus.logentry.FieldGroup;
    5 6  import com.nccgroup.loggerplusplus.logentry.LogEntry;
    6 7  import com.nccgroup.loggerplusplus.logentry.LogEntryField;
    7 8  import lombok.Getter;
    8 9   
     10 +import java.util.HashMap;
    9 11  import java.util.HashSet;
    10 12   
    11 13  public class FilterExpression {
    skipped 4 lines
    16 18   @Getter
    17 19   protected HashSet<String> snippetDependencies;
    18 20   
     21 + @Getter
     22 + protected HashSet<FieldGroup> requiredContexts;
     23 + 
    19 24   public FilterExpression(String filterString) throws ParseException {
    20 25   this.ast = FilterParser.parseFilter(filterString);
    21  - this.snippetDependencies = FilterParser.checkAliasesForSanity(LoggerPlusPlus.instance.getLibraryController(), this.ast);
     26 + HashMap<String, Object> filterInfo = FilterParser.validateFilterDependencies(LoggerPlusPlus.instance.getLibraryController(), this.ast);
     27 + snippetDependencies = (HashSet<String>) filterInfo.get("dependencies");
     28 + requiredContexts = (HashSet<FieldGroup>) filterInfo.get("contexts");
    22 29   }
    23 30   
    24 31   public boolean matches(LogEntry entry){
    skipped 11 lines
    36 43   }
    37 44   
    38 45   this.ast = FilterParser.parseFilter(String.format("%s %s %s %s %s", existing, logicalOperator.toString(), field.toString(), booleanOperator, value));
    39  - this.snippetDependencies = FilterParser.checkAliasesForSanity(LoggerPlusPlus.instance.getLibraryController(), this.ast);
     46 + HashMap<String, Object> filterInfo = FilterParser.validateFilterDependencies(LoggerPlusPlus.instance.getLibraryController(), this.ast);
     47 + snippetDependencies = (HashSet<String>) filterInfo.get("dependencies");
     48 + requiredContexts = (HashSet<FieldGroup>) filterInfo.get("contexts");
    40 49   }
    41 50   
    42 51   @Override
    skipped 5 lines
  • ■ ■ ■ ■ ■ ■
    src/main/java/com/nccgroup/loggerplusplus/filter/parser/AliasCheckVisitor.java
    skipped 2 lines
    3 3   
    4 4  import com.nccgroup.loggerplusplus.filter.savedfilter.SavedFilter;
    5 5  import com.nccgroup.loggerplusplus.filterlibrary.FilterLibraryController;
     6 +import com.nccgroup.loggerplusplus.logentry.FieldGroup;
     7 +import com.nccgroup.loggerplusplus.logentry.LogEntryField;
    6 8   
    7 9  import java.util.HashSet;
     10 +import java.util.LinkedList;
    8 11   
    9 12  public class AliasCheckVisitor implements FilterParserVisitor{
    10 13   
    skipped 4 lines
    15 18   }
    16 19   
    17 20   public VisitorData defaultVisit(SimpleNode node, VisitorData data){
    18  - data.setData("dependencies", new HashSet<String>());
    19 21   node.childrenAccept(this, data);
    20 22   return data;
    21 23   }
    skipped 2 lines
    24 26   }
    25 27   
    26 28   public VisitorData visit(SimpleNode node){
    27  - return visit(node, new VisitorData());
     29 + VisitorData visitorData = new VisitorData();
     30 + visitorData.setData("dependencies", new HashSet<String>());
     31 + visitorData.setData("contexts", new HashSet<FieldGroup>());
     32 + visitorData.setData("aliasVisitList", new LinkedList<String>());
     33 + return visit(node, visitorData);
    28 34   }
    29 35   public VisitorData visit(ASTExpression node, VisitorData data){
    30 36   return defaultVisit(node, data);
    31 37   }
    32 38   public VisitorData visit(ASTComparison node, VisitorData visitorData){
     39 + HashSet<FieldGroup> contexts = (HashSet<FieldGroup>) visitorData.getData().get("contexts");
     40 + if(node.left instanceof LogEntryField) contexts.add(((LogEntryField) node.left).getFieldGroup());
     41 + if(node.right instanceof LogEntryField) contexts.add(((LogEntryField) node.right).getFieldGroup());
    33 42   defaultVisit(node, visitorData);
    34 43   return visitorData;
    35 44   }
    skipped 1 lines
    37 46   private static String RECURSION_CHECK = "RECURSION_CHECK";
    38 47   @Override
    39 48   public VisitorData visit(ASTAlias node, VisitorData data) {
     49 + //Add this alias to our dependencies
    40 50   ((HashSet<String>) data.getData().get("dependencies")).add(node.identifier);
    41 51   if(filterLibraryController == null){
    42 52   data.addError("Cannot use aliases in this context. Filter library controller is not set.");
    43 53   return data;
    44 54   }
    45  - if(!data.getData().containsKey(RECURSION_CHECK)){
    46  - data.getData().put(RECURSION_CHECK, new HashSet<String>());
    47  - }
    48 55   
    49  - HashSet<String> recursionSet = (HashSet<String>) data.getData().get(RECURSION_CHECK);
    50  - if(recursionSet.contains(node.identifier)){
     56 + LinkedList<String> aliasVisitList = (LinkedList<String>) data.getData().get("aliasVisitList");
     57 + if(aliasVisitList.contains(node.identifier)){
    51 58   //We're recursing, don't continue!
    52 59   data.addError("Recursion detected in filter. Alias identifier: " + node.identifier);
    53 60   return data;
    54 61   }else{
    55  - recursionSet.add(node.identifier);
     62 + aliasVisitList.push(node.identifier);
    56 63   }
    57 64   
    58 65   //Now sanity check on the aliased filter with our existing data
    skipped 2 lines
    61 68   if(savedFilter.getName().equalsIgnoreCase(node.identifier) && savedFilter.getFilterExpression() != null){
    62 69   visit(savedFilter.getFilterExpression().getAst(), data);
    63 70   foundAliasedFilter = true;
     71 + aliasVisitList.pop();
    64 72   break;
    65 73   }
    66 74   }
    skipped 10 lines
  • ■ ■ ■ ■ ■
    src/main/java/com/nccgroup/loggerplusplus/filter/parser/Filter.jj
    skipped 19 lines
    20 20  import java.util.Arrays;
    21 21  import java.util.LinkedHashSet;
    22 22  import java.util.HashSet;
     23 +import java.util.HashMap;
    23 24  import java.util.Set;
    24 25  import java.util.Date;
    25 26  import java.util.ArrayList;
    skipped 15 lines
    41 42   return node;
    42 43   }
    43 44   
    44  - public static HashSet<String> checkAliasesForSanity(FilterLibraryController libraryController, ASTExpression filter) throws ParseException {
     45 + public static HashMap<String, Object> validateFilterDependencies(FilterLibraryController libraryController, ASTExpression filter) throws ParseException {
    45 46   VisitorData result = new AliasCheckVisitor(libraryController).visit(filter);
    46 47   if(!result.isSuccess()) throw new ParseException(result.getErrorString());
    47  - return (HashSet<String>) result.getData().get("dependencies");
     48 + return result.getData();
    48 49   }
    49 50   
    50 51   private static void throwOperatorAmbiguityException(LogicalOperator op, LogicalOperator other) throws ParseException {
    skipped 537 lines
  • ■ ■ ■ ■ ■
    src/main/java/com/nccgroup/loggerplusplus/filter/parser/Filter.jjt
    skipped 18 lines
    19 19  import java.util.Arrays;
    20 20  import java.util.LinkedHashSet;
    21 21  import java.util.HashSet;
     22 +import java.util.HashMap;
    22 23  import java.util.Set;
    23 24  import java.util.Date;
    24 25  import java.util.ArrayList;
    skipped 12 lines
    37 38   return node;
    38 39   }
    39 40   
    40  - public static HashSet<String> checkAliasesForSanity(FilterLibraryController libraryController, ASTExpression filter) throws ParseException {
     41 + public static HashMap<String, Object> validateFilterDependencies(FilterLibraryController libraryController, ASTExpression filter) throws ParseException {
    41 42   VisitorData result = new AliasCheckVisitor(libraryController).visit(filter);
    42 43   if(!result.isSuccess()) throw new ParseException(result.getErrorString());
    43  - return (HashSet<String>) result.getData().get("dependencies");
     44 + return result.getData();
    44 45   }
    45 46   
    46 47   private static void throwOperatorAmbiguityException(LogicalOperator op, LogicalOperator other) throws ParseException {
    skipped 458 lines
  • ■ ■ ■ ■ ■ ■
    src/main/java/com/nccgroup/loggerplusplus/filter/parser/FilterParser.java
    skipped 7 lines
    8 8  import java.util.Arrays;
    9 9  import java.util.LinkedHashSet;
    10 10  import java.util.HashSet;
     11 +import java.util.HashMap;
    11 12  import java.util.Set;
    12 13  import java.util.Date;
    13 14  import java.util.ArrayList;
    skipped 12 lines
    26 27   return node;
    27 28   }
    28 29   
    29  - public static HashSet<String> checkAliasesForSanity(FilterLibraryController libraryController, ASTExpression filter) throws ParseException {
     30 + public static HashMap<String, Object> validateFilterDependencies(FilterLibraryController libraryController, ASTExpression filter) throws ParseException {
    30 31   VisitorData result = new AliasCheckVisitor(libraryController).visit(filter);
    31 32   if(!result.isSuccess()) throw new ParseException(result.getErrorString());
    32  - return (HashSet<String>) result.getData().get("dependencies");
     33 + return result.getData();
    33 34   }
    34 35   
    35 36   private static void throwOperatorAmbiguityException(LogicalOperator op, LogicalOperator other) throws ParseException {
    skipped 726 lines
    762 763   finally { jj_save(3, xla); }
    763 764   }
    764 765   
    765  - private boolean jj_3_4() {
    766  - if (jj_3R_9()) return true;
    767  - return false;
    768  - }
    769  - 
    770 766   private boolean jj_3R_18() {
    771 767   if (jj_3R_21()) return true;
    772 768   return false;
    skipped 203 lines
    976 972   
    977 973   private boolean jj_3R_13() {
    978 974   if (jj_3R_19()) return true;
     975 + return false;
     976 + }
     977 + 
     978 + private boolean jj_3_4() {
     979 + if (jj_3R_9()) return true;
    979 980   return false;
    980 981   }
    981 982   
    skipped 296 lines
  • ■ ■ ■ ■ ■
    src/main/java/com/nccgroup/loggerplusplus/filter/parser/FilterParserTokenManager.java
    skipped 7 lines
    8 8  import java.util.Arrays;
    9 9  import java.util.LinkedHashSet;
    10 10  import java.util.HashSet;
     11 +import java.util.HashMap;
    11 12  import java.util.Set;
    12 13  import java.util.Date;
    13 14  import java.util.ArrayList;
    skipped 1172 lines
  • ■ ■ ■ ■ ■ ■
    src/main/java/com/nccgroup/loggerplusplus/logentry/LogEntry.java
    skipped 40 lines
    41 41  import java.util.regex.Matcher;
    42 42  import java.util.stream.Collectors;
    43 43   
     44 +import static com.nccgroup.loggerplusplus.LoggerPlusPlus.montoya;
     45 + 
    44 46  @Getter
    45 47  @Setter
    46 48  public class LogEntry {
    skipped 91 lines
    138 140   switch (this.status) {
    139 141   case UNPROCESSED: {
    140 142   this.status = processRequest();
    141  - // If the entry should be ignored, stop here.
    142  - if (this.status == Status.IGNORED)
    143  - return true;
    144  - 
    145  - // Else continue, fall through to process response
     143 + //fall through to process response
    146 144   }
    147 145   case AWAITING_RESPONSE: {
    148 146   if (this.response == null) {
    skipped 5 lines
    154 152   return true;
    155 153   }
    156 154   
    157  - case IGNORED:
    158 155   case PROCESSED: {
    159 156   // Nothing to do, we're done!
    160 157   return true;
    skipped 72 lines
    233 230   this.sentCookies += ";"; // we need to ad this to search it in cookie Jar!
    234 231   
    235 232   // Check to see if it uses cookie Jars!
    236  - List<Cookie> cookiesInJar = LoggerPlusPlus.montoya.http().cookieJar().cookies();
     233 + List<Cookie> cookiesInJar = montoya.http().cookieJar().cookies();
    237 234   boolean oneNotMatched = false;
    238 235   boolean anyParamMatched = false;
    239 236   
    skipped 289 lines
    529 526   
    530 527   try {
    531 528   switch (columnName) {
     529 + case INSCOPE:
     530 + return montoya.scope().isInScope(urlString);
    532 531   case PROXY_TOOL:
    533 532   case REQUEST_TOOL:
    534 533   return tool.toolName();
    skipped 239 lines
  • ■ ■ ■ ■ ■ ■
    src/main/java/com/nccgroup/loggerplusplus/logentry/LogEntryField.java
    skipped 11 lines
    12 12   NUMBER(FieldGroup.ENTRY, Integer.class, "Item table number. Not valid for filter use.", "Number"),
    13 13   PROXY_TOOL(FieldGroup.ENTRY, String.class, "Originating tool name. Extension generated requests will be displayed as \"Extender\".", "Tool"),
    14 14   TAGS(FieldGroup.ENTRY, String.class, "The configured tags for which this entry match.", "Tags"),
     15 + 
     16 + INSCOPE(FieldGroup.ENTRY, Boolean.class, "If the URL is in scope", "InScope"),
    15 17   LISTENER_INTERFACE(FieldGroup.ENTRY, String.class, "The interface the proxied message was delivered to.", "ListenInterface", "Interface"),
    16 18   CLIENT_IP(FieldGroup.ENTRY, String.class, "The requesting client IP address.", "ClientIP", "ClientAddress"),
    17 19   
    skipped 137 lines
  • ■ ■ ■ ■
    src/main/java/com/nccgroup/loggerplusplus/logentry/Status.java
    1 1  package com.nccgroup.loggerplusplus.logentry;
    2 2   
    3 3  public enum Status {
    4  - UNPROCESSED, AWAITING_RESPONSE, PROCESSED, IGNORED
     4 + UNPROCESSED, AWAITING_RESPONSE, PROCESSED
    5 5  }
    6 6   
  • ■ ■ ■ ■
    src/main/java/com/nccgroup/loggerplusplus/logview/processor/EntryImportWorker.java
    skipped 58 lines
    59 59   if(this.isCancelled()) return;
    60 60   LogEntry result = logProcessor.processEntry(logEntry);
    61 61   if(result != null) {
    62  - logProcessor.addProcessedEntry(logEntry, sendToAutoExporters);
     62 + logProcessor.addNewEntry(logEntry, sendToAutoExporters);
    63 63   }
    64 64   publish(finalIndex);
    65 65   countDownLatch.countDown();
    skipped 72 lines
  • ■ ■ ■ ■ ■ ■
    src/main/java/com/nccgroup/loggerplusplus/logview/processor/LogProcessor.java
    skipped 8 lines
    9 9  import com.coreyd97.BurpExtenderUtilities.Preferences;
    10 10  import com.nccgroup.loggerplusplus.LoggerPlusPlus;
    11 11  import com.nccgroup.loggerplusplus.exports.ExportController;
     12 +import com.nccgroup.loggerplusplus.filter.FilterExpression;
    12 13  import com.nccgroup.loggerplusplus.filter.colorfilter.TableColorRule;
    13 14  import com.nccgroup.loggerplusplus.filter.tag.Tag;
     15 +import com.nccgroup.loggerplusplus.logentry.FieldGroup;
    14 16  import com.nccgroup.loggerplusplus.logentry.LogEntry;
    15 17  import com.nccgroup.loggerplusplus.logentry.Status;
    16 18  import com.nccgroup.loggerplusplus.logview.logtable.LogTableController;
    skipped 233 lines
    250 252   }
    251 253   }
    252 254   
    253  - private void submitNewEntryProcessingRunnable(final LogEntry logEntry){
    254  - entriesPendingProcessing.put(logEntry.getIdentifier(), logEntry);
    255  - RunnableFuture<LogEntry> processingRunnable = new FutureTask<>(() -> {
    256  - entriesPendingProcessing.remove(logEntry.getIdentifier());
    257  - LogEntry result = processEntry(logEntry);
    258  - 
    259  - if(result == null) {
    260  - entryProcessingFutures.remove(logEntry.getIdentifier());
    261  - return null; //Ignored entry. Skip it.
    262  - }else{
    263  - addProcessedEntry(logEntry, true);
    264  - 
    265  - if(result.getStatus() == Status.PROCESSED){
    266  - //If the entry was fully processed, remove it from the processing list.
    267  - entryProcessingFutures.remove(logEntry.getIdentifier());
    268  - }else{
    269  - //We're waiting on the response, we'll use this future to know we're done later.
    270  - }
    271  - return result;
    272  - }
    273  - });
    274  - entryProcessingFutures.put(logEntry.getIdentifier(), processingRunnable);
    275  - entryProcessExecutor.submit(processingRunnable);
    276  - }
    277  - 
    278 255   /**
    279 256   * Create a runnable to be used in an executor which will process a
    280 257   * HTTP object and store the results in the provided LogEntry object.
    skipped 6 lines
    287 264   
    288 265   //If the status has been changed
    289 266   if (logEntry.getStatus() != logEntry.getPreviousStatus()) {
    290  - if (logEntry.getStatus() == Status.IGNORED) return null; //Don't care about entry
     267 + FilterExpression doNotLogExpression = preferences.getSetting(PREF_DO_NOT_LOG_IF_MATCH);
     268 + if(doNotLogExpression != null){
     269 + if (logEntry.getStatus() == Status.PROCESSED || !doNotLogExpression.getRequiredContexts().contains(FieldGroup.RESPONSE)) {
     270 + //If we're dealing with a complete entry, or if the filter doesn't need the response.
     271 + if(doNotLogExpression.matches(logEntry)){
     272 + return null;
     273 + }
     274 + }
     275 + }
    291 276   
    292 277   //Check against color filters
    293 278   HashMap<UUID, TableColorRule> colorFilters = preferences.getSetting(PREF_COLOR_FILTERS);
    skipped 11 lines
    305 290   return logEntry;
    306 291   }
    307 292   
     293 + private void submitNewEntryProcessingRunnable(final LogEntry logEntry){
     294 + entriesPendingProcessing.put(logEntry.getIdentifier(), logEntry);
     295 + RunnableFuture<LogEntry> processingRunnable = new FutureTask<>(() -> {
     296 + entriesPendingProcessing.remove(logEntry.getIdentifier());
     297 + LogEntry result = processEntry(logEntry);
     298 + 
     299 + if(result == null) {
     300 + entryProcessingFutures.remove(logEntry.getIdentifier());
     301 + return null; //Ignored entry. Skip it.
     302 + }else{
     303 + addNewEntry(logEntry, true);
     304 + 
     305 + if(result.getStatus() == Status.PROCESSED){
     306 + //If the entry was fully processed, remove it from the processing list.
     307 + entryProcessingFutures.remove(logEntry.getIdentifier());
     308 + }else{
     309 + //We're waiting on the response, we'll use this future to know we're done later.
     310 + }
     311 + return result;
     312 + }
     313 + });
     314 + entryProcessingFutures.put(logEntry.getIdentifier(), processingRunnable);
     315 + entryProcessExecutor.submit(processingRunnable);
     316 + }
     317 + 
    308 318   private RunnableFuture<LogEntry> createEntryUpdateRunnable(final Future<LogEntry> processingFuture,
    309 319   final HttpResponse requestResponse,
    310 320   final Date arrivalTime){
    skipped 1 lines
    312 322   //Block until initial processing is complete.
    313 323   LogEntry logEntry = processingFuture.get();
    314 324   if (logEntry == null) {
    315  - return null; //Request to an ignored host. Stop processing.
     325 + //Request was filtered during response processing. We can just ignore the response.
     326 + return null;
    316 327   }
     328 + 
     329 + //Request was processed successfully... now process the response.
    317 330   logEntry.addResponse(requestResponse, arrivalTime);
    318  - processEntry(logEntry);
     331 + LogEntry updatedEntry = processEntry(logEntry);
     332 + 
     333 + if(updatedEntry == null){
     334 + //Response must have been filtered out. Delete the existing entry and stop processing
     335 + removeExistingEntry(logEntry);
     336 + entryProcessingFutures.remove(logEntry.getIdentifier());
     337 + return null;
     338 + }
    319 339   
    320 340   if (logEntry.getStatus() == Status.PROCESSED) {
    321 341   //If the entry was fully processed, remove it from the processing list.
    skipped 51 lines
    373 393   this.entryImportExecutor.shutdownNow();
    374 394   }
    375 395   
    376  - void addProcessedEntry(LogEntry logEntry, boolean sendToAutoExporters) {
    377  - if (sendToAutoExporters) exportController.exportNewEntry(logEntry);
     396 + void addNewEntry(LogEntry logEntry, boolean sendToAutoExporters) {
     397 + FilterExpression doNotLogExpression = preferences.getSetting(PREF_DO_NOT_LOG_IF_MATCH);
    378 398   SwingUtilities.invokeLater(() -> {
     399 + if (sendToAutoExporters) exportController.exportNewEntry(logEntry);
    379 400   logTableController.getLogTableModel().addEntry(logEntry);
    380 401   });
    381 402   }
    skipped 2 lines
    384 405   exportController.exportUpdatedEntry(logEntry);
    385 406   SwingUtilities.invokeLater(() -> {
    386 407   logTableController.getLogTableModel().updateEntry(logEntry);
     408 + });
     409 + }
     410 + 
     411 + void removeExistingEntry(LogEntry logEntry){
     412 + SwingUtilities.invokeLater(() -> {
     413 + logTableController.getLogTableModel().removeLogEntry(logEntry);
    387 414   });
    388 415   }
    389 416   
    skipped 56 lines
  • ■ ■ ■ ■ ■
    src/main/java/com/nccgroup/loggerplusplus/preferences/LoggerPreferenceFactory.java
    skipped 72 lines
    73 73   prefs.registerSetting(PREF_UPDATE_ON_STARTUP, Boolean.class, true);
    74 74   prefs.registerSetting(PREF_ENABLED, Boolean.class, true);
    75 75   prefs.registerSetting(PREF_RESTRICT_TO_SCOPE, Boolean.class, false);
     76 + prefs.registerSetting(PREF_DO_NOT_LOG_IF_MATCH, FilterExpression.class, null, Preferences.Visibility.GLOBAL);
    76 77   prefs.registerSetting(PREF_LOG_GLOBAL, Boolean.class, true);
    77 78   prefs.registerSetting(PREF_LOG_PROXY, Boolean.class, true);
    78 79   prefs.registerSetting(PREF_LOG_SPIDER, Boolean.class, true);
    skipped 56 lines
  • ■ ■ ■ ■ ■ ■
    src/main/java/com/nccgroup/loggerplusplus/preferences/PreferencesPanel.java
    skipped 20 lines
    21 21  import com.google.gson.reflect.TypeToken;
    22 22  import com.nccgroup.loggerplusplus.LoggerPlusPlus;
    23 23  import com.nccgroup.loggerplusplus.exports.*;
     24 +import com.nccgroup.loggerplusplus.filter.FilterExpression;
    24 25  import com.nccgroup.loggerplusplus.filter.colorfilter.TableColorRule;
     26 +import com.nccgroup.loggerplusplus.filter.parser.ParseException;
    25 27  import com.nccgroup.loggerplusplus.filter.savedfilter.SavedFilter;
    26 28  import com.nccgroup.loggerplusplus.imports.LoggerImport;
    27 29  import com.nccgroup.loggerplusplus.logentry.LogEntryField;
    skipped 37 lines
    65 67   });
    66 68   statusPanel.add(tglbtnIsEnabled);
    67 69   tglbtnIsEnabled.setSelected(preferences.getSetting(PREF_ENABLED));
     70 + 
     71 + ComponentGroup doNotLogPanel = new ComponentGroup(Orientation.HORIZONTAL, "Log Filter");
     72 + JTextField doNotLogFilterField = new JTextField(preferences.getSetting(PREF_DO_NOT_LOG_IF_MATCH).toString());
     73 + doNotLogPanel.add(new JLabel("Do not log entries matching filter: "));
     74 + GridBagConstraints gbc = doNotLogPanel.generateNextConstraints(true);
     75 + gbc.weightx = 100;
     76 + doNotLogPanel.add(doNotLogFilterField, gbc);
     77 + JToggleButton applyButton = new JToggleButton(new AbstractAction("Enable") {
     78 + @Override
     79 + public void actionPerformed(ActionEvent e) {
     80 + JToggleButton thisButton = (JToggleButton) e.getSource();
     81 + if(thisButton.isSelected()){
     82 + try {
     83 + FilterExpression expression = new FilterExpression(doNotLogFilterField.getText());
     84 + doNotLogFilterField.setText(expression.toString());
     85 + preferences.setSetting(PREF_DO_NOT_LOG_IF_MATCH, expression);
     86 + doNotLogFilterField.setEnabled(false);
     87 + thisButton.setText("Disable");
     88 + } catch (ParseException ex) {
     89 + JOptionPane.showMessageDialog(thisButton, "Could not parse filter: " + ex.getMessage());
     90 + thisButton.setSelected(false);
     91 + }
     92 + }else{
     93 + preferences.setSetting(PREF_DO_NOT_LOG_IF_MATCH, null);
     94 + doNotLogFilterField.setEnabled(true);
     95 + thisButton.setText("Enable");
     96 + }
     97 + }
     98 + });
     99 + if(preferences.getSetting(PREF_DO_NOT_LOG_IF_MATCH) != null){
     100 + applyButton.doClick();
     101 + }
     102 + doNotLogPanel.add(applyButton);
     103 + 
    68 104   
    69 105   ComponentGroup logFromPanel = new ComponentGroup(Orientation.VERTICAL, "Log From");
    70 106   logFromPanel.addPreferenceComponent(preferences, PREF_RESTRICT_TO_SCOPE, "In scope items only");
    skipped 250 lines
    321 357   
    322 358   JComponent mainComponent = PanelBuilder
    323 359   .build(new JPanel[][] { new JPanel[] { statusPanel, statusPanel, statusPanel, statusPanel },
     360 + new JPanel[] { logFromPanel, doNotLogPanel, doNotLogPanel, doNotLogPanel },
    324 361   new JPanel[] { logFromPanel, importGroup, importGroup, importGroup },
    325 362   new JPanel[] { logFromPanel, exportGroup, exportGroup, exportGroup },
    326 363   new JPanel[] { savedFilterSharing, savedFilterSharing, colorFilterSharing, colorFilterSharing },
    skipped 15 lines
  • ■ ■ ■ ■ ■
    src/main/java/com/nccgroup/loggerplusplus/util/Globals.java
    skipped 27 lines
    28 28   public static final String PREF_UPDATE_ON_STARTUP = "updateonstartup";
    29 29   public static final String PREF_ENABLED = "enabled";
    30 30   public static final String PREF_RESTRICT_TO_SCOPE = "restricttoscope";
     31 + public static final String PREF_DO_NOT_LOG_IF_MATCH = "donotlogifmatch";
    31 32   public static final String PREF_LOG_GLOBAL = "logglobal";
    32 33   public static final String PREF_LOG_PROXY = "logproxy";
    33 34   public static final String PREF_LOG_SPIDER = "logspider";
    skipped 50 lines
    84 85   "\"filter\":{\"filter\":\"Request.Complete == False\"},\"filterString\":\"Request.Complete == False\",\"backgroundColor\":{\"value\":-16777216,\"falpha\":0.0}," +
    85 86   "\"foregroundColor\":{\"value\":-65536,\"falpha\":0.0},\"enabled\":true,\"modified\":false,\"shouldRetest\":true,\"priority\":1}}";
    86 87   
    87  - public static final int CURRENT_COLUMN_VERSION = 9;
     88 + public static final int CURRENT_COLUMN_VERSION = 11;
    88 89   private static int colOrder = 0;
    89 90   public static final String DEFAULT_LOG_TABLE_COLUMNS_JSON = new StringBuilder().append("[")
    90 91   .append("{\"id\":" + NUMBER + ",\"name\":\"Number\",\"defaultVisibleName\":\"#\",\"visibleName\":\"#\",\"preferredWidth\":65,\"readonly\":true,\"order\":" + colOrder++ + ",\"visible\":true,\"description\":\"" + StringEscapeUtils.escapeJson(NUMBER.getDescription()) + "\"},")
    91 92   .append("{\"id\":" + TAGS + ",\"name\":\"Tags\",\"defaultVisibleName\":\"Tags\",\"visibleName\":\"Tags\",\"preferredWidth\":100,\"readonly\":true,\"order\":" + colOrder++ + ",\"visible\":true,\"description\":\"" + StringEscapeUtils.escapeJson(TAGS.getDescription()) + "\"},")
     93 + .append("{\"id\":" + INSCOPE + ",\"name\":\"In Scope\",\"defaultVisibleName\":\"In Scope\",\"visibleName\":\"Complete\",\"preferredWidth\":80,\"readonly\":true,\"order\":" + colOrder++ + ",\"visible\":true,\"description\":\"" + StringEscapeUtils.escapeJson(INSCOPE.getDescription()) + "\"},")
    92 94   .append("{\"id\":" + COMPLETE + ",\"name\":\"Complete\",\"defaultVisibleName\":\"Complete\",\"visibleName\":\"Complete\",\"preferredWidth\":80,\"readonly\":true,\"order\":" + colOrder++ + ",\"visible\":true,\"description\":\"" + StringEscapeUtils.escapeJson(COMPLETE.getDescription()) + "\"},")
    93 95   .append("{\"id\":" + PROXY_TOOL + ",\"name\":\"Tool\",\"defaultVisibleName\":\"Tool\",\"visibleName\":\"Tool\",\"preferredWidth\":70,\"readonly\":true,\"order\":" + colOrder++ + ",\"visible\":true,\"description\":\"" + StringEscapeUtils.escapeJson(PROXY_TOOL.getDescription()) + "\"},")
    94 96   .append("{\"id\":" + ISSSL + ",\"name\":\"IsSSL\",\"defaultVisibleName\":\"SSL\",\"visibleName\":\"SSL\",\"preferredWidth\":50,\"readonly\":true,\"order\":" + colOrder++ + ",\"visible\":false,\"description\":\"" + StringEscapeUtils.escapeJson(ISSSL.getDescription()) + "\"},")
    skipped 53 lines
Please wait...
Page is in error, reload to recover