Write me a py script that uses sessions and sends a get to…
- User
user: Write me a py script that uses sessions and sends a get to https://trigonevo.fun/whitelist/?HWID=83123123123123 and then it gets the onclick of glass-light bg-blue-600 bg-opacity-20 hover-glow cursor-pointer rounded-lg p-4 border-l-4 border-blue-400 shadow-md relative overflow-hidden which looks like this: window.location.href='https://link-to.net/377810/350.58171690934/dynamic/?r=aHR0cHM6Ly90cmlnb25ldm8uZnVuL3doaXRlbGlzdC92ZXJpZnk/dmVyaWZ5PTEmY2hlY2twb2ludD0xJkhXSUQ9ODMxMjMxMjMxMjMxMjM=' and then make it get the link to net link in there and prints it, with headers: pragma: no-cache cache-control: no-cache sec-ch-ua: "Brave";v="129", "Not=A?Brand";v="8", "Chromium";v="129" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "Windows" upgrade-insecure-requests: 1 user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36 accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8 sec-gpc: 1 accept-language: en-US,en;q=0.8 sec-fetch-site: none sec-fetch-mode: navigate sec-fetch-user: ?1 sec-fetch-dest: document accept-encoding: gzip, deflate, br, zstd cookie: trigonevo_session=70lvnnr5mi015j2t6eiikbem4g priority: u=0, i assistant: To accomplish this task, you'll need to create a Python script that performs an HTTP GET request using the requests library, parses the response content to locate a specific JavaScript snippet, extracts a link, and prints it. Below is an example script to achieve this:
First, ensure you have the required requests library. You can install it via pip if you haven't yet:
pip install requestsNow, here is a Python script that does what you described:
import requests import re # Define the URL and headers url = "https://trigonevo.fun/whitelist/?HWID=83123123123123" headers = { "pragma": "no-cache", "cache-control": "no-cache", "sec-ch-ua": '"Brave";v="129", "Not=A?Brand";v="8", "Chromium";v="129"', "sec-ch-ua-mobile": "?0", "sec-ch-ua-platform": '"Windows"', "upgrade-insecure-requests": "1", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36", "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8", "sec-gpc": "1", "accept-language": "en-US,en;q=0.8", "sec-fetch-site": "none", "sec-fetch-mode": "navigate", "sec-fetch-user": "?1", "sec-fetch-dest": "document", "accept-encoding": "gzip, deflate, br, zstd", "cookie": "trigonevo_session=70lvnnr5mi015j2t6eiikbem4g", "priority": "u=0, i" } # Initiate a session session = requests.Session() # Send GET request response = session.get(url, headers=headers) # Ensure successful request if response.status_code == 200: # Regular expression to find the JavaScript snippet onclick_pattern = re.compile(r"window\.location\.href=\'(https://link-to\.net/.*?)\'") # Search through the content match = onclick_pattern.search(response.text) if match: # Extract the link link_to_net_url = match.group(1) print("Extracted link:", link_to_net_url) else: print("No matching onclick pattern found.") else: print(f"Failed to retrieve content: Status code {response.status_code}") - Assistant