Advertisement
A_GUES

Python run apk

Jul 12th, 2023
1,192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. from adb_shell.adb_device import AdbDeviceTcp, AdbDeviceUsb
  2. from adb_shell.auth.sign_pythonrsa import PythonRSASigner
  3.  
  4. # Load the private and public keys (you can generate your own keys using the `adb_shell.auth.keygen` function)
  5. with open('path/to/adbkey') as f:
  6.     priv = f.read()
  7. with open('path/to/adbkey.pub') as f:
  8.     pub = f.read()
  9. signer = PythonRSASigner(pub, priv)
  10.  
  11. # Connect to the device
  12. device = AdbDeviceTcp('192.168.0.222', 5555, default_timeout_s=9.)
  13. device.connect(rsa_keys=[signer], auth_timeout_s=0.1)
  14.  
  15. # Install an APK
  16. with open('path/to/app.apk', 'rb') as fp:
  17.     device.install(fp)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement