-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
pavi
committed
Jul 21, 2024
1 parent
705c01f
commit eb0ed13
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,54 @@ | ||
import secrets | ||
import string | ||
import re | ||
|
||
def generate_random_string(): | ||
length = 1230 | ||
characters = string.ascii_letters + string.digits + '-_' | ||
random_string = ''.join(secrets.choice(characters) for _ in range(length)) | ||
return "!"+random_string | ||
|
||
|
||
|
||
base_cookies = { | ||
'SID': None, | ||
'__Secure-1PSID': None, | ||
'__Secure-3PSID': None, | ||
'HSID': None, | ||
'SSID': None, | ||
'APISID': None, | ||
'SAPISID': None, | ||
'__Secure-1PAPISID': None, | ||
'__Secure-3PAPISID': None, | ||
'1P_JAR': None, | ||
'SEARCH_SAMESITE': None, | ||
'AEC': None, | ||
'_ga': None, | ||
'NID': None, | ||
'__Secure-1PSIDTS': None, | ||
'__Secure-3PSIDTS': None, | ||
'_ga_WC57KJ50ZZ': None, | ||
'SIDCC': None, | ||
'__Secure-1PSIDCC': None, | ||
'__Secure-3PSIDCC': None, | ||
} | ||
|
||
|
||
def get_cookies(text): | ||
cookies = {} | ||
for cookie_name in base_cookies: | ||
pattern = rf' {cookie_name}=([^\s;]+)' | ||
match = re.search(pattern, text) | ||
if match: | ||
cootext = match.group(1) | ||
|
||
cookies[cookie_name] = cootext | ||
else: | ||
if cookie_name == "__Secure-1PSID": | ||
raise Exception("Failed to get cookie from your file, is this valid log file?") | ||
pass | ||
|
||
return cookies | ||
|
||
|
||
|