handle connection reset (Fixes #162)

This commit is contained in:
Somdev Sangwan
2018-12-17 18:36:25 +05:30
committed by GitHub
parent 70a95525b5
commit 58d8fea906

View File

@@ -1,8 +1,10 @@
import random
import requests
import time
from urllib3.exceptions import ProtocolError
import warnings
from core.colors import bad, info
import core.config
from core.config import globalVariables
from core.utils import converter
@@ -25,10 +27,15 @@ def requester(url, data, headers, GET, delay, timeout):
headers['User-Agent'] = random.choice(user_agents)
elif headers['User-Agent'] == '$':
headers['User-Agent'] = random.choice(user_agents)
if GET:
response = requests.get(url, params=data, headers=headers,
timeout=timeout, verify=False, proxies=core.config.proxies)
else:
response = requests.post(url, data=data, headers=headers,
timeout=timeout, verify=False, proxies=core.config.proxies)
return response
try:
if GET:
response = requests.get(url, params=data, headers=headers,
timeout=timeout, verify=False, proxies=core.config.proxies)
else:
response = requests.post(url, data=data, headers=headers,
timeout=timeout, verify=False, proxies=core.config.proxies)
return response
except ProtocolError:
print ('%s WAF is dropping suspicious requests.')
print ('%s Scanning will continue after 10 minutes.')
time.sleep(600)