client.py 726 B

1234567891011121314151617181920212223242526272829
  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. # XCB over wifi
  8. #device.ConnectDevice(port_path=None, serial="192.168.43.168:5555")
  9. # XCB over serial port
  10. device.ConnectDevice(port_path=None, serial="/dev/ttyS11,115200")
  11. if sys.argv[1] == 'ls':
  12. root = device.List(sys.argv[2])
  13. for i in root:
  14. print(i[0].decode('utf-8') + ' Perm: ' + str(oct(i[1])) + ' Size: ' + str(i[2]))
  15. if sys.argv[1] == 'download':
  16. root = device.Pull(sys.argv[2], sys.argv[2].replace('/', '_'))
  17. print(root)
  18. if sys.argv[1] == 'upload':
  19. root = device.Push(sys.argv[2], sys.argv[3])
  20. #root = device.Push(sys.argv[2], "/opt/testbin")
  21. print(root)