Skip to content

Instantly share code, notes, and snippets.

@atucom
Created July 27, 2016 20:54
Show Gist options
  • Save atucom/b083d1f3b12606aaf4076a689d200939 to your computer and use it in GitHub Desktop.
Save atucom/b083d1f3b12606aaf4076a689d200939 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
#@atucom
#this script takes in a one-per-line file of IPs and adds it to Burp without any stupid regexes
# This mimics the same thing as hitting the "add" button in the Scope tab
# to load the resultant file, you need to go to the Scope tab, hit the little gear button in the
# top left and click "load settings", choose the jsonout.txt file and rejoice.
import sys
import json
basejson = """
{
"target":{
"scope":{
"exclude":[
{
"enabled":true,
"file":"logout",
"protocol":"any"
},
{
"enabled":true,
"file":"logoff",
"protocol":"any"
},
{
"enabled":true,
"file":"exit",
"protocol":"any"
},
{
"enabled":true,
"file":"signout",
"protocol":"any"
}
],
"include":[
]
}
}
}
"""
ipfile = open(sys.argv[1]) #open file of IPs (one per line)
iplist = ipfile.readlines()
dictjson = json.loads(basejson) #load base json data structure
for ip in iplist:
newip = {"enabled":True, "host":ip.strip(), "protocol":"any"}
dictjson['target']['scope']['include'].append(newip) #appends new IP entry to python dict
jsonout = open("jsonout.txt", "w")
jsonout.write(json.dumps(dictjson))
print("wrote to jsonout.txt")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment