imthe666st

SMB 1

May 21st, 2016
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.68 KB | None | 0 0
  1. #
  2. # SUPER MARIO BREAKER
  3. # TCPGecko Python Script for Super Mario Maker (WiiU)
  4. #
  5.  
  6. from tcpgecko import TCPGecko
  7. import os
  8.  
  9. ADDRESS = "192.168.0.10"
  10.  
  11.  
  12. def enum(**enums):
  13.     return type('Enum', (), enums)
  14.  
  15. Powerups = enum(
  16.     NONE = 0x00,
  17.     MUSHROOM = 0x01,
  18.     FIRE_FLOWER = 0x02,
  19.     WIERD_MUSHROOM = 0x03,
  20.     UNKNOWN_4 = 0x04,
  21.     SMW_FEATHER = 0x05,
  22.     UNKNOWN_6 = 0x06,
  23.     AMIIBO_MUSHROOM = 0x07,
  24.     CLASSIC_MUSHROOM = 0x08
  25. )
  26.    
  27.  
  28. def cls():
  29.     os.system('cls' if os.name=='nt' else 'clear')
  30.  
  31. def printMenu():
  32.     #cls()
  33.     print("---=== SUPER MARIO BREAKER ===---\r\n")
  34.     print("[1] #MakePSwitchesGreatAgain")
  35.     print("[2] Powerup editor")
  36.     print("\r\n---===========================---")
  37.     return input("[X]> ")
  38.  
  39. def byteToInt(bytes):
  40.     if (len(bytes) > 4):
  41.         raise BaseException("Invalid bytes length")
  42.     a = 0
  43.     for i in range(len(bytes)):
  44.         a += bytes[i] * 0x100**(len(bytes)-i-1)
  45.    
  46.     #print("byteToInt: %x" % a)
  47.     return a
  48.  
  49. def main(tcp):
  50.     #init
  51.     print("Starting..")
  52.     choise = ""
  53.  
  54.     # Main routine
  55.     while choise != "quit":
  56.         choise = printMenu()
  57.         if choise == "1":
  58.             pSwitchEditor(tcp)
  59.         elif choise == "2":
  60.             powerUpEditor(tcp)
  61.  
  62.     # Cleanup
  63.     tcp.s.close()
  64.        
  65. ### Payloads
  66.  
  67. # Payload 1
  68. # #MakePSwitchesGreatAgain
  69. def pSwitchEditor(tcp):
  70.     addr = [
  71.         0x1806CC24,
  72.         0x18081E24,
  73.         0x180FE87C,
  74.         0x1811389C,
  75.         0x1B89B7F4,
  76.  
  77.         0x1B8BAA20,
  78.         0x1B9180A4,
  79.         0x1B9372D0,
  80.         0x1BD78DD0,
  81.         0x1BDA3AD0,
  82.        
  83.         0x1BDC4A50,
  84.         0x1BDC77D0,
  85.         0x1BDC77D8,
  86.         0x1BE70D50
  87.     ]
  88.     for ad in addr:
  89.         tcp.pokemem(ad, 0x00000002)
  90.  
  91.  
  92. # Payload 2
  93. # Powerup editor
  94. def powerUpEditor(tcp):
  95.     addr = [
  96.         0x2B10408C,
  97.         0x2B1040A4,
  98.         0x2B105EFC,
  99.         0x2B105FE4,
  100.         0x2B105FF0,
  101.         0x2B108158,
  102.         0x2B150158,
  103.         0x2B1AAC0C,
  104.         0x2B1AAF0C
  105.     ]
  106.  
  107.  
  108.     print("---===== CURRENT POWERUP =====---")
  109.     print("[0] ................. Small mario")
  110.     print("[1] ................. Super mario")
  111.     print("[2] .................. Fire mario")
  112.     print("[3] ................. Wierd mario")
  113.     print("[4] ................... UNKNOWN 4")
  114.     print("[5] ................. SMW Feather")
  115.     print("[6] ................... UNKNOWN 6")
  116.     print("[7] ............. Amiibo mushroom")
  117.     print("[8] ............ Classic mushroom")
  118.     print("---===========================---")
  119.     print("[9] ................. Manual mode")
  120.     print("---===========================---")
  121.     id = int(input("[I]> "))
  122.     if id > 0 and id <= 8:
  123.         for a in range(0x100):
  124.             b = a * 0x100
  125.             print("Testing offset %x" % b)
  126.             c = tcp.readmem(addr[0] + b, 4)
  127.             d = byteToInt(c)
  128.             f = False
  129.             if (d == id):
  130.                 print("Offset %x has id %i" % (b, id))
  131.                 for i in range(1, len(addr)):
  132.                     e = byteToInt(tcp.readmem(addr[i] + b, 4))
  133.                     if not (d == e or (d == 0 and e == 0xffffffff)):
  134.                         print("Failed at %x: %x" (addr[i]+b, e))
  135.                         f = False
  136.                         break
  137.                     if (i == len(addr) - 1):
  138.                         f = True
  139.                         break
  140.                 if not f:
  141.                     break
  142.                 print("Found offset %x" % b)
  143.                 offset = b
  144.                 break
  145.         else:
  146.             return
  147.     elif id == 9:
  148.         offset = int(input("[O]> "), 16)
  149.  
  150.     if (offset < 0):
  151.         print("Invalid offset, please try again.")
  152.         return
  153.  
  154.     print("---=== CHOOSE YOUR POWERUP ===---")
  155.     print("[0] ................. Small mario")
  156.     print("[1] ................. Super mario")
  157.     print("[2] .................. Fire mario")
  158.     print("[3] ................. Wierd mario")
  159.     print("[4] ................... UNKNOWN 4")
  160.     print("[5] ................. SMW Feather")
  161.     print("[6] ................... UNKNOWN 6")
  162.     print("[7] ............. Amiibo mushroom")
  163.     print("[8] ............ Classic mushroom")
  164.     print("---===========================---")
  165.     id = int(input("[I]> "))
  166.     for ad in addr:
  167.         tcp.pokemem(ad + offset, id)
  168.  
  169.  
  170.  
  171. if __name__ == "__main__":
  172.     main(TCPGecko(ADDRESS))
Advertisement
Add Comment
Please, Sign In to add comment