MCPcopy
hub / github.com/s0md3v/XSStrike / requester

Function requester

core/requester.py:16–52  ·  view source on GitHub ↗
(url, data, headers, GET, delay, timeout)

Source from the content-addressed store, hash-verified

14
15
16def requester(url, data, headers, GET, delay, timeout):
17 if getVar('jsonData'):
18 data = converter(data)
19 elif getVar('path'):
20 url = converter(data, url)
21 data = []
22 GET, POST = True, False
23 time.sleep(delay)
24 user_agents = ['Mozilla/5.0 (X11; Linux i686; rv:60.0) Gecko/20100101 Firefox/60.0',
25 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36',
26 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 OPR/43.0.2442.991']
27 if 'User-Agent' not in headers:
28 headers['User-Agent'] = random.choice(user_agents)
29 elif headers['User-Agent'] == '$':
30 headers['User-Agent'] = random.choice(user_agents)
31 logger.debug('Requester url: {}'.format(url))
32 logger.debug('Requester GET: {}'.format(GET))
33 logger.debug_json('Requester data:', data)
34 logger.debug_json('Requester headers:', headers)
35 try:
36 if GET:
37 response = requests.get(url, params=data, headers=headers,
38 timeout=timeout, verify=False, proxies=core.config.proxies)
39 elif getVar('jsonData'):
40 response = requests.post(url, json=data, headers=headers,
41 timeout=timeout, verify=False, proxies=core.config.proxies)
42 else:
43 response = requests.post(url, data=data, headers=headers,
44 timeout=timeout, verify=False, proxies=core.config.proxies)
45 return response
46 except ProtocolError:
47 logger.warning('WAF is dropping suspicious requests.')
48 logger.warning('Scanning will continue after 10 minutes.')
49 time.sleep(600)
50 except Exception as e:
51 logger.warning('Unable to connect to the target.')
52 return requests.Response()

Callers 9

checkerFunction · 0.90
wafDetectorFunction · 0.90
recFunction · 0.90
fuzzerFunction · 0.90
retireJsFunction · 0.90
crawlFunction · 0.90
scanFunction · 0.90
singleFuzzFunction · 0.90
bruteforcerFunction · 0.90

Calls 3

getVarFunction · 0.90
converterFunction · 0.90
formatMethod · 0.80

Tested by

no test coverage detected