URLAttacks now share a common session.

This commit is contained in:
pablo 2020-11-02 13:08:37 +01:00
parent db04a67c4c
commit 9e7194c8d9

View file

@ -16,7 +16,6 @@ def headers_random_generator():
"DNT": "1",
"TE": "Trailers",
"user-agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0",
"Cookie": "WID=856ee353ead52159|X5/xK|X5/xK; _pxhd=da38a60a3cd50d2467bf4c87f93ea678bd439d1e815cf8b1996e7c2908ac9427:ca2722a1-1d00-11eb-b6e0-0bfd69d30a59",
}
potential_user_agents = [
@ -53,6 +52,8 @@ class UrlAttack:
headers = headers_random_generator()
session = requests.Session()
timeout = 20
def __init__(self, url):
@ -63,7 +64,7 @@ class UrlAttack:
def attack(self):
self.has_been_attacked = True
try:
self.response = requests.get(
self.response = UrlAttack.session.get(
self.url, headers=self.headers, timeout=self.timeout
)