Created
January 15, 2019 14:57
-
-
Save ajxchapman/e217e5bc31c283fe8e10af1144bdba5d to your computer and use it in GitHub Desktop.
Extract files from Burp Suite "Save Items" save file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change line 14 for this:
if search is not None and not search in path: