Files
XSStrike/core/requester.py

34 lines
1.4 KiB
Python
Raw Normal View History

2018-10-27 18:58:52 +05:30
import random
import requests
import time
import warnings
2018-11-14 10:50:22 +05:30
import core.config
from core.config import globalVariables
2018-11-22 13:43:25 +05:30
from core.utils import converter
2018-10-27 18:58:52 +05:30
2018-11-16 21:13:45 +05:30
warnings.filterwarnings('ignore') # Disable SSL related warnings
2018-10-27 18:58:52 +05:30
2018-11-10 17:33:48 +05:30
def requester(url, data, headers, GET, delay, timeout):
if core.config.globalVariables['jsonData']:
2018-11-22 13:43:25 +05:30
data = converter(data)
elif core.config.globalVariables['path']:
url = converter(data, url)
data = []
2018-10-27 18:58:52 +05:30
time.sleep(delay)
user_agents = ['Mozilla/5.0 (X11; Linux i686; rv:60.0) Gecko/20100101 Firefox/60.0',
2018-11-16 21:13:45 +05:30
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36'
'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']
2018-10-28 10:00:32 +05:30
if 'User-Agent' not in headers:
headers['User-Agent'] = random.choice(user_agents)
elif headers['User-Agent'] == '$':
headers['User-Agent'] = random.choice(user_agents)
2018-10-27 18:58:52 +05:30
if GET:
2018-11-16 21:13:45 +05:30
response = requests.get(url, params=data, headers=headers,
timeout=timeout, verify=False, proxies=core.config.proxies)
2018-10-27 18:58:52 +05:30
else:
2018-11-16 21:13:45 +05:30
response = requests.post(url, data=data, headers=headers,
timeout=timeout, verify=False, proxies=core.config.proxies)
2018-10-28 10:00:32 +05:30
return response