Skip to content

Instantly share code, notes, and snippets.

@rgerganov
Last active September 28, 2023 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgerganov/856526a98c6f46c03f494fd89201ac1e to your computer and use it in GitHub Desktop.
Save rgerganov/856526a98c6f46c03f494fd89201ac1e to your computer and use it in GitHub Desktop.
Get precomputed signatures from AirReceiver
#!/usr/bin/env python3
import os
import sys
import time
import subprocess
from datetime import date, timedelta
ADB_PATH = '/tmp/platform-tools/adb'
AUTH_CMD = '/tmp/auth'
IP_ADDR = '192.168.1.213'
if __name__ == '__main__':
curr_date = date(2023, 8, 15)
two_days = timedelta(days=2)
while True:
toybox_date = curr_date.strftime('%m%d1200%Y.00')
date_cmd = "{} shell \"su -c 'toybox date {}'\"".format(ADB_PATH, toybox_date)
print("Running: {}".format(date_cmd))
ret = subprocess.call(date_cmd, shell=True)
if ret != 0:
print("Error setting date through adb")
sys.exit(1)
dir_name = curr_date.strftime('%Y%m%d')
if not os.path.exists(dir_name):
os.mkdir(dir_name)
print(os.path.abspath(dir_name))
auth_cmd = "{} {}:8009".format(AUTH_CMD, IP_ADDR)
# Send AuthChallenge, receive AuthResponse and save the signature
ret = subprocess.call(auth_cmd, shell=True, cwd=os.path.abspath(dir_name))
if ret != 0:
print("Error getting signature")
sys.exit(1)
curr_date += two_days
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment