Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.

Commit 8d6dcf8

Browse files
authored
Merge pull request #73 from doyensec/2ndgen-extensions
2ndgen extensions
2 parents 5c4d413 + c9fbac2 commit 8d6dcf8

File tree

12 files changed

+396
-116
lines changed

12 files changed

+396
-116
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,6 @@ bin/
4848
lib/burpsuite_pro*.jar
4949
lib/burpsuite_free*.jar
5050
lib/burpsuite_community*.jar
51+
52+
# Avoid committing generated files
53+
src/main/resources/static/*.jar

FAQ.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
FAQ
2+
===
3+
4+
Is Burp Suite Free/Community edition supported?
5+
-----------------------------------------------
6+
7+
No, it is not. Burp Rest API exposes functionalities that are best suited for the Professional
8+
version of Burp Suite. Even if it was possible to start _burp-rest-api_ using the Free version of Burp, this is no longer possible and the support won't be included in future releases.
9+
10+
Whenever I run the gradle command I receive an error. What can be the the cause?
11+
----------------------------------------------------------------------------
12+
13+
Often times, Gradle introduces incompatibility between major versions, therefore
14+
the recommended way of executing any Gradle build is by using the Gradle
15+
Wrapper (in short just “Wrapper”). The Wrapper is a script that invokes a
16+
declared version of Gradle, downloading it beforehand if necessary.
17+
18+
See [Issue 37](https://github.com/vmware/burp-rest-api/issues/37).
19+
20+
Is it possible to run burp-rest-api graphically in remote servers?
21+
------------------------------------------------------------------
22+
23+
Yes, it is possible to run Burp in graphical environments in multiple
24+
configurations (X Forwarding, Full VNC, RDP, XPRA).
25+
26+
For running a non persistent X Forwarding session on your OS you can follow this
27+
[guide](https://uisapp2.iu.edu/confluence-prd/pages/viewpage.action?pageId=280461906).
28+
29+
See [Issue 60](https://github.com/vmware/burp-rest-api/issues/60).
30+
31+
Is it possible to customize the binding address:port for Burp Proxy and/or burp-rest-api APIs?
32+
----------------------------------------------------------------------------------------------
33+
34+
There are two binding ports in a standard burp-rest-api setup:
35+
- **burp-rest-api RPC mechanism**. Both IP address and port can be customized at runtime using command line arguments (namely _--server.address_ and _--server.port_)
36+
- **Burp Proxy Listener**. This is a Burp Suite configuration, and can be customized using a custom project option file.
37+
38+
```
39+
"request_listeners":[
40+
{
41+
"certificate_mode":"per_host",
42+
"listen_mode":"192.168.1.1",
43+
"listener_port":8080,
44+
"running":true
45+
}
46+
```
47+
48+
Is Burp Suite v2 supported?
49+
----------------------------------------------------------------------------------------------
50+
51+
Next generation Burp Suite v2 is a beta release at the time of writing this FAQ. While we will *try* to mantain support for both Burp Suite stable and beta, we cannot ensure full compability. For production, please stay on Burp Suite Professional stable branch.

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Copyright (c) 2016 VMware, Inc. All Rights Reserved.
2+
Copyright (c) 2018 Doyensec LLC. All Rights Reserved.
23

34
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
45
following conditions are met: Redistributions of source code must retain the above copyright notice, this list of

README.md

Lines changed: 55 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -4,105 +4,55 @@
44

55
A REST/JSON API to the Burp Suite security tool.
66

7-
Upon successfully building the project, an executable JAR file is created with the Burp Suite Professional JAR bundled
8-
in it. When the JAR is launched, it provides a REST/JSON endpoint to access the Scanner, Spider, Proxy and other
9-
features of the Burp Suite Professional security tool.
10-
11-
## Try it out
12-
13-
### Prerequisites
14-
15-
* Java 8
16-
* Gradle
17-
* Licensed Burp Suite Professional version 1.7.x or later from: <http://portswigger.net/burp/>
18-
19-
20-
### Build & Run
21-
22-
1. [Download](https://portswigger.net/burp/download.html) the Professional edition of Burp Suite.
23-
2. Create a `lib` folder under the project directory and place the Burp Suite JAR file into it and rename it to "burpsuite_pro.jar".
24-
3. The project can be run either by running the Gradle Spring `bootRun` command or by directly launching the JAR
25-
created from building the project:
26-
27-
```
28-
gradlew bootRun
29-
```
30-
31-
or
32-
33-
```
34-
# build the jar
35-
gradlew clean build
36-
# and run it
37-
java -jar build/libs/burp-rest-api-1.0.2.jar
38-
```
39-
The version number of the JAR should match the version number from `build.gradle` while generating the JAR.
7+
Since version 2.0.0 it is possible to run the burp-rest-api release jar,
8+
downloading it directly from the
9+
[release channel](https://github.com/vmware/burp-rest-api/releases).
4010

4111
## Documentation
4212

4313
### Configuration
4414

45-
By default, Burp is launched in headless mode with the Proxy running on port 8080/tcp (localhost only) and the REST endpoint running on 8090/tcp (localhost only).
15+
By default, Burp is launched in headless mode with the Proxy running on port 8080/tcp (**localhost only**) and the REST endpoint running on 8090/tcp (**localhost only**).
4616

4717
To __run Burp in UI mode__ from the command line, use one of the following commands:
4818

49-
With the `bootRun` command:
50-
```
51-
gradlew bootRun -Djava.awt.headless=false
5219
```
53-
or
54-
```
55-
gradlew bootRun -Dheadless.mode=false
56-
```
57-
or with the `bootRun` command using the `-PappArgs` to pass args directly to burp suite :
58-
```
59-
gradlew bootRun -PappArgs="['-Djava.awt.headless=false','--project-file=./test.burp']"
60-
```
61-
With the executable JAR:
62-
```
63-
java -jar burp-rest-api-1.0.2.jar -Djava.awt.headless=false
20+
java -jar burp-rest-api-2.0.0.jar -Djava.awt.headless=false --burp.jar=./lib/burpsuite_pro.jar
6421
```
6522
or
6623
```
67-
java -jar burp-rest-api-1.0.2.jar --headless.mode=false
24+
java -jar burp-rest-api-2.0.0.jar --headless.mode=false --burp.jar=./lib/burpsuite_pro.jar
6825
```
6926

7027

7128
To __modify the server port__ on which the API is accessible, use one of the following commands:
7229

73-
With the `bootRun` command:
7430
```
75-
gradlew bootRun -Dserver.port=8081
31+
java -jar burp-rest-api-2.0.0.jar --server.port=8081 --burp.jar=./lib/burpsuite_pro.jar
7632
```
7733
or
7834
```
79-
gradlew bootRun -Dport=8081
80-
```
81-
82-
With the executable JAR:
83-
```
84-
java -jar burp-rest-api-1.0.2.jar --server.port=8081
85-
```
86-
or
87-
```
88-
java -jar burp-rest-api-1.0.2.jar --port=8081
35+
java -jar burp-rest-api-2.0.0.jar --port=8081 --burp.jar=./lib/burpsuite_pro.jar
8936
```
9037

9138
You can also __modify the server address__, used for network address binding:
9239

93-
With the `bootRun` command:
9440
```
95-
gradlew bootRun -Dserver.address=192.168.1.2
41+
java -jar burp-rest-api-2.0.0.jar --server.address=192.168.1.2 --burp.jar=./lib/burpsuite_pro.jar
9642
```
9743
or
9844
```
99-
gradlew bootRun -Daddress=192.168.1.2
45+
java -jar burp-rest-api-2.0.0.jar --address=192.168.1.2 --burp.jar=./lib/burpsuite_pro.jar
10046
```
10147

10248
### Command Line Arguments
10349

10450
The following command line arguments are used only by the extension to configure the run mode and port number.
10551

52+
`--burp.jar=<filaname.jar>` : Loads the Burp jar dinamically, and expose it through REST APIs. This flag is required.
53+
54+
`--burp.ext=<filename.{jar,rb,py}` : Loads the given Burp extensions during application startup. This flag can be repeated.
55+
10656
`--server.port=<port_number>` : The REST API endpoint is available at the given port number. `--port=<port_number>`
10757
works as short hand argument.
10858

@@ -122,7 +72,7 @@ Command line arguments passed to the executable burp-rest-api JAR are forwarded
12272
`--config-file=<filename>` : Opens the project using the options contained in the selected project configuration file. To
12373
load multiple project configurations, this argument can be passed more than once with different values.
12474

125-
`--user-config-file=<filename>` : Opens the project using the options contained in the selected user configuration file. To
75+
`--user-config-file=<filename>` : Opens the project using the options contained in the selected user configuration file. To
12676
load multiple user configurations, this argument can be passed more than once with different values.
12777

12878
For more information on Projects, refer to the Burp Suite documentation
@@ -155,18 +105,55 @@ This project also comes with a client (_BurpClient.java_) written in Java for us
155105
## Credits
156106

157107
This project is originally inspired from [Resty-Burp](https://github.com/continuumsecurity/resty-burp
158-
"continuumsecurity/resty-burp: REST/JSON interface to Burp Suite") and is developed in partnership with [Doyensec](https://www.doyensec.com).
108+
"continuumsecurity/resty-burp: REST/JSON interface to Burp Suite"), and is developed in partnership with [Doyensec LLC](https://doyensec.com/). <img src="https://www.doyensec.com/images/logo.png" width="300">
159109

160110
## Contributing
161111

162112
The burp-rest-api project team welcomes contributions from the community. If you wish to contribute code and you have
163113
not signed our contributor license agreement (CLA), our bot will update the issue when you open a Pull Request. For
164-
any questions about the CLA process, please refer to our [FAQ](https://cla.vmware.com/faq). For more detailed
165-
information, refer to [CONTRIBUTING.md](CONTRIBUTING.md).
114+
any questions about the CLA process, please refer to our [CLA FAQ](https://cla.vmware.com/faq). For more detailed
115+
information, refer to [CONTRIBUTING.md](CONTRIBUTING.md) and [FAQ.md](FAQ.md).
116+
117+
### Develop
118+
119+
Upon successfully building the project, an executable JAR file is created.
120+
The Burp suite JAR can be loaded dinamically through the `--burp.jar=` argument.
121+
When the JAR is launched, it provides a REST/JSON endpoint to access the Scanner, Spider, Proxy and other
122+
features of the Burp Suite Professional security tool.
123+
124+
#### Prerequisites
125+
126+
* Java 8
127+
* Gradle
128+
* Licensed Burp Suite Professional version 1.7.x or later from: <http://portswigger.net/burp/>
129+
130+
131+
#### Build & Run
132+
133+
1. [Download](https://portswigger.net/burp/download.html) the Professional edition of Burp Suite.
134+
2. The project can be run either by running the Gradle Spring `bootRun` command or by directly launching the JAR
135+
created from building the project:
136+
3. OPTIONAL: Create a `lib` folder under the project directory and place the Burp Suite JAR file into it and rename it to "burpsuite_pro.jar" in order to run the integration tests.
137+
138+
```
139+
./gradlew bootRun --burp.jar=./lib/burpsuite_pro.jar
140+
```
141+
142+
or
143+
144+
```
145+
# build the jar
146+
./gradlew clean build
147+
# and run it
148+
java -jar build/libs/burp-rest-api-2.0.0.jar --burp.jar=./lib/burpsuite_pro.jar
149+
```
150+
The version number of the JAR should match the version number from `build.gradle` while generating the JAR.
151+
166152

167153
## License
168154

169155
Copyright (c) 2016 VMware, Inc. All Rights Reserved.
156+
Copyright (c) 2018 Doyensec LLC. All Rights Reserved.
170157

171158
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
172159
following conditions are met: Redistributions of source code must retain the above copyright notice, this list of

build.gradle

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ apply plugin: 'eclipse'
1515
apply plugin: 'spring-boot'
1616

1717
final def extensionName = 'burp-rest-api'
18-
version = '1.0.4'
18+
version = '2.0.0'
1919

2020
def updateVersion() {
2121
def configFile = new File('src/main/resources/application.yml')
@@ -25,6 +25,17 @@ def updateVersion() {
2525
configFile.write(configContent, 'UTF-8')
2626
}
2727

28+
sourceSets {
29+
entrypoint {
30+
java {
31+
compileClasspath += main.output
32+
runtimeClasspath += main.output
33+
}
34+
}
35+
}
36+
37+
test.onlyIf { file('./lib/burpsuite_pro.jar').exists() }
38+
2839
allprojects {
2940
//Display warning
3041
println " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
@@ -55,19 +66,22 @@ targetCompatibility = 1.8
5566
File schemaTargetDir = new File('build/generated-schema')
5667

5768
configurations {
58-
jaxb
69+
jaxb
5970
compile.exclude module: "spring-boot-starter-tomcat"
71+
testCompile.extendsFrom entrypointCompile
72+
testRuntime.extendsFrom entrypointRuntime
6073
}
6174

6275
dependencies {
6376
compile('org.springframework.boot:spring-boot-starter-web')
6477
compile("org.springframework.boot:spring-boot-starter-jetty")
65-
compile fileTree(dir: 'lib', include: '**/*.jar')
6678
compile "io.springfox:springfox-swagger2:2.+"
6779
compile "io.springfox:springfox-swagger-ui:2.+"
68-
69-
compile name: 'burpsuite_pro'
80+
compileOnly "net.portswigger.burp.extender:burp-extender-api:1.7.22"
81+
82+
entrypointCompileOnly "net.portswigger.burp.extender:burp-extender-api:1.7.22"
7083

84+
testCompile fileTree(dir: 'lib', include: '**/*.jar')
7185
testCompile('org.springframework.boot:spring-boot-starter-test')
7286
testCompile('org.apache.httpcomponents:httpclient:4.5.2')
7387

@@ -97,6 +111,20 @@ bootRun {
97111
}
98112
}
99113

114+
115+
task entrypointJar(type: Jar) {
116+
destinationDir = file("src/main/resources/static/")
117+
from(sourceSets.entrypoint.output) {
118+
include '**/*.class'
119+
}
120+
archiveName = 'rest-api.jar'
121+
}
122+
jar.dependsOn entrypointJar
123+
task deleteEntrypointOriginalJar(type: Delete) {
124+
delete entrypointJar.archivePath.toString() + '.original'
125+
}
126+
assemble.dependsOn deleteEntrypointOriginalJar
127+
100128
task extractApi(type: Copy) {
101129
from(zipTree('build/libs/' + extensionName + '-' + version + '.jar'))
102130
into 'build/libs'
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (c) 2018 Doyensec LLC.
3+
*/
4+
5+
package burp;
6+
7+
import java.io.PrintWriter;
8+
import java.lang.reflect.InvocationTargetException;
9+
import java.lang.reflect.Method;
10+
11+
/**
12+
* burp.BurpExtender is the burp-rest-api 2nd-gen entrypoint.
13+
*
14+
* This class search for the burp.LegacyBurpExtender 1st-gen entrypoint in the default classpath in order to execute it
15+
* through reflection. This is needed in order to made Burp able to load more than one extension at a time.
16+
*/
17+
public class BurpExtender implements IBurpExtender {
18+
/**
19+
* This method is invoked when the extension is loaded. It registers an
20+
* instance of the
21+
* <code>IBurpExtenderCallbacks</code> interface, providing methods that may
22+
* be invoked by the extension to perform various actions.
23+
*
24+
* @param callbacks An
25+
* <code>IBurpExtenderCallbacks</code> object.
26+
*/
27+
@Override
28+
public void registerExtenderCallbacks(IBurpExtenderCallbacks callbacks) {
29+
try {
30+
legacyRegisterExtenderCallbacks(callbacks);
31+
} catch (Exception e) {
32+
PrintWriter stderr = new PrintWriter(callbacks.getStderr(), true);
33+
stderr.format("Exception: %s %s %s", e.getClass().getCanonicalName(), e.getCause(), e.getMessage());
34+
}
35+
}
36+
37+
private static void legacyRegisterExtenderCallbacks(IBurpExtenderCallbacks callbacks)
38+
throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException {
39+
40+
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
41+
Class clazz = classLoader.loadClass("burp.LegacyBurpExtender");
42+
Object obj = clazz.newInstance();
43+
Method method = clazz.getMethod("registerExtenderCallbacks", IBurpExtenderCallbacks.class);
44+
method.invoke(obj, callbacks);
45+
}
46+
}

src/main/java/burp/BurpExtender.java renamed to src/main/java/burp/LegacyBurpExtender.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
import java.io.PrintWriter;
77

88
/**
9-
* Copyright VMware, Inc. All rights reserved. -- VMware Confidential
9+
* Copyright VMware, Inc. All rights reserved.
1010
*/
11-
public class BurpExtender implements IBurpExtender {
12-
private static final Logger log = LoggerFactory.getLogger(BurpExtender.class);
13-
private static BurpExtender instance;
11+
public class LegacyBurpExtender implements IBurpExtender {
12+
private static final Logger log = LoggerFactory.getLogger(LegacyBurpExtender.class);
13+
private static LegacyBurpExtender instance;
1414
private IBurpExtenderCallbacks callbacks;
1515
private IExtensionHelpers helpers;
1616

17-
public static BurpExtender getInstance() {
17+
public static LegacyBurpExtender getInstance() {
1818
return instance;
1919
}
2020

0 commit comments

Comments
 (0)