-
Notifications
You must be signed in to change notification settings - Fork 5
/
burp_requests.py
59 lines (45 loc) · 1.6 KB
/
burp_requests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python
"""
Send requests to burp proxy
The script reads in the input file and does a GET request using the burp proxy information from the config file. The script is designed to make it easy to use burp on a large number of websites. Burp must be running and listening on the port specified in the config file.
Usage
-----
python burp_requests.py /full/path/to/file.txt
Parameters
----------
input : string
Required - Full path to file containing a url on each line.
Output
------
None.
"""
import time
import argparse
import urllib3
import requests
from config import config
from utils.utils import parse_webserver_urls
def run_burp(url):
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
print('Requesting url: {}'.format(url))
tries = 0
while tries < 3:
try:
requests.head(url, proxies=config.BURP_PROXIES, timeout=5, allow_redirects=False, verify=False)
return
except (requests.exceptions.ReadTimeout, requests.exceptions.ProxyError):
tries += 1
print('Timeout received, sleeping for {} seconds and then trying again.'.format(5 * tries))
time.sleep(5 * tries)
print('Tried 3 times, and failed...')
return
def run_burp_on_webservers(url_file):
urls = parse_webserver_urls(url_file)
for url in urls:
run_burp(url)
def parse_args():
parser = argparse.ArgumentParser(prog='burp_requests.py')
parser.add_argument('input', help='File with a URL each line.')
return parser.parse_args()
if __name__ == '__main__':
run_burp_on_webservers(parse_args().input)