Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import Urls from Burp Suite - Feature #17

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import tld
import json
import tempfile

import csv
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add it before "import tld"


def host(string):
if string and '*' not in string:
Expand Down Expand Up @@ -67,3 +67,13 @@ def extractHeaders(headers):
except IndexError:
pass
return sorted_headers

def url_from_logs(inp_file):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's call it parse_burp

urls = []
with open(inp_file, 'r') as file:
log_csv = csv.DictReader(file)
for line in log_csv:
url = line['Host']+line['Path']
if url not in urls:
urls.append(url)
return urls
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a newline

9 changes: 7 additions & 2 deletions corsy.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import argparse

from core.tests import active_tests
from core.utils import host, prompt, format_result, create_url_list
from core.utils import host, prompt, format_result, create_url_list, url_from_logs
from core.colors import bad, end, red, run, good, grey, green, white, yellow


Expand All @@ -29,6 +29,7 @@
parser.add_argument('-t', help='thread count', dest='threads', type=int, default=2)
parser.add_argument('-d', help='request delay', dest='delay', type=float, default=0)
parser.add_argument('-q', help='don\'t print help tips', dest='quiet', action='store_true')
parser.add_argument('-f', help='import from burp logs', dest='file')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. This argument doesn't accept any additional value, hence add action='store_true' to make it Boolean.
  2. I think -b is a better name for it and the dest value can be burp_file or burp_log.
  3. The help text should be treat input file as Burp Suite logs
  4. Please change the position of this line according to it's length.

parser.add_argument('--headers', help='add headers', dest='header_dict', nargs='?', const=True)
args = parser.parse_args()

Expand All @@ -39,6 +40,7 @@
inp_file = args.inp_file
json_file = args.json_file
header_dict = args.header_dict
log_file = args.file
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change the position of this line according to it's length.


if type(header_dict) == bool:
header_dict = extractHeaders(prompt())
Expand All @@ -54,7 +56,10 @@
'Connection': 'close',
}

urls = create_url_list(target, inp_file)
if inp_file:
urls = create_url_list(target, inp_file)
elif log_file:
urls = url_from_logs(log_file)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create_url_list must be executed even if there's no input file added by the user. Hence, the code here should be:

if log_file:
    urls = url_from_logs(log_file)
else:
    urls = create_url_list(target, inp_file)


def cors(target, header_dict, delay):
url = target
Expand Down