client.py 619 B

12345678910111213141516171819202122232425
  1. from adb import adb_commands
  2. from adb import sign_m2crypto
  3. import sys
  4. queue = list()
  5. # Connect to the device
  6. device = adb_commands.AdbCommands()
  7. device.ConnectDevice(port_path=None, serial="192.168.43.168:5555")
  8. if sys.argv[1] == 'ls':
  9. root = device.List(sys.argv[2])
  10. for i in root:
  11. print(i[0].decode('utf-8') + ' Perm: ' + str(oct(i[1])) + ' Size: ' + str(i[2]))
  12. if sys.argv[1] == 'download':
  13. root = device.Pull(sys.argv[2], sys.argv[2].replace('/', '_'))
  14. print(root)
  15. if sys.argv[1] == 'upload':
  16. root = device.Push(sys.argv[2], sys.argv[3])
  17. #root = device.Push(sys.argv[2], "/opt/testbin")
  18. print(root)