Skip to content

Instantly share code, notes, and snippets.

@ngregoire
Last active November 8, 2023 12:21
Show Gist options
  • Save ngregoire/b1ff8314aaa6d1ff3233a358bbfd3402 to your computer and use it in GitHub Desktop.
Save ngregoire/b1ff8314aaa6d1ff3233a358bbfd3402 to your computer and use it in GitHub Desktop.
Skeleton script used to process a file generated using Burp Suite's feature "Save selected items"
#!env python3
import base64
import sys
import xml.etree.ElementTree as ET
def process(id, data):
headers, body = data.split(b'\r\n\r\n', 1)
print('Response #{}: body size is {}'.format(id, len(body)))
# Get argument
burp_file = sys.argv[1]
# Import Burp File
print('# Processing Intruder file "{}"'.format(burp_file))
xml = ET.parse(open(burp_file,'r'))
# Get all 'response' tags
responses = xml.findall('.//item/response')
responses_sz = len(list(responses))
print('# Found {} responses'.format(responses_sz))
print()
# Process responses
id = 0
for response in responses:
# Increment unique ID
id += 1
# Decode and split response
data = base64.b64decode(response.text)
# Adapt this to your needs
process(id, data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment