Skip to content

Instantly share code, notes, and snippets.

@leezu
Created January 18, 2018 09:57
Show Gist options
  • Save leezu/2efb1533d453b70db406b58eb6e3a2af to your computer and use it in GitHub Desktop.
Save leezu/2efb1533d453b70db406b58eb6e3a2af to your computer and use it in GitHub Desktop.
import time
import uuid
import random
import requests
orig_requestid = "f1aa8814-a007-46ad-aede-ae071cacccbe"
orig_sessionid = "2019ed24-e518-4a2c-96d2-af660a7bff97"
orig_appid = "98DA7DF2-4E3E-4744-9DE6-EC931886ABAB"
orig_bootid = "48cfc9fb-e90a-4ace-81aa-2b9eeb928e83"
orig_machineid = "" #censored
orig_oem = "" #censored
req = """<?xml version="1.0" encoding="UTF-8"?>
<request protocol="3.0" version="0.0.4.81" requestid="{{{requestid}}}" sessionid="{{{sessionid}}}" updaterversion="0.4.2" installsource="{installsource}" ismachine="1">
<os version="zg" platform="reMarkable" sp="0.0.4.81_armv7l" arch="armv7l"></os>
<app appid="{{{appid}}}" version="0.0.4.81" track="Prod" ap="Prod" bootid="{{{bootid}}}" oem="{oem}" oemversion="2.1.3" alephversion="0.0.4.81" machineid="{machineid}" lang="en-US" board="" hardware_class="" delta_okay="false" nextversion="" brand="" client="" >
<ping active="1"></ping>
<updatecheck></updatecheck>
<event eventtype="3" eventresult="2" previousversion=""></event>
</app>
</request>"""
url = "https://get-updates.cloud.remarkable.engineering/service/update2"
def get_uuid():
"""Generate a random UUID.
update_engine/utils.cc just reads this from /proc/sys/kernel/random/uuid
"""
return str(uuid.uuid4())
def get_oem():
base = "RM100"
middle = "743"
# middle = str(random.randint(500, 800))
# end = # Censored
end = str(random.randint(50000, 70000))
return "-".join([base,middle,end])
while True:
params = {
"installsource": "scheduler", # or "ondemandupdate"
"requestid": get_uuid(),
"sessionid": get_uuid(),
# "appid": get_uuid(),
# "bootid": get_uuid(),
"machineid": get_uuid().replace("-", ""),
"oem": get_oem(),
# "requestid": orig_requestid,
# "sessionid": orig_sessionid,
"appid": orig_appid,
"bootid": orig_bootid,
# "machineid": orig_machineid
}
resp = requests.post(url, req.format(**params))
if "noupdate" in resp.text:
print(f"No update.. OEM: {params['oem']}")
else:
print("Found params to get update: ")
print(params)
print()
print(resp.text)
break
time.sleep(1)
@leezu
Copy link
Author

leezu commented Aug 27, 2019

It likely doesn't work anymore

@chimpdude
Copy link

For anyone passing through here, I made a few tweaks to leezu's awesome script and created a new gist. Working as of September 2020.
Link: https://gist.github.com/chimpdude/2e4673d8554cf3a29856d0d6c85ed20a

@colin-cooper
Copy link

still works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment