Embed presentation
Downloaded 153 times




























































![IScannerCheck.doPassiveScan()
if (!matches.isEmpty()) {
Collections.sort(matches);
List<int[]> startStop =
new ArrayList<int[]>(1);
for (ScannerMatch match : matches) {
startStop.add(new int[]{
match.getStart(), match.getEnd()
});
Building a Passive Scanner](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-61-2048.jpg)
![IScannerCheck.doPassiveScan()
return new ScanIssue(
baseRequestResponse.getHttpService(),
helpers.analyzeRequest(baseRequestResponse)
.getUrl(),
new IHttpRequestResponse[] {
callbacks.applyMarkers(
baseRequestResponse, null, startStop)},
issueName, issueDetail,
ScanIssueSeverity.MEDIUM,
ScanIssueConfidence.FIRM
Building a Passive Scanner](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-62-2048.jpg)


![Extending from PassiveScan
@Override
protected ScanIssue getScanIssue(
IHttpRequestResponse baseRequestResponse,
List<ScannerMatch> matches, List<int[]> startStop) {
return new ScanIssue(
baseRequestResponse,
helpers,
callbacks,
startStop,
getIssueName(),
getIssueDetail(matches),
ScanIssueSeverity.MEDIUM.getName(),
ScanIssueConfidence.FIRM.getName());
Building a Passive Scanner](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-65-2048.jpg)

![IScannerCheck.doActiveScan()
@Override
public List<IScanIssue> doActiveScan(
IHttpRequestResponse baseRequestResponse,
IScannerInsertionPoint insertionPoint) {
for (MatchRule rule : rules) {
// compile a request containing our
// injection test in the insertion point
byte[] testBytes = rule.getTest();
byte[] checkRequest =
insertionPoint.buildRequest(testBytes);
Building an Active Scanner](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-67-2048.jpg)

![IScannerCheck.doActiveScan()
// get the offsets of the payload
// within the request, for in-UI highlighting
List<int[]> requestHighlights =
new ArrayList<int[]>(1);
requestHighlights.add(
insertionPoint.getPayloadOffsets(testBytes));
Building an Active Scanner](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-69-2048.jpg)





![BurpExtender.getInsertionPoints()
@Override
public List<IScannerInsertionPoint>
getInsertionPoints(
IHttpRequestResponse baseRR) {
byte[] request = baseRR.getRequest();
String requestAsString =
new String(request);
GWTParser parser = new GWTParser();
parser.parse(requestAsString);
Defining Insertion Points](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-75-2048.jpg)
![BurpExtender.getInsertionPoints()
for (int[] offset : insertionPointOffsets) {
IScannerInsertionPoint point =
helpers.makeScannerInsertionPoint(
"GWT",
request,
offset[0] - bodyStart,
offset[1] - bodyStart);
insertionPoints.add(point);
}
return insertionPoints;
Defining Insertion Points](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-76-2048.jpg)


![BurpExtender.createMenuItems()
@Override
public List<JMenuItem> createMenuItems(
IContextMenuInvocation invocation) {
//get selected requests from
//the invocation
IHttpRequestResponse[] ihrrs =
invocation.getSelectedMessages();
Defining Insertion Points](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-79-2048.jpg)

![MenuItemListener
class MenuItemListener implements ActionListener {
private IHttpRequestResponse[] ihrrs;
public MenuItemListener(
IHttpRequestResponse[] ihrrs) {
this.ihrrs = ihrrs;
}
public void actionPerformed(ActionEvent ae) {
sendGWTToIntruder(ihrrs);
}
}
Defining Insertion Points](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-81-2048.jpg)
![BurpExtender.sendGWTToIntruder()
public void sendGWTToIntruder(IHttpRequestResponse[] ihrrs) {
for (IHttpRequestResponse baseRR : ihrrs) {
IHttpService service = baseRR.getHttpService();
// parse the request (not shown)
if (isGWTRequest) {
// Send GWT request to Intruder
callbacks.sendToIntruder(
service.getHost(), service.getPort(),
service.getProtocol().equals("https"),
request, insertionPointOffsets);
Defining Insertion Points](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-82-2048.jpg)






![//see if the request contains a CSRF_TOKEN
byte[] scannerRequest =
messageInfo.getRequest();
String requestString =
helpers.bytesToString(scannerRequest);
Matcher matcher =
TOKEN_PATTERN.matcher(requestString);
if (matcher.find()) {
getFreshToken();
BurpExtender.processHttpMessage()
Modifying a Request](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-89-2048.jpg)
![byte[] request =
helpers.buildHttpRequest(FORM_URL);
// issue the request and get the response
byte[] response = callbacks.makeHttpRequest(
DOMAIN_NAME, 443, true, request);
getFreshToken()
Modifying a Request](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-90-2048.jpg)















This document serves as a comprehensive guide for customizing Burp Suite through the use of extensions, covering installation, development, and management of these extensions. It includes practical examples and methods for building both passive and active scanners, as well as how to manipulate HTTP requests and enhance user interface components. Additionally, it references resources such as the BApp Store and provides links to GitHub projects for further exploration.




























































![IScannerCheck.doPassiveScan()
if (!matches.isEmpty()) {
Collections.sort(matches);
List<int[]> startStop =
new ArrayList<int[]>(1);
for (ScannerMatch match : matches) {
startStop.add(new int[]{
match.getStart(), match.getEnd()
});
Building a Passive Scanner](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-61-2048.jpg)
![IScannerCheck.doPassiveScan()
return new ScanIssue(
baseRequestResponse.getHttpService(),
helpers.analyzeRequest(baseRequestResponse)
.getUrl(),
new IHttpRequestResponse[] {
callbacks.applyMarkers(
baseRequestResponse, null, startStop)},
issueName, issueDetail,
ScanIssueSeverity.MEDIUM,
ScanIssueConfidence.FIRM
Building a Passive Scanner](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-62-2048.jpg)


![Extending from PassiveScan
@Override
protected ScanIssue getScanIssue(
IHttpRequestResponse baseRequestResponse,
List<ScannerMatch> matches, List<int[]> startStop) {
return new ScanIssue(
baseRequestResponse,
helpers,
callbacks,
startStop,
getIssueName(),
getIssueDetail(matches),
ScanIssueSeverity.MEDIUM.getName(),
ScanIssueConfidence.FIRM.getName());
Building a Passive Scanner](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-65-2048.jpg)

![IScannerCheck.doActiveScan()
@Override
public List<IScanIssue> doActiveScan(
IHttpRequestResponse baseRequestResponse,
IScannerInsertionPoint insertionPoint) {
for (MatchRule rule : rules) {
// compile a request containing our
// injection test in the insertion point
byte[] testBytes = rule.getTest();
byte[] checkRequest =
insertionPoint.buildRequest(testBytes);
Building an Active Scanner](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-67-2048.jpg)

![IScannerCheck.doActiveScan()
// get the offsets of the payload
// within the request, for in-UI highlighting
List<int[]> requestHighlights =
new ArrayList<int[]>(1);
requestHighlights.add(
insertionPoint.getPayloadOffsets(testBytes));
Building an Active Scanner](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-69-2048.jpg)





![BurpExtender.getInsertionPoints()
@Override
public List<IScannerInsertionPoint>
getInsertionPoints(
IHttpRequestResponse baseRR) {
byte[] request = baseRR.getRequest();
String requestAsString =
new String(request);
GWTParser parser = new GWTParser();
parser.parse(requestAsString);
Defining Insertion Points](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-75-2048.jpg)
![BurpExtender.getInsertionPoints()
for (int[] offset : insertionPointOffsets) {
IScannerInsertionPoint point =
helpers.makeScannerInsertionPoint(
"GWT",
request,
offset[0] - bodyStart,
offset[1] - bodyStart);
insertionPoints.add(point);
}
return insertionPoints;
Defining Insertion Points](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-76-2048.jpg)


![BurpExtender.createMenuItems()
@Override
public List<JMenuItem> createMenuItems(
IContextMenuInvocation invocation) {
//get selected requests from
//the invocation
IHttpRequestResponse[] ihrrs =
invocation.getSelectedMessages();
Defining Insertion Points](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-79-2048.jpg)

![MenuItemListener
class MenuItemListener implements ActionListener {
private IHttpRequestResponse[] ihrrs;
public MenuItemListener(
IHttpRequestResponse[] ihrrs) {
this.ihrrs = ihrrs;
}
public void actionPerformed(ActionEvent ae) {
sendGWTToIntruder(ihrrs);
}
}
Defining Insertion Points](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-81-2048.jpg)
![BurpExtender.sendGWTToIntruder()
public void sendGWTToIntruder(IHttpRequestResponse[] ihrrs) {
for (IHttpRequestResponse baseRR : ihrrs) {
IHttpService service = baseRR.getHttpService();
// parse the request (not shown)
if (isGWTRequest) {
// Send GWT request to Intruder
callbacks.sendToIntruder(
service.getHost(), service.getPort(),
service.getProtocol().equals("https"),
request, insertionPointOffsets);
Defining Insertion Points](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-82-2048.jpg)






![//see if the request contains a CSRF_TOKEN
byte[] scannerRequest =
messageInfo.getRequest();
String requestString =
helpers.bytesToString(scannerRequest);
Matcher matcher =
TOKEN_PATTERN.matcher(requestString);
if (matcher.find()) {
getFreshToken();
BurpExtender.processHttpMessage()
Modifying a Request](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-89-2048.jpg)
![byte[] request =
helpers.buildHttpRequest(FORM_URL);
// issue the request and get the response
byte[] response = callbacks.makeHttpRequest(
DOMAIN_NAME, 443, true, request);
getFreshToken()
Modifying a Request](https://image.slidesharecdn.com/customizingburpsuite-gettingthemostoutofburpextensions-150924203943-lva1-app6892/75/AppSec-USA-2015-Customizing-Burp-Suite-90-2048.jpg)













