daily pastebin goal
69%
SHARE
TWEET

Untitled

a guest Jun 4th, 2017 136 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # IF YOU WANNA USE A TOKEN TO LOGIN USE THIS ONE: https://pastebin.com/ivZXyxzf
  2.  
  3. import discord,asyncio,aiohttp,websockets,logging,urllib.request,sys,getpass,ctypes,ctypes.wintypes,time,backoff,HackAPI
  4. # backoff - https://gist.github.com/Hornwitser/93aceb86533ed3538b6f
  5. # HackAPI - https://pastebin.com/cm1NiXej
  6.  
  7. def GetIdValue(data,x,splitter=':'):
  8.     'Find the value corresponding by the id, used for organising the server responce which can look something like "1,value,2,value2,etc.."'
  9.     split = data.split(splitter)
  10.     for i in range(len(split)):
  11.         if ((i%2==0) and (split[i]==str(x))):
  12.             return split[i+1]
  13.  
  14. def GetData(lvlid):
  15.     url = 'http://www.boomlings.com/database/getGJLevels21.php'
  16.     data = ('gameVersion=21&binaryVersion=33&gdw=0&type=0&str='+str(lvlid)+'&diff=-&len=-&page=0&total=9999&uncompleted=0&onlyCompleted=0&featured=0&original=0&twoPlayer=0&coins=0&epic=0&secret=Wmfd2893gb7').encode()
  17.     responce = urllib.request.urlopen(url,data).read().decode().split('#')
  18.     return GetIdValue(responce[0],2),GetIdValue(responce[1],GetIdValue(responce[0],6))
  19.  
  20. client = discord.Client()
  21.  
  22. async def keep_running(client, usrn,pswd): # (very slightly modified) - https://gist.github.com/Hornwitser/93aceb86533ed3538b6f
  23.     retry = backoff.ExponentialBackoff()
  24.  
  25.     while True:
  26.         try:
  27.             await client.login(usrn,pswd)
  28.  
  29.         except:
  30.             logging.exception("Discord.py pls login")
  31.             await asyncio.sleep(retry.delay())
  32.  
  33.         else:
  34.             break
  35.  
  36.     while client.is_logged_in:
  37.         if client.is_closed:
  38.             client._closed.clear()
  39.             client.http.recreate()
  40.  
  41.         try:
  42.             await client.connect()
  43.  
  44.         except (discord.HTTPException, aiohttp.ClientError,
  45.                 discord.GatewayNotFound, discord.ConnectionClosed,
  46.                 websockets.InvalidHandshake,
  47.                 websockets.WebSocketProtocolError) as e:
  48.             if isinstance(e, discord.ConnectionClosed) and e.code == 4004:
  49.                 raise # Do not reconnect on authentication failure
  50.             logging.exception("Discord.py pls keep running")
  51.             await asyncio.sleep(retry.delay())
  52.  
  53. @client.event # function called when logged in
  54. async def on_ready():
  55.     print('Login successful!')
  56.     print('Username: {}#{}'.format(client.user.name,client.user.discriminator))
  57.  
  58. @client.event # function called upon message being sent
  59. async def on_message(message):
  60.     pass
  61.  
  62. async def background_task(string): # function used to scan for current level
  63.     await client.wait_until_ready()
  64.    
  65.     print('Running, will update every 60s')
  66.     hProc = HackAPI.Handle()
  67.     hProc.processname = 'GeometryDash.exe'
  68.     hProc.Open()
  69.     base = hProc.GetModuleAddress(0,0)
  70.     print('Base: {}'.format(hex(base)))
  71.  
  72.     attempts = HackAPI.Pointer()
  73.     attempts.SetBase(base+0x303118)
  74.     attempts.SetOffsets([0x164,0x228,0x114,0x21C])
  75.     attempts.SetLevel(4)
  76.  
  77.     levelid = HackAPI.Pointer()
  78.     levelid.SetBase(base+0x303118)
  79.     levelid.SetOffsets([0x294])
  80.     levelid.SetLevel(1)
  81.    
  82.     while (1):
  83.         att_addr,id_addr = hProc.FollowPointer(attempts),hProc.FollowPointer(levelid)
  84.         name,author = GetData(hProc.ReadInt(id_addr))
  85.         string = string\
  86.                  .replace('[id]',str(hProc.ReadInt(id_addr)))\
  87.                  .replace('[att]',str(hProc.ReadInt(att_addr)))\
  88.                  .replace('[jmp]',str(hProc.ReadInt(att_addr+0xC)))\
  89.                  .replace('[rcd]',str(hProc.ReadInt(att_addr+0x28)))\
  90.                  .replace('[prc]',str(hProc.ReadInt(att_addr+0x2C)))\
  91.                  .replace('[name]',name)\
  92.                  .replace('[user]',author)\
  93.                  .replace('\]',']')
  94.         await client.change_presence(game=discord.Game(name=string))
  95.         time.sleep(60)
  96.  
  97. print('GD-Discord loaded, please login (your password is never shared).')
  98.  
  99. idle = 'idlelib.run' in sys.modules # check if user is running in idle
  100.  
  101. if (idle):
  102.     print('IDLE detected, password will not be masked.')
  103.  
  104. username = input('\nEmail: ') # getting email
  105. password = input('Password: ') if idle else getpass.getpass() # getting pass, if not in idle use getpass.getpass()
  106. string = input('''\n[id] = LevelId, [att] = Attempts, [jmp] = jumps
  107. [rcd] = Current Record, [prc] = Practice Record
  108. [name] = Level Name, [user] = Uploader
  109. Enter Playing String: ''')
  110. print('Logging in...')
  111.  
  112. client.loop.create_task(background_task(string)) # creating loop
  113. asyncio.get_event_loop().run_until_complete(keep_running(client,username,password))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top