Advertisement
Guest User

Mino260806's Minecraft Crack (Modified by CodeFix1027

a guest
Aug 24th, 2021
2,873
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 8.18 KB | None | 0 0
  1. ####################################################
  2. ###                                              ###
  3. ### THIS FILE WAS MADE BY u/Mino260806 ON REDDIT ###
  4. ### PLEASE CREDIT THE AUTHOR IN CASE YOU WANT TO ###
  5. ###         PUBLISH IT IN ANY WAY                ###
  6. ###                                              ###
  7. ####################################################
  8.  
  9. # Modified by CodeFix1027 for prettier (subjectively) output.
  10. # Original post: https://www.reddit.com/r/PiratedGames/comments/p7c4a6/finally_minecraft_windows_10_crack/
  11.  
  12. import os
  13. import re
  14. import sys
  15. import time
  16. import subprocess
  17.  
  18. NAME = "Minecraft"
  19.  
  20. # ==================== Editable variables ====================
  21.  
  22. interval = 5  # How often do we need to check for the processes?
  23.  
  24. auto_reg = True  # Automatically enable the crack when starting?
  25.                  # NOTE: Crack will not be disabled if closed using the `X` button in the window.
  26.                  #       You should press CTRL+C or auto_close feature for this to work.
  27.  
  28. auto_close = True  # True if you want to auto-close this script.
  29. max_closed = 3  # How many times should the script check for Minecraft process' existence before exiting?
  30.  
  31. # ==================== Editable variables ====================
  32.  
  33. # This will override variables above.
  34. if "--auto_reg" in sys.argv:
  35.     auto_reg = True
  36.  
  37. if "--auto_close" in sys.argv:
  38.     auto_close = True
  39.  
  40.  
  41. # This is used only if auto_reg is True.
  42. class CrackApplicator():
  43.     """
  44.    This class is responsible for applying and reverting the crack.
  45.    """
  46.  
  47.     def __init__(self):
  48.         """
  49.        The initialization method of CrackApplicator() class.
  50.        """
  51.  
  52.         self.temp_dir = os.getenv("TEMP")  # This is where we will put the temporary files.
  53.         self.enable_reg_path = f"{self.temp_dir}\\mc_enable.reg"
  54.         self.disable_reg_path = f"{self.temp_dir}\\mc_disable.reg"
  55.  
  56.         self.enable_reg = rb"""Windows Registry Editor Version 5.00
  57.  
  58. [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ClipSVC\Parameters]
  59. "DisableSubscription"=dword:00000000
  60. "InactivityShutdownDelay"=dword:0000012c
  61. "RefreshRequired"=dword:00000001
  62. "ServiceDll"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,\
  63.  00,74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,\
  64.  43,00,6c,00,69,00,70,00,53,00,56,00,43,00,2e,00,64,00,6c,00,6c,00,61,00,00,\
  65.  00
  66. "ServiceDllUnloadOnStop"=dword:00000001
  67. "ProcessBiosKey"=dword:00000001
  68. """
  69.         self.disable_reg = rb"""Windows Registry Editor Version 5.00
  70.  
  71. [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ClipSVC\Parameters]
  72. "DisableSubscription"=dword:00000000
  73. "InactivityShutdownDelay"=dword:0000012c
  74. "RefreshRequired"=dword:00000001
  75. "ServiceDll"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,\
  76.  00,74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,\
  77.  43,00,6c,00,69,00,70,00,53,00,56,00,43,00,2e,00,64,00,6c,00,6c,00,00,00
  78. "ServiceDllUnloadOnStop"=dword:00000001
  79. "ProcessBiosKey"=dword:00000001
  80. """
  81.  
  82.     def enable(self):
  83.         """
  84.        Enable the crack.
  85.  
  86.        :returns bool: Returns True if successful.
  87.        """
  88.  
  89.         with open(self.enable_reg_path, 'wb') as f:
  90.             f.write(self.enable_reg)  # Create the temporary registry file.
  91.  
  92.         try:
  93.             os.startfile(self.enable_reg_path)  # Start the registry file.
  94.  
  95.         except(FileNotFoundError, OSError):
  96.             return False
  97.  
  98.         else:
  99.             return True
  100.  
  101.     def disable(self):
  102.         """
  103.        Disable the crack.
  104.  
  105.        :returns bool: Returns True if successful.
  106.        """
  107.  
  108.         with open(self.disable_reg_path, 'wb') as f:
  109.             f.write(self.disable_reg)  # Create the temporary reg file.
  110.  
  111.         try:
  112.             os.startfile(self.disable_reg_path)  # Start the reg file.
  113.  
  114.         except(FileNotFoundError, OSError):
  115.             return False
  116.  
  117.         else:
  118.             return True
  119.  
  120.     def cleanup(self):
  121.         """
  122.        Remove the temporary files.
  123.  
  124.        :returns void:
  125.        """
  126.  
  127.         try:
  128.             os.remove(self.enable_reg_path)
  129.  
  130.         except(FileNotFoundError):
  131.             pass
  132.  
  133.         except IOError as e:
  134.             print("[!] Unable to delete `{0}` ({1})".format(self.enable_reg_path, e))
  135.  
  136.         try:
  137.             os.remove(self.disable_reg_path)
  138.  
  139.         except(FileNotFoundError):
  140.             pass
  141.  
  142.         except IOError as e:
  143.             print("[!] Unable to delete `{0}` ({1})".format(self.disable_reg_path, e))
  144.  
  145.  
  146. def shell_check_output(command):
  147.     """
  148.    Run command via subprocess.
  149.  
  150.    :param str command: The command to run.
  151.  
  152.    :returns str: The output of the command.
  153.    """
  154.  
  155.     return subprocess.check_output(command, shell=True).decode("utf-8", "ignore").split('\r\n')
  156.  
  157. def call_disable_reg():
  158.     """
  159.    Call `CrackApplicator().disable()` and `CrackApplicator().cleanup()`.
  160.  
  161.    :returns void:
  162.    """
  163.  
  164.     if auto_reg:
  165.         print("[i] Disabling the crack...")
  166.         if CrackApplicator().disable():
  167.             print("[i] Success!")
  168.  
  169.         else:
  170.             print("[E] Failed to disable the crack.")
  171.  
  172.         input("Allow registry update and press enter to continue...")
  173.         CrackApplicator().cleanup()
  174.  
  175. def main():
  176.     """
  177.    The main function of the script.
  178.  
  179.    :returns int: The error code.
  180.    """
  181.  
  182.     pne_counter = 0  # Used for counting how many times Minecraft isn't seen in the tasks list.
  183.     separator = '=' * 20  # Separator for the outputs.
  184.  
  185.     print()
  186.     print(NAME)
  187.     print()
  188.  
  189.     # Automatically enable the crack (if enabled)
  190.     if auto_reg:
  191.         print("[i] Enabling the crack...")
  192.         if CrackApplicator().enable():
  193.             print("[i] Success! You can now run Minecraft.")
  194.             input("Press enter to continue...")
  195.  
  196.         else:
  197.             print("[E] Failed to apply the crack.")
  198.             if input("Type in `y` to continue; To quit, leave it empty and press enter: ").lower() != 'y':
  199.                 return 1
  200.  
  201.     print()
  202.     if auto_reg:
  203.         print("[i] You can now play Minecraft. Press CTRL+C to stop and disable crack.")
  204.  
  205.     else:
  206.         print("[i] You can now play Minecraft. Press CTRL+C to stop.")
  207.  
  208.     print()
  209.  
  210.     # RuntimeBroker.exe monitor
  211.     try:
  212.         print(separator)
  213.         while True:
  214.             tasks = shell_check_output("tasklist /apps")  # Get process list.
  215.             found = False
  216.  
  217.             for i, task in enumerate(tasks):  # i = index; task = line data
  218.                 if "RuntimeBroker.exe" in task and "MinecraftUWP" in task:
  219.                     pid = re.search(r' (\d+) ', task).group(1)
  220.                     print(f"[i] RuntimeBroker.exe related to MinecraftUWP detected. (PID {pid})")
  221.                     output = shell_check_output(f'taskkill /f /pid {pid}')
  222.                     print(f"[i] {output[0]}")
  223.                     print(separator)
  224.                     found = True  # To be used in after the for loop.
  225.  
  226.             if auto_close and not found:  # Check Minecraft process if RuntimeBroker is not found above.
  227.                 process_exists = False
  228.                 for i, task in enumerate(tasks):
  229.                     if "Minecraft.Windows.exe (App)" in task and "MinecraftUWP" in task:
  230.                         process_exists = True
  231.                         break
  232.  
  233.                 if not process_exists:  # If Minecraft process doesn't exist, increment pne_counter.
  234.                     pne_counter += 1
  235.                     print(f"[i] Minecraft process not found, getting ready to disable crack... ({pne_counter}/{max_closed})")
  236.                     if pne_counter == max_closed:
  237.                         call_disable_reg()
  238.                         return 0  # Exit the program when the counter is equal to maximum retry.
  239.  
  240.                 else:
  241.                     # Reset the counter.
  242.                     pne_counter = 0
  243.  
  244.             time.sleep(interval)  # Wait for <interval> seconds.
  245.  
  246.     except(KeyboardInterrupt):
  247.         print("[i] CTRL+C detected, now quitting.")
  248.  
  249.         # Automatically disable the crack (if enabled)
  250.         call_disable_reg()
  251.         return 0
  252.  
  253. if __name__ == "__main__":
  254.     sys.exit(main())  # Start main() function.
  255.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement