Projects STRLCPY LoggerPlusPlus Commits 5fbba2fd
🤬
  • Update Montoya version, use montoya menu bar, set default doNotLog filter

  • Loading...
  • Corey committed 11 months ago
    5fbba2fd
    1 parent 65b38390
  • ■ ■ ■ ■
    build.gradle
    skipped 13 lines
    14 14  }
    15 15   
    16 16  dependencies {
    17  - implementation 'net.portswigger.burp.extensions:montoya-api:2023.3'
     17 + implementation 'net.portswigger.burp.extensions:montoya-api:2023.5'
    18 18   implementation 'org.swinglabs:swingx:1.6.1'
    19 19   implementation 'com.github.CoreyD97:Burp-Montoya-Utilities:234d21d'
    20 20  // implementation 'org.elasticsearch.client:elasticsearch-rest-high-level-client:7.17.9'
    skipped 25 lines
  • ■ ■ ■ ■ ■ ■
    src/main/java/com/nccgroup/loggerplusplus/LoggerPlusPlus.java
    skipped 1 lines
    2 2   
    3 3  import burp.api.montoya.BurpExtension;
    4 4  import burp.api.montoya.MontoyaApi;
     5 +import burp.api.montoya.core.Registration;
    5 6  import com.coreyd97.BurpExtenderUtilities.DefaultGsonProvider;
    6 7  import com.coreyd97.BurpExtenderUtilities.IGsonProvider;
    7 8  import com.nccgroup.loggerplusplus.exports.ExportController;
    skipped 32 lines
    40 41   public static MontoyaApi montoya;
    41 42   public static IGsonProvider gsonProvider = new DefaultGsonProvider();
    42 43   
     44 + private Registration menuBarRegistration;
    43 45   private LogProcessor logProcessor;
    44 46   private ExportController exportController;
    45 47   private PreferencesController preferencesController;
    skipped 44 lines
    90 92   montoya.http().registerHttpHandler(logProcessor.getHttpHandler());
    91 93   montoya.proxy().registerResponseHandler(logProcessor.getProxyResponseHandler());
    92 94   
    93  - //Add menu item to Burp's frame menu.
    94  - Frame rootFrame = null;
    95  - try {
    96  - rootFrame = montoya.userInterface().swingUtils().suiteFrame();
    97  - if (rootFrame instanceof JFrame) {
    98  - JMenuBar menuBar = ((JFrame) rootFrame).getJMenuBar();
    99  - if (menuBar != null) {
    100  - loggerMenu = new LoggerMenu(LoggerPlusPlus.this);
    101  - menuBar.add(loggerMenu, menuBar.getMenuCount() - 1);
    102  - }
    103  - }
    104  - } catch (Exception e) {
    105  - log.error("Could not find root frame. Window JMenu will not be added");
    106  - }
     95 + 
     96 + loggerMenu = new LoggerMenu(LoggerPlusPlus.this);
     97 + menuBarRegistration = montoya.userInterface().menuBar().registerMenu(loggerMenu);
     98 + 
    107 99   }
    108 100   
    109 101   public void unloadExtension() {
    skipped 9 lines
    119 111   
    120 112   //Stop log processor executors and pending tasks.
    121 113   logProcessor.shutdown();
     114 + 
     115 + menuBarRegistration.deregister();
    122 116   
    123 117   //Null out static variables so not leftover.
    124 118   LoggerPlusPlus.instance = null;
    skipped 21 lines
  • ■ ■ ■ ■ ■ ■
    src/main/java/com/nccgroup/loggerplusplus/preferences/LoggerPreferenceFactory.java
    skipped 16 lines
    17 17  import com.nccgroup.loggerplusplus.logentry.LogEntrySerializer;
    18 18  import com.nccgroup.loggerplusplus.logview.logtable.LogTableColumn;
    19 19  import com.nccgroup.loggerplusplus.util.Globals;
     20 +import lombok.SneakyThrows;
    20 21  import lombok.extern.log4j.Log4j2;
    21 22  import org.apache.logging.log4j.Level;
    22 23   
    skipped 8 lines
    31 32   private HashMap<UUID, TableColorRule> defaultColorFilters;
    32 33   private ArrayList<LogTableColumn> defaultlogTableColumns;
    33 34   private Set<String> defaultBlacklistedReflections;
     35 + private FilterExpression doNotLogFilter;
    34 36   
    35 37   public LoggerPreferenceFactory(MontoyaApi montoya, IGsonProvider gsonProvider, ILogProvider logProvider){
    36 38   super(montoya, gsonProvider, logProvider);
    skipped 3 lines
    40 42   super(montoya, gsonProvider);
    41 43   }
    42 44   
     45 + @SneakyThrows
    43 46   @Override
    44 47   protected void createDefaults(){
    45 48   
    46  - 
     49 + doNotLogFilter = new FilterExpression("Request.Extension IN [\"css\", \"svg\", \"woff2\", \"woff\", \"ico\", \"png\", \"jpeg\", \"jpg\", \"mp4\"]");
    47 50   defaultColorFilters = this.gsonProvider.getGson().fromJson(
    48 51   Globals.DEFAULT_COLOR_FILTERS_JSON, new TypeToken<HashMap<UUID, TableColorRule>>(){}.getType());
    49 52   log.info(DEFAULT_LOG_TABLE_COLUMNS_JSON);
    skipped 23 lines
    73 76   prefs.registerSetting(PREF_UPDATE_ON_STARTUP, Boolean.class, true);
    74 77   prefs.registerSetting(PREF_ENABLED, Boolean.class, true);
    75 78   prefs.registerSetting(PREF_RESTRICT_TO_SCOPE, Boolean.class, false);
    76  - prefs.registerSetting(PREF_DO_NOT_LOG_IF_MATCH, FilterExpression.class, null, Preferences.Visibility.GLOBAL);
     79 + prefs.registerSetting(PREF_DO_NOT_LOG_IF_MATCH, FilterExpression.class, doNotLogFilter, Preferences.Visibility.GLOBAL);
    77 80   prefs.registerSetting(PREF_LOG_GLOBAL, Boolean.class, true);
    78 81   prefs.registerSetting(PREF_LOG_PROXY, Boolean.class, true);
    79 82   prefs.registerSetting(PREF_LOG_SPIDER, Boolean.class, true);
    skipped 56 lines
Please wait...
Page is in error, reload to recover