├── .gitignore
├── README.md
└── copy-to-bcheck
├── .DS_Store
├── .idea
├── .gitignore
├── compiler.xml
├── encodings.xml
├── jarRepositories.xml
├── misc.xml
├── uiDesigner.xml
└── vcs.xml
├── examples
├── request
│ └── request.txt
└── screenshots
│ ├── .DS_Store
│ ├── example1.png
│ ├── example2.png
│ ├── example3.png
│ ├── example4.png
│ └── example5.png
├── pom.xml
├── src
├── .DS_Store
└── main
│ ├── .DS_Store
│ └── java
│ └── extension
│ ├── Bcheck.java
│ ├── CopyToBcheck.java
│ └── MyContextMenuItemsProvider.java
└── target
├── CopyToBcheck-1.0-SNAPSHOT.jar
├── classes
└── extension
│ ├── Bcheck.class
│ ├── CopyToBcheck.class
│ └── MyContextMenuItemsProvider.class
├── maven-archiver
└── pom.properties
└── maven-status
└── maven-compiler-plugin
├── compile
└── default-compile
│ ├── createdFiles.lst
│ └── inputFiles.lst
└── testCompile
└── default-testCompile
└── inputFiles.lst
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Copy to Bcheck
2 |
3 | The purpose of this extension is to streamline the process of creating simple bcheck scripts, reducing the time required to generate them. It works in conjunction with the data provided by the pentester, allowing them to easily copy requests from the Repeater tool and automatically format them into a bcheck script.
4 |
5 | Note that this extension is only capable of generate simple bcheck scripts based on a few set of PortSwigger's example scripts.
6 |
7 |
8 |
9 |
10 |
11 | ## Installation
12 |
13 | To install this extension, follow these steps:
14 |
15 | 1. Download the ``.jar`` file from the releases section of the extension's repository.
16 | 2. Open Burp Suite and navigate to the "Extensions" tab.
17 | 3. Click on the "Add" button in the "Installed" section.
18 | In the dialog that appears, click on the "Choose file" or "Select file" button.
19 | 4. Browse to the location where you saved the downloaded ``.jar`` file and select it.
20 | 5. Click on "Next" to proceed with the installation.
21 | 6. If no errors occured, the extension will be working.
22 |
23 |
24 |
25 |
26 |
27 | Click in next and check if there is no errors on the output.
28 |
29 | ## Usage
30 |
31 | This extension offers support for creating three different types of bcheck scripts. Regardless of the specific script you want to generate, the process is simple and can be done by following these steps:
32 |
33 | 1. Open Burp Suite and navigate to the "Repeater" tool.
34 | 2. Right-click on the desired request or response within the Repeater tool.
35 | 3. From the context menu that appears, select the option related to the extension.
36 | 4. In the extension's context menu, choose the specific bcheck script you want to generate.
37 |
38 |
39 |
40 |
41 |
42 | Below you can understand better each kind of script:
43 |
44 | ### Host-level bcheck scripts
45 | The host bcheck script provided by this extension is designed to run once for each scanned host. It is based on the PortSwigger base host script and allows users to make specific changes according to their requirements.
46 |
47 | Once you have right-clicked on a request or response and selected the "Copy to host bcheck" option from the extension's context menu, a new window will appear. In this window, you can provide additional details to customize the generated bcheck script according to your requirements. The window might look like this:
48 |
49 |
50 |
51 |
52 |
53 |
54 | After providing the necessary information, click the "OK" button. The extension will then copy the generated bcheck script to your clipboard, ready to be pasted in the bcheck creation menu or any text editor of your choice:
55 |
56 |
57 |
58 |
59 |
60 | An important time-saving feature of the extension is the ability to automatically import selected text from the request or response into the ``Value`` input field when using the ``Copy to host bcheck`` option.
61 |
62 | If you have selected a specific piece of text within the request or response, such as a parameter value or a particular header, the extension will detect it and automatically populate the ``Value`` input field in the additional details window with the selected text.
63 |
64 |
65 |
66 |
67 |
68 | The folder examples/request also includes the request used in the screenshot for validation purposes.
69 |
70 | ### Passive bcheck scripts
71 | The functionality of automatically generating a template based on selected strings or regex patterns in the request is similar to the passive base script provided by Portswigger. By simply selecting a specific string or regular expression within the request, you can swiftly generate a customized template that facilitates the detection of patterns within requests or responses.
72 |
73 | ### Insertion point-level bcheck scripts
74 | When utilizing this option, any selected text will be transformed into a check that is applied to each insertion point encountered during scan requests. This means that the selected text will be used as a specific condition or vulnerability indicator that is checked at every point where user input is inserted into the request.
75 |
76 | ## Bcheck scripts documentation
77 | To have a better knowledge about how to modify and improve the bcheck copied, follow the official PortSwigger's definition reference: https://portswigger.net/burp/documentation/scanner/bchecks/bcheck-definition-reference
78 |
79 | ## Contributions
80 | Liked this extension and want to contribute? You canopenning issues to report bugs, submit pull requests with new features or buying a coffee for me.
81 |
82 | [](https://www.buymeacoffee.com/vrechson).
--------------------------------------------------------------------------------
/copy-to-bcheck/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vrechson/copy-to-bcheck/983250deb10b821bbbeae6cdd1660bef8763eb2a/copy-to-bcheck/.DS_Store
--------------------------------------------------------------------------------
/copy-to-bcheck/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Editor-based HTTP Client requests
5 | /httpRequests/
6 | # Datasource local storage ignored files
7 | /dataSources/
8 | /dataSources.local.xml
9 |
--------------------------------------------------------------------------------
/copy-to-bcheck/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/copy-to-bcheck/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/copy-to-bcheck/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/copy-to-bcheck/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/copy-to-bcheck/.idea/uiDesigner.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | -
6 |
7 |
8 | -
9 |
10 |
11 | -
12 |
13 |
14 | -
15 |
16 |
17 | -
18 |
19 |
20 |
21 |
22 |
23 | -
24 |
25 |
26 |
27 |
28 |
29 | -
30 |
31 |
32 |
33 |
34 |
35 | -
36 |
37 |
38 |
39 |
40 |
41 | -
42 |
43 |
44 |
45 |
46 | -
47 |
48 |
49 |
50 |
51 | -
52 |
53 |
54 |
55 |
56 | -
57 |
58 |
59 |
60 |
61 | -
62 |
63 |
64 |
65 |
66 | -
67 |
68 |
69 |
70 |
71 | -
72 |
73 |
74 | -
75 |
76 |
77 |
78 |
79 | -
80 |
81 |
82 |
83 |
84 | -
85 |
86 |
87 |
88 |
89 | -
90 |
91 |
92 |
93 |
94 | -
95 |
96 |
97 |
98 |
99 | -
100 |
101 |
102 | -
103 |
104 |
105 | -
106 |
107 |
108 | -
109 |
110 |
111 | -
112 |
113 |
114 |
115 |
116 | -
117 |
118 |
119 | -
120 |
121 |
122 |
123 |
124 |
--------------------------------------------------------------------------------
/copy-to-bcheck/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/copy-to-bcheck/examples/request/request.txt:
--------------------------------------------------------------------------------
1 | POST /wls-wsat/CoordinatorPortType HTTP/1.1
2 | Host: localhost:7001
3 | Upgrade-Insecure-Requests: 1
4 | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.5735.199 Safari/537.36
5 | Connection: close
6 | Content-Type: text/xml
7 | Content-Length: 630
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | /bin/bash
16 |
17 |
18 | -c
19 |
20 |
21 | ping this-text-will-automatically-change
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/copy-to-bcheck/examples/screenshots/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vrechson/copy-to-bcheck/983250deb10b821bbbeae6cdd1660bef8763eb2a/copy-to-bcheck/examples/screenshots/.DS_Store
--------------------------------------------------------------------------------
/copy-to-bcheck/examples/screenshots/example1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vrechson/copy-to-bcheck/983250deb10b821bbbeae6cdd1660bef8763eb2a/copy-to-bcheck/examples/screenshots/example1.png
--------------------------------------------------------------------------------
/copy-to-bcheck/examples/screenshots/example2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vrechson/copy-to-bcheck/983250deb10b821bbbeae6cdd1660bef8763eb2a/copy-to-bcheck/examples/screenshots/example2.png
--------------------------------------------------------------------------------
/copy-to-bcheck/examples/screenshots/example3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vrechson/copy-to-bcheck/983250deb10b821bbbeae6cdd1660bef8763eb2a/copy-to-bcheck/examples/screenshots/example3.png
--------------------------------------------------------------------------------
/copy-to-bcheck/examples/screenshots/example4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vrechson/copy-to-bcheck/983250deb10b821bbbeae6cdd1660bef8763eb2a/copy-to-bcheck/examples/screenshots/example4.png
--------------------------------------------------------------------------------
/copy-to-bcheck/examples/screenshots/example5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vrechson/copy-to-bcheck/983250deb10b821bbbeae6cdd1660bef8763eb2a/copy-to-bcheck/examples/screenshots/example5.png
--------------------------------------------------------------------------------
/copy-to-bcheck/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | burp
8 | CopyToBcheck
9 | 1.0-SNAPSHOT
10 |
11 |
12 | 16
13 | 16
14 | UTF-8
15 |
16 |
17 |
18 |
19 | net.portswigger.burp.extensions
20 | montoya-api
21 | 2023.5
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/copy-to-bcheck/src/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vrechson/copy-to-bcheck/983250deb10b821bbbeae6cdd1660bef8763eb2a/copy-to-bcheck/src/.DS_Store
--------------------------------------------------------------------------------
/copy-to-bcheck/src/main/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vrechson/copy-to-bcheck/983250deb10b821bbbeae6cdd1660bef8763eb2a/copy-to-bcheck/src/main/.DS_Store
--------------------------------------------------------------------------------
/copy-to-bcheck/src/main/java/extension/Bcheck.java:
--------------------------------------------------------------------------------
1 | package extension;
2 |
3 | import javax.swing.*;
4 | import javax.swing.border.Border;
5 | import java.awt.*;
6 | import java.awt.datatransfer.*;
7 | import java.awt.event.ActionEvent;
8 | import java.awt.event.ActionListener;
9 | import java.util.List;
10 |
11 | import burp.api.montoya.MontoyaApi;
12 | import burp.api.montoya.http.message.HttpHeader;
13 | import burp.api.montoya.http.message.HttpRequestResponse;
14 |
15 | public class Bcheck implements ActionListener, ClipboardOwner, Runnable {
16 |
17 | private MontoyaApi api = null;
18 | private HttpRequestResponse request = null;
19 | private String mode = "";
20 | private String args = "";
21 |
22 |
23 | public Bcheck(MontoyaApi api, HttpRequestResponse request, String mode, String args) {
24 |
25 | this.api = api;
26 | this.request = request;
27 | this.mode = mode;
28 | this.args = args;
29 |
30 | formatBcheck();
31 | }
32 |
33 | public void setRequestResponse (HttpRequestResponse request) {
34 | this.request = request;
35 | }
36 |
37 | public void setArgs (String args) {
38 | this.args = args;
39 | }
40 |
41 | public void formatBcheck() {
42 | JPanel panel = new JPanel();
43 | panel.setLayout(new GridLayout(0, 1));
44 |
45 | JLabel label = null;
46 |
47 | JPanel row1 = new JPanel(new BorderLayout());
48 | label = new JLabel("Bcheck Name: ");
49 | label.setPreferredSize(new Dimension(100, label.getPreferredSize().height));
50 | //panel.add(label);
51 | row1.add(label, BorderLayout.WEST);
52 | JTextField bname = new JTextField("");
53 | bname.setColumns(20);
54 | row1.add(bname, BorderLayout.CENTER);
55 | panel.add(row1);
56 |
57 | JPanel row2 = new JPanel(new BorderLayout());
58 | label = new JLabel("Description: ");
59 | label.setPreferredSize(new Dimension(100, label.getPreferredSize().height));
60 | row2.add(label, BorderLayout.WEST);
61 | //panel.add(label);
62 | JTextField desc = new JTextField("");
63 | desc.setColumns(20);
64 | row2.add(desc, BorderLayout.CENTER);
65 | panel.add(row2);
66 |
67 | JPanel row3 = new JPanel(new BorderLayout());
68 | label = new JLabel("Author: ");
69 | label.setPreferredSize(new Dimension(100, label.getPreferredSize().height));
70 | row3.add(label, BorderLayout.WEST);
71 | JTextField author = new JTextField("");
72 | author.setColumns(20);
73 | row3.add(author, BorderLayout.CENTER);
74 | panel.add(row3);
75 |
76 | JComboBox successList = null, parameterList = null, severityList = null, confidenceList = null;
77 | JTextField sink = null, regex = null, insertion = null;
78 | String[] parameterStrings = {"status code", "body", "headers", "response", "collaborator"};
79 |
80 | JPanel row4 = new JPanel(new BorderLayout());
81 | String[] successStrings = {"matches", "differs", "in", "is"};
82 | JLabel successLabel = new JLabel("Success if: ");
83 | successLabel.setPreferredSize(new Dimension(100, label.getPreferredSize().height));
84 | row4.add(successLabel, BorderLayout.WEST);
85 | successList = new JComboBox(successStrings);
86 | row4.add(successList, BorderLayout.CENTER);
87 | panel.add(row4);
88 |
89 | String windowTitle = "Template Configuration";
90 |
91 | switch (this.mode) {
92 | case "host":
93 |
94 | JPanel row5 = new JPanel(new BorderLayout());
95 | label = new JLabel("Parameter: ");
96 | label.setPreferredSize(new Dimension(100, label.getPreferredSize().height));
97 | row5.add(label, BorderLayout.WEST);
98 | //panel.add(label);
99 | parameterList = new JComboBox(parameterStrings);
100 | row5.add(parameterList, BorderLayout.CENTER);
101 | panel.add(row5);
102 |
103 | JPanel row6 = new JPanel(new BorderLayout());
104 | label = new JLabel("Value: ");
105 | label.setPreferredSize(new Dimension(100, label.getPreferredSize().height));
106 | row6.add(label, BorderLayout.WEST);
107 | sink = new JTextField(args);
108 | sink.setColumns(20);
109 | row6.add(sink, BorderLayout.CENTER);
110 | panel.add(row6);
111 |
112 | windowTitle = "Host based Check Configuration";
113 |
114 | break;
115 |
116 | case "passive":
117 |
118 | JPanel row7 = new JPanel(new BorderLayout());
119 | label = new JLabel("Regex: ");
120 | label.setPreferredSize(new Dimension(100, label.getPreferredSize().height));
121 | row7.add(label, BorderLayout.WEST);
122 | regex = new JTextField(this.args);
123 | regex.setColumns(20);
124 | row7.add(regex, BorderLayout.CENTER);
125 | panel.add(row7);
126 |
127 | windowTitle = "Passive based Check Configuration";
128 |
129 | break;
130 |
131 | case "insertion":
132 |
133 | JPanel row8 = new JPanel(new BorderLayout());
134 | parameterStrings = new String[]{"response", "collaborator"};
135 | label = new JLabel("Parameter: ");
136 | label.setPreferredSize(new Dimension(100, label.getPreferredSize().height));
137 | row8.add(label, BorderLayout.WEST);
138 | //panel.add(label);
139 | parameterList = new JComboBox(parameterStrings);
140 | row8.add(parameterList, BorderLayout.CENTER);
141 | panel.add(row8);
142 |
143 | JPanel row9 = new JPanel(new BorderLayout());
144 | label = new JLabel("Insertion Vector: ");
145 | label.setPreferredSize(new Dimension(100, label.getPreferredSize().height));
146 | row9.add(label, BorderLayout.WEST);
147 | //panel.add(label);
148 | insertion = new JTextField(this.args);
149 | insertion.setColumns(20);
150 | row9.add(insertion, BorderLayout.CENTER);
151 | panel.add(row9);
152 |
153 | JPanel row10 = new JPanel(new BorderLayout());
154 | label = new JLabel("Success Regex: ");
155 | label.setPreferredSize(new Dimension(100, label.getPreferredSize().height));
156 | row10.add(label, BorderLayout.WEST);
157 | regex = new JTextField("");
158 | regex.setColumns(20);
159 | row10.add(regex, BorderLayout.CENTER);
160 | panel.add(row10);
161 |
162 | panel.remove(row4);
163 |
164 | windowTitle = "Insertion based Check Configuration";
165 |
166 | break;
167 | }
168 |
169 | JPanel row11 = new JPanel(new BorderLayout());
170 | String[] severityStrings = { "Info", "Low", "Medium", "High"};
171 | JLabel severityLabel = new JLabel("Severity: ");
172 | severityLabel.setPreferredSize(new Dimension(100, label.getPreferredSize().height));
173 | row11.add(severityLabel, BorderLayout.WEST);
174 | //panel.add(severityLabel);
175 | severityList = new JComboBox(severityStrings);
176 | row11.add(severityList, BorderLayout.CENTER);
177 | panel.add(row11);
178 |
179 | JPanel row12 = new JPanel(new BorderLayout());
180 | String[] confidenceStrings = { "Tentative", "Certain", "Firm"};
181 | label = new JLabel("Confidence: ");
182 | label.setPreferredSize(new Dimension(100, label.getPreferredSize().height));
183 | row12.add(label, BorderLayout.WEST);
184 | //panel.add(label);
185 | confidenceList = new JComboBox(confidenceStrings);
186 | row12.add(confidenceList, BorderLayout.CENTER);
187 | panel.add(row12);
188 |
189 | JPanel row13 = new JPanel(new BorderLayout());
190 | label = new JLabel("Remediation: ");
191 | label.setPreferredSize(new Dimension(100, label.getPreferredSize().height));
192 | row13.add(label, BorderLayout.WEST);
193 | JTextField remediation = new JTextField("");
194 | remediation.setColumns(20);
195 | row13.add(remediation, BorderLayout.CENTER);
196 | panel.add(row13);
197 |
198 | int result = JOptionPane.showConfirmDialog(
199 | this.api.userInterface().swingUtils().suiteFrame(),
200 | panel,
201 | windowTitle,
202 | JOptionPane.OK_CANCEL_OPTION,
203 | JOptionPane.PLAIN_MESSAGE
204 | );
205 |
206 | if (result == JOptionPane.OK_OPTION) {
207 |
208 | // Write template
209 | String template =
210 | "metadata:\n" +
211 | " language: v1-beta\n" +
212 | " name: \""+bname.getText()+"\"\n" +
213 | " description: \""+desc.getText()+"\"\n" +
214 | " author: \""+author.getText()+"\"\n";
215 |
216 | switch (this.mode) {
217 |
218 | case "host":
219 | String method = this.request.request().method();
220 | String path = this.request.request().path();
221 | String param = this.request.request().parameters().toString();
222 | String body = this.request.request().bodyToString();
223 |
224 | template +=
225 | "tags: \"host-level\"\n\n" +
226 | "\nrun for each:\n" +
227 | " potential_path =\n" +
228 | " \""+ path +"\"\n\n" +
229 | "given host then\n" +
230 | " send request called check:\n" +
231 | " method: \""+ method +"\"\n" +
232 | " path: {potential_path}\n" +
233 | " headers: \n";
234 |
235 | for (HttpHeader h : this.request.request().headers()) {
236 | String strEnd = (this.request.request().headers().indexOf(h) == (this.request.request().headers().size() - 1)) ? "`\n" : "`,\n";
237 |
238 | if (h.name().equals("Host")) {
239 | continue;
240 | }
241 | template +=
242 | " \""+ h.name().replaceAll("\"", "\\\\\\\"") +"\": `";
243 | if (parameterList.getSelectedItem().toString() == "collaborator" && h.value().contains(sink.getText())) {
244 | api.logging().logToOutput(parameterList.getSelectedItem().toString());
245 | String s = h.value().replaceAll(sink.getText(), "{generate_collaborator_address()}");
246 | s = s.replaceAll("`", "\\\\`") + strEnd;
247 | template += s;
248 | } else {
249 | String s = h.value().replaceAll("`", "\\\\`") + strEnd;
250 | template += s;
251 | }
252 | }
253 |
254 | if (method == "PUT" || method == "POST" || method == "PATCH") {
255 | if (parameterList.getSelectedItem().toString().equals("collaborator")) {
256 | body = body.replaceAll(sink.getText(), "{generate_collaborator_address()}");
257 | }
258 |
259 | template +=
260 | " body: \n`" + body.replaceAll("`", "\\\\`") + "`\n";
261 | }
262 |
263 | template += "\n";
264 | if (parameterList.getSelectedItem() == "collaborator") {
265 | template += " if any interactions then\n";
266 | } else {
267 | template += " if";
268 |
269 | if (parameterList.getSelectedItem().equals("status code")) {
270 | template += " {check.response.status_code}";
271 | } else if (parameterList.getSelectedItem().equals("body")) {
272 | template += " {check.response.body}";
273 | } else if (parameterList.getSelectedItem().equals("headers")) {
274 | template += " {check.response.headers}";
275 | } else if (parameterList.getSelectedItem().equals("response")) {
276 | template += " {check.response}";
277 | }
278 |
279 | if (successList.getSelectedItem().equals("matches")) {
280 | template += " matches";
281 | } else if (successList.getSelectedItem().toString().equals("is")) {
282 | template += " is";
283 | } else if (successList.getSelectedItem().toString().equals("differs")) {
284 | template += " differs";
285 | } else if (successList.getSelectedItem().toString().equals("in")) {
286 | template += " in";
287 | }
288 |
289 | template += " \"" + sink.getText() + "\" then\n";
290 | }
291 |
292 | template +=
293 | " report issue:\n" +
294 | " severity: "+severityList.getSelectedItem().toString().toLowerCase()+"\n" +
295 | " confidence: "+confidenceList.getSelectedItem().toString().toLowerCase()+"\n" +
296 | " detail: `"+bname.getText()+" found at {potential_path}.`\n" +
297 | " remediation: \""+remediation.getText()+"\"\n" +
298 | " end if";
299 | break;
300 |
301 | case "passive":
302 | template +=
303 | "tags: \"passive\"\n\n" +
304 | "given response then\n" +
305 | " if {latest.response}";
306 |
307 | if (successList.getSelectedItem().equals("matches")) {
308 | template += " matches";
309 | } else if (successList.getSelectedItem().equals("is")) {
310 | template += " is";
311 | } else if (successList.getSelectedItem().equals("differs")) {
312 | template += " differs";
313 | } else if (successList.getSelectedItem().equals("in")) {
314 | template += " in";
315 | }
316 |
317 | template += " \""+ regex.getText().replaceAll("\"", "\\\\\\\"") + "\" or {latest.request}";
318 |
319 | if (successList.getSelectedItem().equals("matches")) {
320 | template += " matches";
321 | } else if (successList.getSelectedItem().equals("is")) {
322 | template += " is";
323 | } else if (successList.getSelectedItem().equals("differs")) {
324 | template += " differs";
325 | } else if (successList.getSelectedItem().equals("in")) {
326 | template += " in";
327 | }
328 |
329 | template += " \""+ regex.getText().replaceAll("\"", "\\\\\\\"") + "\" then\n" +
330 | " report issue:\n" +
331 | " severity: "+ severityList.getSelectedItem().toString().toLowerCase() +"\n" +
332 | " confidence: "+ confidenceList.getSelectedItem().toString().toLowerCase() +"\n" +
333 | " detail: `"+bname.getText()+" found.`\n" +
334 | " remediation: \""+remediation.getText()+"\"\n" +
335 | " end if";
336 | break;
337 |
338 | case "insertion":
339 | template +=
340 | "tags: \"insertion-point-level\"\n\n" +
341 | "define:\n" +
342 | " insertion=\""+insertion.getText()+"\"\n" +
343 | " answer=\""+regex.getText()+"\"\n" +
344 | "\n" +
345 | "given insertion point then\n" +
346 | "\n" +
347 | " if not({answer} in {base.response}) then\n" +
348 | " send payload:\n" +
349 | " appending: {insertion}\n" +
350 | "\n";
351 |
352 | if (parameterList.getSelectedItem().equals("collaborator")) {
353 | template += " if any interaction then\n";
354 | } else if (parameterList.getSelectedItem().equals("response")){
355 | template += " if {answer} in {latest.response} then\n";
356 | }
357 |
358 | template +=
359 | " report issue:\n" +
360 | " severity: "+severityList.getSelectedItem().toString().toLowerCase()+"\n" +
361 | " confidence: "+confidenceList.getSelectedItem().toString().toLowerCase()+"\n" +
362 | " detail: `"+bname.getText()+" found.`\n"+
363 | " remediation: `"+remediation.getText()+"`\n" +
364 | " end if\n" +
365 | " end if\n";
366 | break;
367 | }
368 |
369 | if (!template.equals("")) {
370 | Toolkit.getDefaultToolkit().getSystemClipboard()
371 | .setContents(new StringSelection(template), this);
372 | }
373 | }
374 |
375 | }
376 |
377 | @Override
378 | public void actionPerformed(ActionEvent e) {
379 | }
380 |
381 | @Override
382 | public void lostOwnership(Clipboard aClipboard, Transferable aContents) {}
383 |
384 | @Override
385 | public void run() {
386 |
387 | }
388 | }
--------------------------------------------------------------------------------
/copy-to-bcheck/src/main/java/extension/CopyToBcheck.java:
--------------------------------------------------------------------------------
1 | package extension;
2 |
3 | import burp.api.montoya.BurpExtension;
4 | import burp.api.montoya.MontoyaApi;
5 | import burp.api.montoya.logging.Logging;
6 |
7 | public class CopyToBcheck implements BurpExtension
8 | {
9 | @Override
10 | public void initialize(MontoyaApi api)
11 | {
12 | String version = "v1.1";
13 | // set extension name
14 | api.extension().setName("Copy to bcheck extension");
15 |
16 | Logging logging = api.logging();
17 |
18 | // write a message to our output stream
19 | logging.logToOutput("Copy to bcheck, version: "+version);
20 | logging.logToOutput("Loading extension.");
21 |
22 | // register menu entry
23 | api.userInterface().registerContextMenuItemsProvider(new MyContextMenuItemsProvider(api));
24 |
25 | logging.logToOutput("Extension loaded.");
26 | // throw an exception that will appear in our error stream
27 | //throw new RuntimeException("Hello exception.");
28 | }
29 | }
--------------------------------------------------------------------------------
/copy-to-bcheck/src/main/java/extension/MyContextMenuItemsProvider.java:
--------------------------------------------------------------------------------
1 | package extension;
2 |
3 | import burp.api.montoya.MontoyaApi;
4 | import burp.api.montoya.core.ToolType;
5 | import burp.api.montoya.http.message.HttpRequestResponse;
6 | import burp.api.montoya.ui.contextmenu.ContextMenuEvent;
7 | import burp.api.montoya.ui.contextmenu.ContextMenuItemsProvider;
8 |
9 | import javax.swing.*;
10 | import java.awt.*;
11 | import java.awt.event.ActionListener;
12 | import java.util.ArrayList;
13 | import java.util.List;
14 |
15 | public class MyContextMenuItemsProvider implements ContextMenuItemsProvider
16 | {
17 |
18 | private final MontoyaApi api;
19 | private final JMenuItem hostBcheck;
20 | private final JMenuItem passiveBcheck;
21 | private final JMenuItem entryBcheck;
22 |
23 | public MyContextMenuItemsProvider(MontoyaApi api)
24 | {
25 | this.api = api;
26 | hostBcheck = new JMenuItem("Copy to host bcheck");
27 | passiveBcheck = new JMenuItem("Copy to passive bcheck");
28 | entryBcheck = new JMenuItem("Copy to insertion bcheck");
29 | }
30 |
31 | @Override
32 | public List provideMenuItems(ContextMenuEvent event)
33 | {
34 | if (event.isFromTool(ToolType.PROXY, ToolType.TARGET, ToolType.LOGGER, ToolType.REPEATER))
35 | {
36 | List menuItemList = new ArrayList<>();
37 | String args = "";
38 |
39 | HttpRequestResponse requestResponse = event.messageEditorRequestResponse().isPresent() ? event.messageEditorRequestResponse().get().requestResponse() : event.selectedRequestResponses().get(0);
40 |
41 | if (event.messageEditorRequestResponse().isPresent()) {
42 |
43 | String context = event.messageEditorRequestResponse().get().selectionContext().toString();
44 | if (event.messageEditorRequestResponse().get().selectionOffsets().isPresent()) {
45 | if (context.equals("RESPONSE")) {
46 | args = event.messageEditorRequestResponse().get().requestResponse().response().toString().substring(event.messageEditorRequestResponse().get().selectionOffsets().get().startIndexInclusive(), event.messageEditorRequestResponse().get().selectionOffsets().get().endIndexExclusive());
47 | } else if (context.equals("REQUEST")) {
48 | args = event.messageEditorRequestResponse().get().requestResponse().request().toString().substring(event.messageEditorRequestResponse().get().selectionOffsets().get().startIndexInclusive(), event.messageEditorRequestResponse().get().selectionOffsets().get().endIndexExclusive());
49 | }
50 | }
51 | }
52 | String finalArgs = args;
53 |
54 | // maybe a shit way but idk another way of prevent it to add infinite action listeners
55 | for (ActionListener listener : hostBcheck.getActionListeners()) {
56 | hostBcheck.removeActionListener(listener);
57 | }
58 | hostBcheck.addActionListener(l -> new Bcheck(api, requestResponse, "host", finalArgs));
59 | menuItemList.add(hostBcheck);
60 |
61 | // maybe a shit way but idk another way of prevent it to add infinite action listeners
62 | for (ActionListener listener : passiveBcheck.getActionListeners()) {
63 | passiveBcheck.removeActionListener(listener);
64 | }
65 | passiveBcheck.addActionListener(l -> new Bcheck(api, requestResponse, "passive", finalArgs));
66 | menuItemList.add(passiveBcheck);
67 |
68 | // maybe a shit way but idk another way of prevent it to add infinite action listeners
69 | for (ActionListener listener : entryBcheck.getActionListeners()) {
70 | entryBcheck.removeActionListener(listener);
71 | }
72 | entryBcheck.addActionListener(l -> new Bcheck(api, requestResponse, "insertion", finalArgs));
73 | menuItemList.add(entryBcheck);
74 |
75 | return menuItemList;
76 | }
77 |
78 | return null;
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/copy-to-bcheck/target/CopyToBcheck-1.0-SNAPSHOT.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vrechson/copy-to-bcheck/983250deb10b821bbbeae6cdd1660bef8763eb2a/copy-to-bcheck/target/CopyToBcheck-1.0-SNAPSHOT.jar
--------------------------------------------------------------------------------
/copy-to-bcheck/target/classes/extension/Bcheck.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vrechson/copy-to-bcheck/983250deb10b821bbbeae6cdd1660bef8763eb2a/copy-to-bcheck/target/classes/extension/Bcheck.class
--------------------------------------------------------------------------------
/copy-to-bcheck/target/classes/extension/CopyToBcheck.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vrechson/copy-to-bcheck/983250deb10b821bbbeae6cdd1660bef8763eb2a/copy-to-bcheck/target/classes/extension/CopyToBcheck.class
--------------------------------------------------------------------------------
/copy-to-bcheck/target/classes/extension/MyContextMenuItemsProvider.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vrechson/copy-to-bcheck/983250deb10b821bbbeae6cdd1660bef8763eb2a/copy-to-bcheck/target/classes/extension/MyContextMenuItemsProvider.class
--------------------------------------------------------------------------------
/copy-to-bcheck/target/maven-archiver/pom.properties:
--------------------------------------------------------------------------------
1 | #Generated by Maven
2 | #Fri Jul 14 14:30:43 EDT 2023
3 | groupId=burp
4 | artifactId=CopyToBcheck
5 | version=1.0-SNAPSHOT
6 |
--------------------------------------------------------------------------------
/copy-to-bcheck/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst:
--------------------------------------------------------------------------------
1 | extension/Bcheck.class
2 | extension/CopyToBcheck.class
3 | extension/MyContextMenuItemsProvider.class
4 |
--------------------------------------------------------------------------------
/copy-to-bcheck/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst:
--------------------------------------------------------------------------------
1 | /Users/vrechson/Documents/devel/copy-to-bcheck/copy-to-bcheck/src/main/java/extension/Bcheck.java
2 | /Users/vrechson/Documents/devel/copy-to-bcheck/copy-to-bcheck/src/main/java/extension/CopyToBcheck.java
3 | /Users/vrechson/Documents/devel/copy-to-bcheck/copy-to-bcheck/src/main/java/extension/MyContextMenuItemsProvider.java
4 |
--------------------------------------------------------------------------------
/copy-to-bcheck/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vrechson/copy-to-bcheck/983250deb10b821bbbeae6cdd1660bef8763eb2a/copy-to-bcheck/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
--------------------------------------------------------------------------------