Skip to content

Instantly share code, notes, and snippets.

@ajxchapman
Created January 15, 2019 14:57
Show Gist options
  • Save ajxchapman/e217e5bc31c283fe8e10af1144bdba5d to your computer and use it in GitHub Desktop.
Save ajxchapman/e217e5bc31c283fe8e10af1144bdba5d to your computer and use it in GitHub Desktop.
Extract files from Burp Suite "Save Items" save file
import base64
import os
import sys
search = " ".join(sys.argv[2:]) or None
path = None
with open(sys.argv[1]) as f:
for line in f:
if '<path>' in line:
try:
path = os.path.abspath("." + os.path.abspath(line[19:].split(']')[0]))
if search is not None an not search in path:
path = None
except:
path = None
elif '<response base64="true">' in line:
if path is not None:
data = line[37:].split(']')[0]
data = base64.b64decode(data)
data = data[data.index(b'\r\n\r\n') + 4:]
print("Saving {}".format(path))
with open(path, 'wb') as fileout:
fileout.write(data)
@fabionoth
Copy link

Change line 14 for this:
if search is not None and not search in path:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment