Skip to content

Commit

Permalink
added headless mode option
Browse files Browse the repository at this point in the history
  • Loading branch information
fcavallarin committed Apr 14, 2023
1 parent e27ba1b commit 13c2143
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 17 deletions.
3 changes: 2 additions & 1 deletion lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ dependencies {
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:31.1-jre'

implementation 'net.portswigger.burp.extensions:montoya-api:+'
//implementation 'net.portswigger.burp.extensions:montoya-api:+'
implementation 'net.portswigger.burp.extensions:montoya-api:2023.3'

// sql 'org.xerial:sqlite-jdbc:3.40.0.0'
implementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.34.0'
Expand Down
7 changes: 5 additions & 2 deletions lib/src/main/java/org/fcvl/domdig/burp/CrawlResultsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,13 @@ public void setTableSorter(JTable tbl) {
sorter.setSortKeys(sortKeys);
}


public void loadRequestsList(ArrayList<DomdigRequest> list) {
if(list != null) {
for(DomdigRequest u: list) {
requestsModel.addRow(u);
loadedRequestHashes.put(u.hash, u);
if(!loadedRequestHashes.containsKey(u.hash)) {
loadedRequestHashes.put(u.hash, u);
}
}
}
}
Expand All @@ -144,6 +145,8 @@ public void reset() {
flushTable();
flushRequestEditor();
loadedRequestHashes = new HashMap<>();
requestTriggerLabel.setText("");
elementTextField.setVisible(false);
}

private void loadRequestTextArea() {
Expand Down
8 changes: 6 additions & 2 deletions lib/src/main/java/org/fcvl/domdig/burp/DomdigExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ public class DomdigExecutor {
public boolean checkTemplateInjection;
public boolean checkStored;
public boolean singleBrowser;
public boolean headlessMode;

public DomdigExecutor(String nodePath, String domdigPath, String targetUrl, String cookies, String credentials, int timeout, String proxy,
String headers, String loginSequence, String payloadsFile, String modes, String excludeRegex,
String localStorage, boolean checkTemplateInjection, boolean checkStored, boolean singleBrowser) {
String localStorage, boolean checkTemplateInjection, boolean checkStored, boolean singleBrowser, boolean headlessMode) {
super();
this.nodePath = nodePath;
this.domdigPath = domdigPath;
Expand All @@ -49,6 +50,7 @@ public DomdigExecutor(String nodePath, String domdigPath, String targetUrl, Stri
this.checkTemplateInjection = checkTemplateInjection;
this.checkStored = checkStored;
this.singleBrowser = singleBrowser;
this.headlessMode = headlessMode;
//System.out.println(this.dbFilePath);
}

Expand Down Expand Up @@ -79,7 +81,9 @@ public ArrayList<String> getCommand() {
ArrayList<String> list = new ArrayList<String>();
list.add(this.nodePath);
list.add(this.domdigPath);
list.add("-l");
if(!headlessMode) {
list.add("-l");
}
list.add("-m");
list.add(modes);
list.add("-d");
Expand Down
34 changes: 23 additions & 11 deletions lib/src/main/java/org/fcvl/domdig/burp/SettingsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ public class SettingsPanel extends JPanel {
private JTextField proxyTextField;
private JCheckBox proxyCheckBox;
private JScrollPane mainGridScrollPane;
private JCheckBox singleBrowserCheckBox;
private JTextField timeoutTextField;
private JCheckBox headlessModeCheckBox;
private JCheckBox singleBrowserCheckBox;

public DomdigExecutor getExecutor(String targetUrl) {
String credentials = httpAuthUserTextField.getText() + ":" + httpAuthPassTextField.getText();
Expand Down Expand Up @@ -96,7 +97,8 @@ public DomdigExecutor getExecutor(String targetUrl) {
return new DomdigExecutor(nodeExe.getAbsolutePath(), domdigExe.getAbsolutePath(),
targetUrl, cookiesEditor.toJson(), credentials, timeout,
proxy, kvEditHeaders.toJson(), loginSequenceTextArea.getText(), payloadFileTextField.getText(),
String.join(",", modes), ignoreRegexTextField.getText(), kvEditLocalstorage.toJson(), tplInjCheckBox.isSelected(), storedXSSCheckBox.isSelected(), !singleBrowserCheckBox.isSelected());
String.join(",", modes), ignoreRegexTextField.getText(), kvEditLocalstorage.toJson(), tplInjCheckBox.isSelected(),
storedXSSCheckBox.isSelected(), !singleBrowserCheckBox.isSelected(), headlessModeCheckBox.isSelected());
}

private void alertError(String message) {
Expand All @@ -122,6 +124,7 @@ public String getJson() {
json.put("kvEditHeaders", kvEditHeaders.toJson());
json.put("kvEditLocalstorage", kvEditLocalstorage.toJson());
json.put("singleBrowserCheckBox", singleBrowserCheckBox.isSelected());
json.put("headlessModeCheckBox", headlessModeCheckBox.isSelected());
json.put("timeoutTextField", timeoutTextField.getText());
return json.toString();

Expand All @@ -146,6 +149,7 @@ public void loadJson(String j) {
storedXSSCheckBox.setSelected(json.getBoolean("storedXSSCheckBox"));
proxyCheckBox.setSelected(json.getBoolean("proxyCheckBox"));
singleBrowserCheckBox.setSelected(json.getBoolean("singleBrowserCheckBox"));
headlessModeCheckBox.setSelected(json.getBoolean("headlessModeCheckBox"));
timeoutTextField.setText(json.getString("timeoutTextField"));
}

Expand All @@ -167,6 +171,7 @@ public void setEnabledComponents(Boolean enabled) {
storedXSSCheckBox.setEnabled(enabled);
proxyCheckBox.setEnabled(enabled);
singleBrowserCheckBox.setEnabled(enabled);
headlessModeCheckBox.setEnabled(enabled);
}

public Boolean checkScannerIsConfigured() {
Expand Down Expand Up @@ -229,7 +234,7 @@ public SettingsPanel(DomdigUI parent) {
gbl_settingsPanel_1.columnWidths = new int[]{0, 0, 0, 0};
gbl_settingsPanel_1.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
gbl_settingsPanel_1.columnWeights = new double[]{1.0, 1.0, 0.0, Double.MIN_VALUE};
gbl_settingsPanel_1.rowWeights = new double[]{1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, Double.MIN_VALUE};
gbl_settingsPanel_1.rowWeights = new double[]{1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, Double.MIN_VALUE};
settingsPanel_1.setLayout(gbl_settingsPanel_1);

JLabel lblNewLabel_5 = new JLabel("Modes");
Expand Down Expand Up @@ -295,16 +300,23 @@ public SettingsPanel(DomdigUI parent) {
gbc_lblNewLabel_11.gridx = 0;
gbc_lblNewLabel_11.gridy = 2;
settingsPanel_1.add(lblNewLabel_11, gbc_lblNewLabel_11);


JPanel panel_7 = new JPanel();
FlowLayout flowLayout_7 = (FlowLayout) panel_7.getLayout();
flowLayout_7.setAlignment(FlowLayout.LEFT);
GridBagConstraints gbc_panel_7 = new GridBagConstraints();
gbc_panel_7.insets = new Insets(0, 0, 5, 5);
gbc_panel_7.fill = GridBagConstraints.BOTH;
gbc_panel_7.gridx = 1;
gbc_panel_7.gridy = 2;
settingsPanel_1.add(panel_7, gbc_panel_7);

singleBrowserCheckBox = new JCheckBox("Use a new browser for every new URL");
singleBrowserCheckBox.setSelected(true);
GridBagConstraints gbc_singleBrowserCheckBox = new GridBagConstraints();
gbc_singleBrowserCheckBox.anchor = GridBagConstraints.WEST;
gbc_singleBrowserCheckBox.insets = new Insets(5, 5, 5, 5);
gbc_singleBrowserCheckBox.gridx = 1;
gbc_singleBrowserCheckBox.gridy = 2;
settingsPanel_1.add(singleBrowserCheckBox, gbc_singleBrowserCheckBox);
panel_7.add(singleBrowserCheckBox);

headlessModeCheckBox = new JCheckBox("Headless mode");
panel_7.add(headlessModeCheckBox);

JLabel lblNewLabel_10 = new JLabel("Proxy");
lblNewLabel_10.setFont(new Font("Lucida Grande", Font.BOLD, 13));
GridBagConstraints gbc_lblNewLabel_10 = new GridBagConstraints();
Expand Down
1 change: 0 additions & 1 deletion lib/src/main/java/org/fcvl/domdig/burp/TableEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,5 @@ public void actionPerformed(ActionEvent e) {
for(int i = 0; i < columnWidths.length; i++) {
keyValueTable.getColumnModel().getColumn(i).setPreferredWidth(columnWidths[i]);
}

}
}

0 comments on commit 13c2143

Please sign in to comment.