URLAttacks now share a common session.
This commit is contained in:
parent
db04a67c4c
commit
9e7194c8d9
1 changed files with 3 additions and 2 deletions
|
|
@ -16,7 +16,6 @@ def headers_random_generator():
|
||||||
"DNT": "1",
|
"DNT": "1",
|
||||||
"TE": "Trailers",
|
"TE": "Trailers",
|
||||||
"user-agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0",
|
"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 = [
|
potential_user_agents = [
|
||||||
|
|
@ -53,6 +52,8 @@ class UrlAttack:
|
||||||
|
|
||||||
headers = headers_random_generator()
|
headers = headers_random_generator()
|
||||||
|
|
||||||
|
session = requests.Session()
|
||||||
|
|
||||||
timeout = 20
|
timeout = 20
|
||||||
|
|
||||||
def __init__(self, url):
|
def __init__(self, url):
|
||||||
|
|
@ -63,7 +64,7 @@ class UrlAttack:
|
||||||
def attack(self):
|
def attack(self):
|
||||||
self.has_been_attacked = True
|
self.has_been_attacked = True
|
||||||
try:
|
try:
|
||||||
self.response = requests.get(
|
self.response = UrlAttack.session.get(
|
||||||
self.url, headers=self.headers, timeout=self.timeout
|
self.url, headers=self.headers, timeout=self.timeout
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue