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 log it
- Assistant
Below is a Python script that uses the
requestslibrary to perform a GET request to the specified URL and retrieve the JavaScript containing thewindow.location.href:import requests import re # Define the URL for the GET request url = 'https://trigonevo.fun/whitelist/?HWID=83123123123123' # Open a session with requests.Session() as session: # Perform the GET request response = session.get(url) # Check if the request succeeded if response.status_code == 200: # Get the HTML content html_content = response.text # Use a regex to find the onclick event with window.location.href pattern = r"window\.location\.href='(https://link-to\.net/\d+/\d+\.\d+/dynamic/\?r=[^']+)'" match = re.search(pattern, html_content) if match: # Extract the link link_to_net_url = match.group(1) print("Link to net URL:", link_to_net_url) else: print("No matching link found.") else: print(f"Failed to retrieve the page, status code: {response.status_code}")Important Notes:
- Dependencies: You will need to install the
requestspackage if it is not already installed. You can do this usingpip install requests. - Regular Expressions: This script uses a regular expression to locate the JavaScript snippet that contains the
window.location.hrefpattern. Adjust the regex if the HTML structure changes. - HTTPS Requests: Make sure you are allowed to request and parse the content on that site. Be aware of policies and potential legal issues.
- Review: As with running any script, ensure you understand and trust the underlying operations, especially when extracting and manipulating data from a web page.
This script will open a session, make a request to the specified URL, search for the
onclickevent in the HTML and extract the embedded link if it matches the expected pattern. - Dependencies: You will need to install the