Support Center

Burp Community

See what our users are saying about Burp Suite:

How do I?

New Post View All

Feature Requests

New Post View All

Burp Extensions

New Post View All

Bug Reports

New Post View All
Documentation

Burp Suite Documentation

Take a look at our Documentation section for full details about every Burp Suite tool, function and configuration option.

Full Documentation Contents Burp Projects
Suite Functions Burp Tools
Options Using Burp Suite
Extensibility

Burp Extender

Burp Extender lets you extend the functionality of Burp Suite in numerous ways.

Extensions can be written in Java, Python or Ruby.

API documentation Writing your first Burp Suite extension
Sample extensions View community discussions about Extensibility
Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

[python] adding a custom header and send JSON in post request.

reconnect Sep 17, 2017 07:28PM UTC

Hello team

I wanted to know how to add custom header and send JSON in post request in jython.

here is my basic code

def sendRequest(self,data):
host="requestb.in"
url=URL("https://requestb.in/q6v4xrq6")
req=self._helpers.buildHttpRequest(url)
encode=self._helpers.urlEncode(data)
body=self._helpers.buildParameter("body", encode, IParameter.PARAM_BODY);
req=self._helpers.addParameter(req,body)
resp=self.callbacks.makeHttpRequest(host,443,1,req)
print self._helpers.bytesToString(resp)


Paul Johnston Sep 18, 2017 02:19PM UTC Support Center agent

There’s a few approaches; the code below is one way:

from java.net import URL
from burp import IBurpExtender

class BurpExtender(IBurpExtender):
def registerExtenderCallbacks(self, callbacks):
self.callbacks = callbacks
self._helpers = callbacks.getHelpers()

headers = [ ‘POST /q6v4xrq6 HTTP/1.1’, ‘Host: requestb.in’, ‘Content-type: application/json’, ] body = ‘{"test": "ok"}’ req = self._helpers.buildHttpMessage(headers, body) resp = self.callbacks.makeHttpRequest(“requestb.in”, 443, True, req) print self._helpers.bytesToString(resp)

Post Your public answer

Your name
Your email address
Answer