-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JSON support for list import/export & required related refactor (#28)
* RegexContext class for Options lists * refactor: createOptions_Regex * refactor: createOptions_Configuration_Scanner * Removed duplicated code * Moved ActionListener to classes * refactor: parameters on separate lines * refactor: removed useless static * fix: resource packaging; refactor: open regex list from file * feat: open and save list from JSON * refactor: moved stderr/out to BurpSuite extension page; Cleaned exceptions handling * Updated README.md with new changes * updated bappdescription docs
- Loading branch information
Showing
10 changed files
with
496 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/java/com/cys4/sensitivediscoverer/controller/OptionsScannerUpdateListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.cys4.sensitivediscoverer.controller; | ||
|
||
import com.cys4.sensitivediscoverer.ui.MainUI; | ||
|
||
import javax.swing.*; | ||
import java.awt.event.ActionListener; | ||
|
||
public abstract class OptionsScannerUpdateListener implements ActionListener { | ||
|
||
protected JLabel currentValueLabel; | ||
protected JTextField updatedStatusField; | ||
protected MainUI mainUI; | ||
|
||
public OptionsScannerUpdateListener(MainUI mainUI) { | ||
this.currentValueLabel = null; | ||
this.updatedStatusField = null; | ||
this.mainUI = mainUI; | ||
} | ||
|
||
public void setCurrentValueLabel(JLabel currentValueLabel) { | ||
this.currentValueLabel = currentValueLabel; | ||
} | ||
|
||
public void setUpdatedStatusField(JTextField updatedStatusField) { | ||
this.updatedStatusField = updatedStatusField; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...ain/java/com/cys4/sensitivediscoverer/controller/OptionsScannerUpdateMaxSizeListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.cys4.sensitivediscoverer.controller; | ||
|
||
import com.cys4.sensitivediscoverer.ui.MainUI; | ||
|
||
import java.awt.event.ActionEvent; | ||
|
||
import static com.cys4.sensitivediscoverer.controller.Messages.getLocaleString; | ||
|
||
public class OptionsScannerUpdateMaxSizeListener extends OptionsScannerUpdateListener { | ||
|
||
public OptionsScannerUpdateMaxSizeListener(MainUI mainUI) { | ||
super(mainUI); | ||
} | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent actionEvent) { | ||
try { | ||
int newMaxSizeValue = Integer.parseInt(updatedStatusField.getText()); | ||
if (newMaxSizeValue < 1) | ||
throw new NumberFormatException(getLocaleString("exception-sizeMustBeGreaterEqualThanOne")); | ||
|
||
this.mainUI.setMaxSizeValueOption(newMaxSizeValue); | ||
currentValueLabel.setText(String.valueOf(this.mainUI.getMaxSizeValueOption())); | ||
updatedStatusField.setText(""); | ||
} catch (NumberFormatException ignored) { | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
.../java/com/cys4/sensitivediscoverer/controller/OptionsScannerUpdateNumThreadsListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.cys4.sensitivediscoverer.controller; | ||
|
||
import com.cys4.sensitivediscoverer.scanner.BurpLeaksScanner; | ||
import com.cys4.sensitivediscoverer.ui.MainUI; | ||
|
||
import java.awt.event.ActionEvent; | ||
|
||
import static com.cys4.sensitivediscoverer.controller.Messages.getLocaleString; | ||
|
||
public class OptionsScannerUpdateNumThreadsListener extends OptionsScannerUpdateListener { | ||
|
||
public OptionsScannerUpdateNumThreadsListener(MainUI mainUI) { | ||
super(mainUI); | ||
} | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent actionEvent) { | ||
try { | ||
int newThreadNumber = Integer.parseInt(updatedStatusField.getText()); | ||
if (newThreadNumber < 1 || newThreadNumber > 128) | ||
throw new NumberFormatException(getLocaleString("exception-numberNotInTheExpectedRange")); | ||
|
||
BurpLeaksScanner burpLeaksScanner = this.mainUI.getBurpLeaksScanner(); | ||
burpLeaksScanner.setNumThreads(newThreadNumber); | ||
currentValueLabel.setText(String.valueOf(burpLeaksScanner.getNumThreads())); | ||
updatedStatusField.setText(""); | ||
} catch (NumberFormatException ignored) { | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/main/java/com/cys4/sensitivediscoverer/model/RegexContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.cys4.sensitivediscoverer.model; | ||
|
||
import java.util.List; | ||
|
||
public class RegexContext { | ||
|
||
private final List<RegexEntity> regexEntities; | ||
|
||
public RegexContext(List<RegexEntity> regexEntities) { | ||
this.regexEntities = regexEntities; | ||
} | ||
|
||
public List<RegexEntity> getRegexEntities() { | ||
return regexEntities; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.