Skip to content

Instantly share code, notes, and snippets.

View pajswigger's full-sized avatar

Paul Johnston pajswigger

View GitHub Profile
package burp;
import java.awt.Component
import java.util.*
class MessageEditorTab : IMessageEditorTab {
var messageEditor = BurpExtender.cb.createMessageEditor(null, true)
override fun getMessage(): ByteArray {
return messageEditor.message
@pajswigger
pajswigger / highlight.java
Created January 23, 2018 08:07
Highlight a Burp Tab
JTabbedPane tabbedPane;
ChangeListener changeListener;
// add to constructor
addHierarchyListener(this);
void highlightTab()
{
if(tabbedPane != null)
{
#!/bin/bash
orig=$PWD
file=`basename $1`
mkdir -p "/tmp/$file"
cd "/tmp/$file"
jar -xf "$orig/$1"
find . -name \*.jar | while read JAR; do
jar -u0f "$orig/$1" $JAR
done
# For use with Python Scripter extension
from java.net import URL
if not messageIsRequest:
request_info = helpers.analyzeRequest(messageInfo.getHttpService(), messageInfo.getRequest())
if request_info.getUrl().toString() == 'http://blah/':
response_info = helpers.analyzeResponse(messageInfo.getResponse())
for header in response_info.getHeaders():
if header.startswith('Location: '):
url = URL(header[len('Location: '):])
req = helpers.buildHttpRequest(url)
package burp;
import java.util.Random;
public class BuildUnencodedRequest
{
private Random random = new Random();
private IExtensionHelpers helpers;
BuildUnencodedRequest(IExtensionHelpers helpers)

Code completion for Burp Jython extensions

The IntelliJ Python plugin supports code completion and this can recognize the Burp API. First, make sure your project has the SDK set to Jython:

image

Then, add the Burp API as a library:

image

from burp import IBurpExtender, IHttpListener
import threading, time
class BurpExtender(IBurpExtender, IHttpListener):
count = 0
lock = threading.Lock()
def registerExtenderCallbacks(self, callbacks):
self.callbacks = callbacks
import sys
out = []
in_summary = False
with open(sys.argv[1]) as input:
for line in input:
if line.startswith('<table cellpadding="0" cellspacing="0" class="summary_table">'):
in_summary = True
if in_summary:
line = line.replace('rowspan="4"', 'rowspan="6"')
static JFrame getBurpFrame()
{
for(Frame f : Frame.getFrames())
{
if(f.isVisible() && f.getTitle().startsWith(("Burp Suite")))
{
return (JFrame) f;
}
}
return null;
import sys, pexpect.popen_spawn, signal
if len(sys.argv) != 3:
print('Usage: license-burp [yes/no] [license-file]')
sys.exit(1)
if sys.argv[1] != 'yes':
print('You must accept the license to use Burp')
sys.exit(1)