Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.87 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. import requests
  4. from uuid import uuid4
  5. from os import urandom
  6. from random import randint
  7. from time import sleep
  8.  
  9.  
  10. APP_ID = str(uuid4())  # Located in /usr/share/remarkable/update.conf
  11. BOOT_ID = str(uuid4())  # Located in /proc/sys/kernel/random/boot_id
  12. SERIAL_ID = 'RM100-123-12345'  # Back of your device
  13.  
  14. URL = 'https://get-updates.cloud.remarkable.engineering/service/update2'
  15. BODY = '<?xml version="1.0" encoding="UTF-8"?>\n<request protocol="3.0" version="1.8.1.1" requestid="{%s}" sessionid="{%s}" updaterversion="0.4.2" installsource="ondemandupdate" ismachine="1">\n    <os version="zg" platform="reMarkable" sp="1.8.1.1_armv7l" arch="armv7l"></os>\n    <app appid="{%s}" version="1.8.1.1" track="Prod" ap="Prod" bootid="{%s}" oem="%s" oemversion="1.1" alephversion="1.8.1.1" machineid="%s" lang="en-US" board="" hardware_class="" delta_okay="false" nextversion="0.0.0" brand="" client="" >\n        <ping active="1"></ping>\n        <updatecheck></updatecheck>\n        <event eventtype="3" eventresult="2" previousversion=""></event>\n    </app>\n</request>\n'
  16.  
  17.  
  18. def probe() -> bool:
  19.     uuid1, uuid2 = str(uuid4()), str(uuid4())
  20.     machineid = urandom(16).hex()
  21.     filledBody = BODY % (uuid1, uuid2, APP_ID, BOOT_ID, SERIAL_ID, machineid)
  22.     response = requests.post(URL, data=filledBody)
  23.     assert(response.ok)
  24.     #print(response.content)
  25.     return machineid, b'<updatecheck status="noupdate"/>' not in response.content, response.content
  26.  
  27.  
  28. def autoprobe(delay=0.5, maxExtra=0.3):
  29.     while 1:
  30.         sleep(delay + (randint(1, int(maxExtra*1000)) / 1000))
  31.  
  32.         mid, success, content = probe()
  33.         if not success:
  34.             print('Failed: %s' % mid)
  35.         else:
  36.             print('SUCCESS!!!')
  37.             print('MACHINE ID: %s' % mid)
  38.             print('RESPONSE: ')
  39.             print('%s' % content)
  40.             exit(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement