@devicefarmer/adbkit 2.11.3 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/dependabot.yml +46 -0
- package/CONTRIBUTING.md +28 -0
- package/README.md +749 -759
- package/bin/adbkit +1 -1
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/package.json +84 -0
- package/dist/src/Callback.d.ts +2 -0
- package/dist/src/Callback.d.ts.map +1 -0
- package/dist/src/Callback.js +3 -0
- package/dist/src/Callback.js.map +1 -0
- package/dist/src/ClientOptions.d.ts +6 -0
- package/dist/src/ClientOptions.d.ts.map +1 -0
- package/dist/src/ClientOptions.js +3 -0
- package/dist/src/ClientOptions.js.map +1 -0
- package/dist/src/CpuStats.d.ts +17 -0
- package/dist/src/CpuStats.d.ts.map +1 -0
- package/dist/src/CpuStats.js +3 -0
- package/dist/src/CpuStats.js.map +1 -0
- package/dist/src/Device.d.ts +5 -0
- package/dist/src/Device.d.ts.map +1 -0
- package/dist/src/Device.js +3 -0
- package/dist/src/Device.js.map +1 -0
- package/dist/src/DeviceWithPath.d.ts +9 -0
- package/dist/src/DeviceWithPath.d.ts.map +1 -0
- package/dist/src/DeviceWithPath.js +3 -0
- package/dist/src/DeviceWithPath.js.map +1 -0
- package/dist/src/ExtendedPublicKey.d.ts +7 -0
- package/dist/src/ExtendedPublicKey.d.ts.map +1 -0
- package/dist/src/ExtendedPublicKey.js +3 -0
- package/dist/src/ExtendedPublicKey.js.map +1 -0
- package/dist/src/Features.d.ts +2 -0
- package/dist/src/Features.d.ts.map +1 -0
- package/dist/src/Features.js +3 -0
- package/dist/src/Features.js.map +1 -0
- package/dist/src/Forward.d.ts +6 -0
- package/dist/src/Forward.d.ts.map +1 -0
- package/dist/src/Forward.js +3 -0
- package/dist/src/Forward.js.map +1 -0
- package/dist/src/FramebufferMeta.d.ts +60 -0
- package/dist/src/FramebufferMeta.d.ts.map +1 -0
- package/dist/src/FramebufferMeta.js +3 -0
- package/dist/src/FramebufferMeta.js.map +1 -0
- package/dist/src/FramebufferStreamWithMeta.d.ts +10 -0
- package/dist/src/FramebufferStreamWithMeta.d.ts.map +1 -0
- package/dist/src/FramebufferStreamWithMeta.js +3 -0
- package/dist/src/FramebufferStreamWithMeta.js.map +1 -0
- package/dist/src/Properties.d.ts +2 -0
- package/dist/src/Properties.d.ts.map +1 -0
- package/dist/src/Properties.js +3 -0
- package/dist/src/Properties.js.map +1 -0
- package/dist/src/Reverse.d.ts +5 -0
- package/dist/src/Reverse.d.ts.map +1 -0
- package/dist/src/Reverse.js +3 -0
- package/dist/src/Reverse.js.map +1 -0
- package/dist/src/SocketOptions.d.ts +6 -0
- package/dist/src/SocketOptions.d.ts.map +1 -0
- package/dist/src/SocketOptions.js +3 -0
- package/dist/src/SocketOptions.js.map +1 -0
- package/dist/src/StartActivityOptions.d.ts +12 -0
- package/dist/src/StartActivityOptions.d.ts.map +1 -0
- package/dist/src/StartActivityOptions.js +3 -0
- package/dist/src/StartActivityOptions.js.map +1 -0
- package/dist/src/StartServiceOptions.d.ts +57 -0
- package/dist/src/StartServiceOptions.d.ts.map +1 -0
- package/dist/src/StartServiceOptions.js +3 -0
- package/dist/src/StartServiceOptions.js.map +1 -0
- package/dist/src/TrackerChangeSet.d.ts +7 -0
- package/dist/src/TrackerChangeSet.d.ts.map +1 -0
- package/dist/src/TrackerChangeSet.js +3 -0
- package/dist/src/TrackerChangeSet.js.map +1 -0
- package/dist/src/WithToString.d.ts +4 -0
- package/dist/src/WithToString.d.ts.map +1 -0
- package/dist/src/WithToString.js +3 -0
- package/dist/src/WithToString.js.map +1 -0
- package/dist/src/adb/DeviceClient.d.ts +376 -0
- package/dist/src/adb/DeviceClient.d.ts.map +1 -0
- package/dist/src/adb/DeviceClient.js +517 -0
- package/dist/src/adb/DeviceClient.js.map +1 -0
- package/dist/src/adb/auth.d.ts +8 -0
- package/dist/src/adb/auth.d.ts.map +1 -0
- package/dist/src/adb/auth.js +87 -0
- package/dist/src/adb/auth.js.map +1 -0
- package/dist/src/adb/client.d.ts +29 -0
- package/dist/src/adb/client.d.ts.map +1 -0
- package/dist/src/adb/client.js +73 -0
- package/dist/src/adb/client.js.map +1 -0
- package/dist/src/adb/command/host/connect.d.ts +6 -0
- package/dist/src/adb/command/host/connect.d.ts.map +1 -0
- package/dist/src/adb/command/host/connect.js +36 -0
- package/dist/src/adb/command/host/connect.js.map +1 -0
- package/dist/src/adb/command/host/devices.d.ts +10 -0
- package/dist/src/adb/command/host/devices.d.ts.map +1 -0
- package/dist/src/adb/command/host/devices.js +40 -0
- package/dist/src/adb/command/host/devices.js.map +1 -0
- package/dist/src/adb/command/host/deviceswithpaths.d.ts +9 -0
- package/dist/src/adb/command/host/deviceswithpaths.d.ts.map +1 -0
- package/dist/src/adb/command/host/deviceswithpaths.js +46 -0
- package/dist/src/adb/command/host/deviceswithpaths.js.map +1 -0
- package/dist/src/adb/command/host/disconnect.d.ts +6 -0
- package/dist/src/adb/command/host/disconnect.d.ts.map +1 -0
- package/dist/src/adb/command/host/disconnect.js +35 -0
- package/dist/src/adb/command/host/disconnect.js.map +1 -0
- package/dist/src/adb/command/host/index.d.ts +9 -0
- package/dist/src/adb/command/host/index.d.ts.map +1 -0
- package/dist/src/adb/command/host/index.js +23 -0
- package/dist/src/adb/command/host/index.js.map +1 -0
- package/dist/src/adb/command/host/kill.d.ts +6 -0
- package/dist/src/adb/command/host/kill.d.ts.map +1 -0
- package/dist/src/adb/command/host/kill.js +24 -0
- package/dist/src/adb/command/host/kill.js.map +1 -0
- package/dist/src/adb/command/host/trackdevices.d.ts +6 -0
- package/dist/src/adb/command/host/trackdevices.d.ts.map +1 -0
- package/dist/src/adb/command/host/trackdevices.js +27 -0
- package/dist/src/adb/command/host/trackdevices.js.map +1 -0
- package/dist/src/adb/command/host/transport.d.ts +6 -0
- package/dist/src/adb/command/host/transport.d.ts.map +1 -0
- package/dist/src/adb/command/host/transport.js +24 -0
- package/dist/src/adb/command/host/transport.js.map +1 -0
- package/dist/src/adb/command/host/version.d.ts +7 -0
- package/dist/src/adb/command/host/version.d.ts.map +1 -0
- package/dist/src/adb/command/host/version.js +29 -0
- package/dist/src/adb/command/host/version.js.map +1 -0
- package/dist/src/adb/command/host-serial/forward.d.ts +6 -0
- package/dist/src/adb/command/host-serial/forward.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/forward.js +33 -0
- package/dist/src/adb/command/host-serial/forward.js.map +1 -0
- package/dist/src/adb/command/host-serial/getdevicepath.d.ts +6 -0
- package/dist/src/adb/command/host-serial/getdevicepath.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/getdevicepath.js +26 -0
- package/dist/src/adb/command/host-serial/getdevicepath.js.map +1 -0
- package/dist/src/adb/command/host-serial/getserialno.d.ts +6 -0
- package/dist/src/adb/command/host-serial/getserialno.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/getserialno.js +24 -0
- package/dist/src/adb/command/host-serial/getserialno.js.map +1 -0
- package/dist/src/adb/command/host-serial/getstate.d.ts +6 -0
- package/dist/src/adb/command/host-serial/getstate.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/getstate.js +24 -0
- package/dist/src/adb/command/host-serial/getstate.js.map +1 -0
- package/dist/src/adb/command/host-serial/index.d.ts +7 -0
- package/dist/src/adb/command/host-serial/index.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/index.js +19 -0
- package/dist/src/adb/command/host-serial/index.js.map +1 -0
- package/dist/src/adb/command/host-serial/listforwards.d.ts +8 -0
- package/dist/src/adb/command/host-serial/listforwards.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/listforwards.js +34 -0
- package/dist/src/adb/command/host-serial/listforwards.js.map +1 -0
- package/dist/src/adb/command/host-serial/waitfordevice.d.ts +6 -0
- package/dist/src/adb/command/host-serial/waitfordevice.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/waitfordevice.js +33 -0
- package/dist/src/adb/command/host-serial/waitfordevice.js.map +1 -0
- package/dist/src/adb/command/host-transport/clear.d.ts +6 -0
- package/dist/src/adb/command/host-transport/clear.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/clear.js +39 -0
- package/dist/src/adb/command/host-transport/clear.js.map +1 -0
- package/dist/src/adb/command/host-transport/framebuffer.d.ts +12 -0
- package/dist/src/adb/command/host-transport/framebuffer.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/framebuffer.js +113 -0
- package/dist/src/adb/command/host-transport/framebuffer.js.map +1 -0
- package/dist/src/adb/command/host-transport/getfeatures.d.ts +8 -0
- package/dist/src/adb/command/host-transport/getfeatures.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/getfeatures.js +35 -0
- package/dist/src/adb/command/host-transport/getfeatures.js.map +1 -0
- package/dist/src/adb/command/host-transport/getpackages.d.ts +7 -0
- package/dist/src/adb/command/host-transport/getpackages.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/getpackages.js +45 -0
- package/dist/src/adb/command/host-transport/getpackages.js.map +1 -0
- package/dist/src/adb/command/host-transport/getproperties.d.ts +8 -0
- package/dist/src/adb/command/host-transport/getproperties.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/getproperties.js +37 -0
- package/dist/src/adb/command/host-transport/getproperties.js.map +1 -0
- package/dist/src/adb/command/host-transport/index.d.ts +28 -0
- package/dist/src/adb/command/host-transport/index.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/index.js +61 -0
- package/dist/src/adb/command/host-transport/index.js.map +1 -0
- package/dist/src/adb/command/host-transport/install.d.ts +6 -0
- package/dist/src/adb/command/host-transport/install.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/install.js +42 -0
- package/dist/src/adb/command/host-transport/install.js.map +1 -0
- package/dist/src/adb/command/host-transport/isinstalled.d.ts +6 -0
- package/dist/src/adb/command/host-transport/isinstalled.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/isinstalled.js +37 -0
- package/dist/src/adb/command/host-transport/isinstalled.js.map +1 -0
- package/dist/src/adb/command/host-transport/listreverses.d.ts +8 -0
- package/dist/src/adb/command/host-transport/listreverses.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/listreverses.js +38 -0
- package/dist/src/adb/command/host-transport/listreverses.js.map +1 -0
- package/dist/src/adb/command/host-transport/local.d.ts +8 -0
- package/dist/src/adb/command/host-transport/local.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/local.js +24 -0
- package/dist/src/adb/command/host-transport/local.js.map +1 -0
- package/dist/src/adb/command/host-transport/log.d.ts +8 -0
- package/dist/src/adb/command/host-transport/log.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/log.js +24 -0
- package/dist/src/adb/command/host-transport/log.js.map +1 -0
- package/dist/src/adb/command/host-transport/logcat.d.ts +9 -0
- package/dist/src/adb/command/host-transport/logcat.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/logcat.js +37 -0
- package/dist/src/adb/command/host-transport/logcat.js.map +1 -0
- package/dist/src/adb/command/host-transport/monkey.d.ts +8 -0
- package/dist/src/adb/command/host-transport/monkey.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/monkey.js +50 -0
- package/dist/src/adb/command/host-transport/monkey.js.map +1 -0
- package/dist/src/adb/command/host-transport/reboot.d.ts +6 -0
- package/dist/src/adb/command/host-transport/reboot.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/reboot.js +24 -0
- package/dist/src/adb/command/host-transport/reboot.js.map +1 -0
- package/dist/src/adb/command/host-transport/remount.d.ts +6 -0
- package/dist/src/adb/command/host-transport/remount.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/remount.js +24 -0
- package/dist/src/adb/command/host-transport/remount.js.map +1 -0
- package/dist/src/adb/command/host-transport/reverse.d.ts +6 -0
- package/dist/src/adb/command/host-transport/reverse.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/reverse.js +33 -0
- package/dist/src/adb/command/host-transport/reverse.js.map +1 -0
- package/dist/src/adb/command/host-transport/root.d.ts +6 -0
- package/dist/src/adb/command/host-transport/root.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/root.js +32 -0
- package/dist/src/adb/command/host-transport/root.js.map +1 -0
- package/dist/src/adb/command/host-transport/screencap.d.ts +8 -0
- package/dist/src/adb/command/host-transport/screencap.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/screencap.js +36 -0
- package/dist/src/adb/command/host-transport/screencap.js.map +1 -0
- package/dist/src/adb/command/host-transport/shell.d.ts +9 -0
- package/dist/src/adb/command/host-transport/shell.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/shell.js +27 -0
- package/dist/src/adb/command/host-transport/shell.js.map +1 -0
- package/dist/src/adb/command/host-transport/startactivity.d.ts +13 -0
- package/dist/src/adb/command/host-transport/startactivity.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/startactivity.js +166 -0
- package/dist/src/adb/command/host-transport/startactivity.js.map +1 -0
- package/dist/src/adb/command/host-transport/startservice.d.ts +7 -0
- package/dist/src/adb/command/host-transport/startservice.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/startservice.js +17 -0
- package/dist/src/adb/command/host-transport/startservice.js.map +1 -0
- package/dist/src/adb/command/host-transport/sync.d.ts +7 -0
- package/dist/src/adb/command/host-transport/sync.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/sync.js +25 -0
- package/dist/src/adb/command/host-transport/sync.js.map +1 -0
- package/dist/src/adb/command/host-transport/tcp.d.ts +8 -0
- package/dist/src/adb/command/host-transport/tcp.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/tcp.js +24 -0
- package/dist/src/adb/command/host-transport/tcp.js.map +1 -0
- package/dist/src/adb/command/host-transport/tcpip.d.ts +6 -0
- package/dist/src/adb/command/host-transport/tcpip.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/tcpip.js +32 -0
- package/dist/src/adb/command/host-transport/tcpip.js.map +1 -0
- package/dist/src/adb/command/host-transport/trackjdwp.d.ts +7 -0
- package/dist/src/adb/command/host-transport/trackjdwp.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/trackjdwp.js +25 -0
- package/dist/src/adb/command/host-transport/trackjdwp.js.map +1 -0
- package/dist/src/adb/command/host-transport/uninstall.d.ts +6 -0
- package/dist/src/adb/command/host-transport/uninstall.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/uninstall.js +40 -0
- package/dist/src/adb/command/host-transport/uninstall.js.map +1 -0
- package/dist/src/adb/command/host-transport/usb.d.ts +6 -0
- package/dist/src/adb/command/host-transport/usb.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/usb.js +32 -0
- package/dist/src/adb/command/host-transport/usb.js.map +1 -0
- package/dist/src/adb/command/host-transport/waitbootcomplete.d.ts +6 -0
- package/dist/src/adb/command/host-transport/waitbootcomplete.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/waitbootcomplete.js +27 -0
- package/dist/src/adb/command/host-transport/waitbootcomplete.js.map +1 -0
- package/dist/src/adb/command.d.ts +17 -0
- package/dist/src/adb/command.d.ts.map +1 -0
- package/dist/src/adb/command.js +43 -0
- package/dist/src/adb/command.js.map +1 -0
- package/dist/src/adb/connection.d.ts +24 -0
- package/dist/src/adb/connection.d.ts.map +1 -0
- package/dist/src/adb/connection.js +115 -0
- package/dist/src/adb/connection.js.map +1 -0
- package/dist/src/adb/dump.d.ts +4 -0
- package/dist/src/adb/dump.d.ts.map +1 -0
- package/dist/src/adb/dump.js +38 -0
- package/dist/src/adb/dump.js.map +1 -0
- package/dist/src/adb/framebuffer/rgbtransform.d.ts +16 -0
- package/dist/src/adb/framebuffer/rgbtransform.d.ts.map +1 -0
- package/dist/src/adb/framebuffer/rgbtransform.js +47 -0
- package/dist/src/adb/framebuffer/rgbtransform.js.map +1 -0
- package/dist/src/adb/jdwptracker.d.ts +41 -0
- package/dist/src/adb/jdwptracker.d.ts.map +1 -0
- package/dist/src/adb/jdwptracker.js +85 -0
- package/dist/src/adb/jdwptracker.js.map +1 -0
- package/dist/src/adb/keycode.d.ts +292 -0
- package/dist/src/adb/keycode.d.ts.map +1 -0
- package/dist/src/adb/keycode.js +298 -0
- package/dist/src/adb/keycode.js.map +1 -0
- package/dist/src/adb/linetransform.d.ts +17 -0
- package/dist/src/adb/linetransform.d.ts.map +1 -0
- package/dist/src/adb/linetransform.js +93 -0
- package/dist/src/adb/linetransform.js.map +1 -0
- package/dist/src/adb/parser.d.ts +37 -0
- package/dist/src/adb/parser.d.ts.map +1 -0
- package/dist/src/adb/parser.js +269 -0
- package/dist/src/adb/parser.js.map +1 -0
- package/dist/src/adb/proc/stat.d.ts +30 -0
- package/dist/src/adb/proc/stat.d.ts.map +1 -0
- package/dist/src/adb/proc/stat.js +131 -0
- package/dist/src/adb/proc/stat.js.map +1 -0
- package/dist/src/adb/protocol.d.ts +17 -0
- package/dist/src/adb/protocol.d.ts.map +1 -0
- package/dist/src/adb/protocol.js +29 -0
- package/dist/src/adb/protocol.js.map +1 -0
- package/dist/src/adb/sync/entry.d.ts +8 -0
- package/dist/src/adb/sync/entry.d.ts.map +1 -0
- package/dist/src/adb/sync/entry.js +16 -0
- package/dist/src/adb/sync/entry.js.map +1 -0
- package/dist/src/adb/sync/pulltransfer.d.ts +10 -0
- package/dist/src/adb/sync/pulltransfer.d.ts.map +1 -0
- package/dist/src/adb/sync/pulltransfer.js +24 -0
- package/dist/src/adb/sync/pulltransfer.js.map +1 -0
- package/dist/src/adb/sync/pushtransfer.d.ts +13 -0
- package/dist/src/adb/sync/pushtransfer.d.ts.map +1 -0
- package/dist/src/adb/sync/pushtransfer.js +30 -0
- package/dist/src/adb/sync/pushtransfer.js.map +1 -0
- package/dist/src/adb/sync/stats.d.ts +23 -0
- package/dist/src/adb/sync/stats.d.ts.map +1 -0
- package/dist/src/adb/sync/stats.js +54 -0
- package/dist/src/adb/sync/stats.js.map +1 -0
- package/dist/src/adb/sync.d.ts +31 -0
- package/dist/src/adb/sync.d.ts.map +1 -0
- package/dist/src/adb/sync.js +322 -0
- package/dist/src/adb/sync.js.map +1 -0
- package/dist/src/adb/tcpusb/packet.d.ts +27 -0
- package/dist/src/adb/tcpusb/packet.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/packet.js +94 -0
- package/dist/src/adb/tcpusb/packet.js.map +1 -0
- package/dist/src/adb/tcpusb/packetreader.d.ts +26 -0
- package/dist/src/adb/tcpusb/packetreader.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/packetreader.js +100 -0
- package/dist/src/adb/tcpusb/packetreader.js.map +1 -0
- package/dist/src/adb/tcpusb/rollingcounter.d.ts +8 -0
- package/dist/src/adb/tcpusb/rollingcounter.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/rollingcounter.js +17 -0
- package/dist/src/adb/tcpusb/rollingcounter.js.map +1 -0
- package/dist/src/adb/tcpusb/server.d.ts +19 -0
- package/dist/src/adb/tcpusb/server.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/server.js +78 -0
- package/dist/src/adb/tcpusb/server.js.map +1 -0
- package/dist/src/adb/tcpusb/service.d.ts +37 -0
- package/dist/src/adb/tcpusb/service.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/service.js +173 -0
- package/dist/src/adb/tcpusb/service.js.map +1 -0
- package/dist/src/adb/tcpusb/servicemap.d.ts +10 -0
- package/dist/src/adb/tcpusb/servicemap.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/servicemap.js +42 -0
- package/dist/src/adb/tcpusb/servicemap.js.map +1 -0
- package/dist/src/adb/tcpusb/socket.d.ts +45 -0
- package/dist/src/adb/tcpusb/socket.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/socket.js +284 -0
- package/dist/src/adb/tcpusb/socket.js.map +1 -0
- package/dist/src/adb/tracker.d.ts +17 -0
- package/dist/src/adb/tracker.d.ts.map +1 -0
- package/dist/src/adb/tracker.js +72 -0
- package/dist/src/adb/tracker.js.map +1 -0
- package/dist/src/adb/util.d.ts +10 -0
- package/dist/src/adb/util.d.ts.map +1 -0
- package/dist/src/adb/util.js +17 -0
- package/dist/src/adb/util.js.map +1 -0
- package/dist/src/adb.d.ts +13 -0
- package/dist/src/adb.d.ts.map +1 -0
- package/dist/src/adb.js +28 -0
- package/dist/src/adb.js.map +1 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +86 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/index.d.ts +19 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +12 -0
- package/dist/src/index.js.map +1 -0
- package/package.json +53 -33
- package/.semaphore/publish.yml +0 -19
- package/.semaphore/semaphore.yml +0 -27
- package/index.js +0 -4
- package/lib/adb/auth.js +0 -78
- package/lib/adb/client.js +0 -576
- package/lib/adb/command/host/connect.js +0 -46
- package/lib/adb/command/host/devices.js +0 -64
- package/lib/adb/command/host/deviceswithpaths.js +0 -70
- package/lib/adb/command/host/disconnect.js +0 -46
- package/lib/adb/command/host/kill.js +0 -36
- package/lib/adb/command/host/trackdevices.js +0 -40
- package/lib/adb/command/host/transport.js +0 -36
- package/lib/adb/command/host/version.js +0 -42
- package/lib/adb/command/host-serial/forward.js +0 -45
- package/lib/adb/command/host-serial/getdevicepath.js +0 -38
- package/lib/adb/command/host-serial/getserialno.js +0 -38
- package/lib/adb/command/host-serial/getstate.js +0 -38
- package/lib/adb/command/host-serial/listforwards.js +0 -56
- package/lib/adb/command/host-serial/waitfordevice.js +0 -45
- package/lib/adb/command/host-transport/clear.js +0 -45
- package/lib/adb/command/host-transport/framebuffer.js +0 -114
- package/lib/adb/command/host-transport/getfeatures.js +0 -51
- package/lib/adb/command/host-transport/getpackages.js +0 -51
- package/lib/adb/command/host-transport/getproperties.js +0 -51
- package/lib/adb/command/host-transport/install.js +0 -48
- package/lib/adb/command/host-transport/isinstalled.js +0 -47
- package/lib/adb/command/host-transport/listreverses.js +0 -55
- package/lib/adb/command/host-transport/local.js +0 -36
- package/lib/adb/command/host-transport/log.js +0 -36
- package/lib/adb/command/host-transport/logcat.js +0 -48
- package/lib/adb/command/host-transport/monkey.js +0 -42
- package/lib/adb/command/host-transport/reboot.js +0 -36
- package/lib/adb/command/host-transport/remount.js +0 -36
- package/lib/adb/command/host-transport/reverse.js +0 -45
- package/lib/adb/command/host-transport/root.js +0 -46
- package/lib/adb/command/host-transport/screencap.js +0 -52
- package/lib/adb/command/host-transport/shell.js +0 -39
- package/lib/adb/command/host-transport/startactivity.js +0 -184
- package/lib/adb/command/host-transport/startservice.js +0 -33
- package/lib/adb/command/host-transport/sync.js +0 -38
- package/lib/adb/command/host-transport/tcp.js +0 -36
- package/lib/adb/command/host-transport/tcpip.js +0 -46
- package/lib/adb/command/host-transport/trackjdwp.js +0 -120
- package/lib/adb/command/host-transport/uninstall.js +0 -44
- package/lib/adb/command/host-transport/usb.js +0 -46
- package/lib/adb/command/host-transport/waitbootcomplete.js +0 -42
- package/lib/adb/command.js +0 -56
- package/lib/adb/connection.js +0 -117
- package/lib/adb/dump.js +0 -15
- package/lib/adb/framebuffer/rgbtransform.js +0 -55
- package/lib/adb/keycode.js +0 -225
- package/lib/adb/linetransform.js +0 -87
- package/lib/adb/parser.js +0 -291
- package/lib/adb/proc/stat.js +0 -137
- package/lib/adb/protocol.js +0 -45
- package/lib/adb/sync/entry.js +0 -23
- package/lib/adb/sync/pulltransfer.js +0 -31
- package/lib/adb/sync/pushtransfer.js +0 -40
- package/lib/adb/sync/stats.js +0 -54
- package/lib/adb/sync.js +0 -343
- package/lib/adb/tcpusb/packet.js +0 -112
- package/lib/adb/tcpusb/packetreader.js +0 -121
- package/lib/adb/tcpusb/rollingcounter.js +0 -21
- package/lib/adb/tcpusb/server.js +0 -79
- package/lib/adb/tcpusb/service.js +0 -203
- package/lib/adb/tcpusb/servicemap.js +0 -48
- package/lib/adb/tcpusb/socket.js +0 -312
- package/lib/adb/tracker.js +0 -89
- package/lib/adb/util.js +0 -13
- package/lib/adb.js +0 -29
- package/lib/cli.js +0 -66
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
var EventEmitter, Packet, Parser, Promise, Protocol, Service, debug,
|
|
2
|
-
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
3
|
-
hasProp = {}.hasOwnProperty;
|
|
4
|
-
|
|
5
|
-
EventEmitter = require('events').EventEmitter;
|
|
6
|
-
|
|
7
|
-
Promise = require('bluebird');
|
|
8
|
-
|
|
9
|
-
debug = require('debug')('adb:tcpusb:service');
|
|
10
|
-
|
|
11
|
-
Parser = require('../parser');
|
|
12
|
-
|
|
13
|
-
Protocol = require('../protocol');
|
|
14
|
-
|
|
15
|
-
Packet = require('./packet');
|
|
16
|
-
|
|
17
|
-
Service = (function(superClass) {
|
|
18
|
-
extend(Service, superClass);
|
|
19
|
-
|
|
20
|
-
function Service(client, serial, localId1, remoteId, socket) {
|
|
21
|
-
this.client = client;
|
|
22
|
-
this.serial = serial;
|
|
23
|
-
this.localId = localId1;
|
|
24
|
-
this.remoteId = remoteId;
|
|
25
|
-
this.socket = socket;
|
|
26
|
-
Service.__super__.constructor.call(this);
|
|
27
|
-
this.opened = false;
|
|
28
|
-
this.ended = false;
|
|
29
|
-
this.transport = null;
|
|
30
|
-
this.needAck = false;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
Service.prototype.end = function() {
|
|
34
|
-
var err, localId;
|
|
35
|
-
if (this.transport) {
|
|
36
|
-
this.transport.end();
|
|
37
|
-
}
|
|
38
|
-
if (this.ended) {
|
|
39
|
-
return this;
|
|
40
|
-
}
|
|
41
|
-
debug('O:A_CLSE');
|
|
42
|
-
localId = this.opened ? this.localId : 0;
|
|
43
|
-
try {
|
|
44
|
-
this.socket.write(Packet.assemble(Packet.A_CLSE, localId, this.remoteId, null));
|
|
45
|
-
} catch (_error) {
|
|
46
|
-
err = _error;
|
|
47
|
-
}
|
|
48
|
-
this.transport = null;
|
|
49
|
-
this.ended = true;
|
|
50
|
-
this.emit('end');
|
|
51
|
-
return this;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
Service.prototype.handle = function(packet) {
|
|
55
|
-
return Promise["try"]((function(_this) {
|
|
56
|
-
return function() {
|
|
57
|
-
switch (packet.command) {
|
|
58
|
-
case Packet.A_OPEN:
|
|
59
|
-
return _this._handleOpenPacket(packet);
|
|
60
|
-
case Packet.A_OKAY:
|
|
61
|
-
return _this._handleOkayPacket(packet);
|
|
62
|
-
case Packet.A_WRTE:
|
|
63
|
-
return _this._handleWritePacket(packet);
|
|
64
|
-
case Packet.A_CLSE:
|
|
65
|
-
return _this._handleClosePacket(packet);
|
|
66
|
-
default:
|
|
67
|
-
throw new Error("Unexpected packet " + packet.command);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
})(this))["catch"]((function(_this) {
|
|
71
|
-
return function(err) {
|
|
72
|
-
_this.emit('error', err);
|
|
73
|
-
return _this.end();
|
|
74
|
-
};
|
|
75
|
-
})(this));
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
Service.prototype._handleOpenPacket = function(packet) {
|
|
79
|
-
debug('I:A_OPEN', packet);
|
|
80
|
-
return this.client.transport(this.serial).then((function(_this) {
|
|
81
|
-
return function(transport) {
|
|
82
|
-
_this.transport = transport;
|
|
83
|
-
if (_this.ended) {
|
|
84
|
-
throw new LateTransportError();
|
|
85
|
-
}
|
|
86
|
-
_this.transport.write(Protocol.encodeData(packet.data.slice(0, -1)));
|
|
87
|
-
return _this.transport.parser.readAscii(4).then(function(reply) {
|
|
88
|
-
switch (reply) {
|
|
89
|
-
case Protocol.OKAY:
|
|
90
|
-
debug('O:A_OKAY');
|
|
91
|
-
_this.socket.write(Packet.assemble(Packet.A_OKAY, _this.localId, _this.remoteId, null));
|
|
92
|
-
return _this.opened = true;
|
|
93
|
-
case Protocol.FAIL:
|
|
94
|
-
return _this.transport.parser.readError();
|
|
95
|
-
default:
|
|
96
|
-
return _this.transport.parser.unexpected(reply, 'OKAY or FAIL');
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
})(this)).then((function(_this) {
|
|
101
|
-
return function() {
|
|
102
|
-
return new Promise(function(resolve, reject) {
|
|
103
|
-
_this.transport.socket.on('readable', function() {
|
|
104
|
-
return _this._tryPush();
|
|
105
|
-
}).on('end', resolve).on('error', reject);
|
|
106
|
-
return _this._tryPush();
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
})(this))["finally"]((function(_this) {
|
|
110
|
-
return function() {
|
|
111
|
-
return _this.end();
|
|
112
|
-
};
|
|
113
|
-
})(this));
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
Service.prototype._handleOkayPacket = function(packet) {
|
|
117
|
-
debug('I:A_OKAY', packet);
|
|
118
|
-
if (this.ended) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
if (!this.transport) {
|
|
122
|
-
throw new Service.PrematurePacketError(packet);
|
|
123
|
-
}
|
|
124
|
-
this.needAck = false;
|
|
125
|
-
return this._tryPush();
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
Service.prototype._handleWritePacket = function(packet) {
|
|
129
|
-
debug('I:A_WRTE', packet);
|
|
130
|
-
if (this.ended) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
if (!this.transport) {
|
|
134
|
-
throw new Service.PrematurePacketError(packet);
|
|
135
|
-
}
|
|
136
|
-
if (packet.data) {
|
|
137
|
-
this.transport.write(packet.data);
|
|
138
|
-
}
|
|
139
|
-
debug('O:A_OKAY');
|
|
140
|
-
return this.socket.write(Packet.assemble(Packet.A_OKAY, this.localId, this.remoteId, null));
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
Service.prototype._handleClosePacket = function(packet) {
|
|
144
|
-
debug('I:A_CLSE', packet);
|
|
145
|
-
if (this.ended) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
if (!this.transport) {
|
|
149
|
-
throw new Service.PrematurePacketError(packet);
|
|
150
|
-
}
|
|
151
|
-
return this.end();
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
Service.prototype._tryPush = function() {
|
|
155
|
-
var chunk;
|
|
156
|
-
if (this.needAck || this.ended) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
if (chunk = this._readChunk(this.transport.socket)) {
|
|
160
|
-
debug('O:A_WRTE');
|
|
161
|
-
this.socket.write(Packet.assemble(Packet.A_WRTE, this.localId, this.remoteId, chunk));
|
|
162
|
-
return this.needAck = true;
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
Service.prototype._readChunk = function(stream) {
|
|
167
|
-
return stream.read(this.socket.maxPayload) || stream.read();
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
return Service;
|
|
171
|
-
|
|
172
|
-
})(EventEmitter);
|
|
173
|
-
|
|
174
|
-
Service.PrematurePacketError = (function(superClass) {
|
|
175
|
-
extend(PrematurePacketError, superClass);
|
|
176
|
-
|
|
177
|
-
function PrematurePacketError(packet1) {
|
|
178
|
-
this.packet = packet1;
|
|
179
|
-
Error.call(this);
|
|
180
|
-
this.name = 'PrematurePacketError';
|
|
181
|
-
this.message = "Premature packet";
|
|
182
|
-
Error.captureStackTrace(this, Service.PrematurePacketError);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return PrematurePacketError;
|
|
186
|
-
|
|
187
|
-
})(Error);
|
|
188
|
-
|
|
189
|
-
Service.LateTransportError = (function(superClass) {
|
|
190
|
-
extend(LateTransportError, superClass);
|
|
191
|
-
|
|
192
|
-
function LateTransportError() {
|
|
193
|
-
Error.call(this);
|
|
194
|
-
this.name = 'LateTransportError';
|
|
195
|
-
this.message = "Late transport";
|
|
196
|
-
Error.captureStackTrace(this, Service.LateTransportError);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return LateTransportError;
|
|
200
|
-
|
|
201
|
-
})(Error);
|
|
202
|
-
|
|
203
|
-
module.exports = Service;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
var ServiceMap;
|
|
2
|
-
|
|
3
|
-
ServiceMap = (function() {
|
|
4
|
-
function ServiceMap() {
|
|
5
|
-
this.remotes = Object.create(null);
|
|
6
|
-
this.count = 0;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
ServiceMap.prototype.end = function() {
|
|
10
|
-
var ref, remote, remoteId;
|
|
11
|
-
ref = this.remotes;
|
|
12
|
-
for (remoteId in ref) {
|
|
13
|
-
remote = ref[remoteId];
|
|
14
|
-
remote.end();
|
|
15
|
-
}
|
|
16
|
-
this.remotes = Object.create(null);
|
|
17
|
-
this.count = 0;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
ServiceMap.prototype.insert = function(remoteId, socket) {
|
|
21
|
-
if (this.remotes[remoteId]) {
|
|
22
|
-
throw new Error("Remote ID " + remoteId + " is already being used");
|
|
23
|
-
} else {
|
|
24
|
-
this.count += 1;
|
|
25
|
-
return this.remotes[remoteId] = socket;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
ServiceMap.prototype.get = function(remoteId) {
|
|
30
|
-
return this.remotes[remoteId] || null;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
ServiceMap.prototype.remove = function(remoteId) {
|
|
34
|
-
var remote;
|
|
35
|
-
if (remote = this.remotes[remoteId]) {
|
|
36
|
-
delete this.remotes[remoteId];
|
|
37
|
-
this.count -= 1;
|
|
38
|
-
return remote;
|
|
39
|
-
} else {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
return ServiceMap;
|
|
45
|
-
|
|
46
|
-
})();
|
|
47
|
-
|
|
48
|
-
module.exports = ServiceMap;
|
package/lib/adb/tcpusb/socket.js
DELETED
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
var Auth, EventEmitter, Packet, PacketReader, Parser, Promise, Protocol, RollingCounter, Service, ServiceMap, Socket, crypto, debug,
|
|
2
|
-
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
3
|
-
hasProp = {}.hasOwnProperty;
|
|
4
|
-
|
|
5
|
-
crypto = require('crypto');
|
|
6
|
-
|
|
7
|
-
EventEmitter = require('events').EventEmitter;
|
|
8
|
-
|
|
9
|
-
Promise = require('bluebird');
|
|
10
|
-
|
|
11
|
-
debug = require('debug')('adb:tcpusb:socket');
|
|
12
|
-
|
|
13
|
-
Parser = require('../parser');
|
|
14
|
-
|
|
15
|
-
Protocol = require('../protocol');
|
|
16
|
-
|
|
17
|
-
Auth = require('../auth');
|
|
18
|
-
|
|
19
|
-
Packet = require('./packet');
|
|
20
|
-
|
|
21
|
-
PacketReader = require('./packetreader');
|
|
22
|
-
|
|
23
|
-
Service = require('./service');
|
|
24
|
-
|
|
25
|
-
ServiceMap = require('./servicemap');
|
|
26
|
-
|
|
27
|
-
RollingCounter = require('./rollingcounter');
|
|
28
|
-
|
|
29
|
-
Socket = (function(superClass) {
|
|
30
|
-
var AUTH_RSAPUBLICKEY, AUTH_SIGNATURE, AUTH_TOKEN, TOKEN_LENGTH, UINT16_MAX, UINT32_MAX;
|
|
31
|
-
|
|
32
|
-
extend(Socket, superClass);
|
|
33
|
-
|
|
34
|
-
UINT32_MAX = 0xFFFFFFFF;
|
|
35
|
-
|
|
36
|
-
UINT16_MAX = 0xFFFF;
|
|
37
|
-
|
|
38
|
-
AUTH_TOKEN = 1;
|
|
39
|
-
|
|
40
|
-
AUTH_SIGNATURE = 2;
|
|
41
|
-
|
|
42
|
-
AUTH_RSAPUBLICKEY = 3;
|
|
43
|
-
|
|
44
|
-
TOKEN_LENGTH = 20;
|
|
45
|
-
|
|
46
|
-
function Socket(client, serial, socket, options) {
|
|
47
|
-
var base;
|
|
48
|
-
this.client = client;
|
|
49
|
-
this.serial = serial;
|
|
50
|
-
this.socket = socket;
|
|
51
|
-
this.options = options != null ? options : {};
|
|
52
|
-
(base = this.options).auth || (base.auth = Promise.resolve(true));
|
|
53
|
-
this.ended = false;
|
|
54
|
-
this.socket.setNoDelay(true);
|
|
55
|
-
this.reader = new PacketReader(this.socket).on('packet', this._handle.bind(this)).on('error', (function(_this) {
|
|
56
|
-
return function(err) {
|
|
57
|
-
debug("PacketReader error: " + err.message);
|
|
58
|
-
return _this.end();
|
|
59
|
-
};
|
|
60
|
-
})(this)).on('end', this.end.bind(this));
|
|
61
|
-
this.version = 1;
|
|
62
|
-
this.maxPayload = 4096;
|
|
63
|
-
this.authorized = false;
|
|
64
|
-
this.syncToken = new RollingCounter(UINT32_MAX);
|
|
65
|
-
this.remoteId = new RollingCounter(UINT32_MAX);
|
|
66
|
-
this.services = new ServiceMap;
|
|
67
|
-
this.remoteAddress = this.socket.remoteAddress;
|
|
68
|
-
this.token = null;
|
|
69
|
-
this.signature = null;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
Socket.prototype.end = function() {
|
|
73
|
-
if (this.ended) {
|
|
74
|
-
return this;
|
|
75
|
-
}
|
|
76
|
-
this.services.end();
|
|
77
|
-
this.socket.end();
|
|
78
|
-
this.ended = true;
|
|
79
|
-
this.emit('end');
|
|
80
|
-
return this;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
Socket.prototype._error = function(err) {
|
|
84
|
-
this.emit('error', err);
|
|
85
|
-
return this.end();
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
Socket.prototype._handle = function(packet) {
|
|
89
|
-
if (this.ended) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
this.emit('userActivity', packet);
|
|
93
|
-
return Promise["try"]((function(_this) {
|
|
94
|
-
return function() {
|
|
95
|
-
switch (packet.command) {
|
|
96
|
-
case Packet.A_SYNC:
|
|
97
|
-
return _this._handleSyncPacket(packet);
|
|
98
|
-
case Packet.A_CNXN:
|
|
99
|
-
return _this._handleConnectionPacket(packet);
|
|
100
|
-
case Packet.A_OPEN:
|
|
101
|
-
return _this._handleOpenPacket(packet);
|
|
102
|
-
case Packet.A_OKAY:
|
|
103
|
-
case Packet.A_WRTE:
|
|
104
|
-
case Packet.A_CLSE:
|
|
105
|
-
return _this._forwardServicePacket(packet);
|
|
106
|
-
case Packet.A_AUTH:
|
|
107
|
-
return _this._handleAuthPacket(packet);
|
|
108
|
-
default:
|
|
109
|
-
throw new Error("Unknown command " + packet.command);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
})(this))["catch"](Socket.AuthError, (function(_this) {
|
|
113
|
-
return function() {
|
|
114
|
-
return _this.end();
|
|
115
|
-
};
|
|
116
|
-
})(this))["catch"](Socket.UnauthorizedError, (function(_this) {
|
|
117
|
-
return function() {
|
|
118
|
-
return _this.end();
|
|
119
|
-
};
|
|
120
|
-
})(this))["catch"]((function(_this) {
|
|
121
|
-
return function(err) {
|
|
122
|
-
return _this._error(err);
|
|
123
|
-
};
|
|
124
|
-
})(this));
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
Socket.prototype._handleSyncPacket = function(packet) {
|
|
128
|
-
debug('I:A_SYNC');
|
|
129
|
-
debug('O:A_SYNC');
|
|
130
|
-
return this.write(Packet.assemble(Packet.A_SYNC, 1, this.syncToken.next(), null));
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
Socket.prototype._handleConnectionPacket = function(packet) {
|
|
134
|
-
var version;
|
|
135
|
-
debug('I:A_CNXN', packet);
|
|
136
|
-
version = Packet.swap32(packet.arg0);
|
|
137
|
-
this.maxPayload = Math.min(UINT16_MAX, packet.arg1);
|
|
138
|
-
return this._createToken().then((function(_this) {
|
|
139
|
-
return function(token) {
|
|
140
|
-
_this.token = token;
|
|
141
|
-
debug("Created challenge '" + (_this.token.toString('base64')) + "'");
|
|
142
|
-
debug('O:A_AUTH');
|
|
143
|
-
return _this.write(Packet.assemble(Packet.A_AUTH, AUTH_TOKEN, 0, _this.token));
|
|
144
|
-
};
|
|
145
|
-
})(this));
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
Socket.prototype._handleAuthPacket = function(packet) {
|
|
149
|
-
debug('I:A_AUTH', packet);
|
|
150
|
-
switch (packet.arg0) {
|
|
151
|
-
case AUTH_SIGNATURE:
|
|
152
|
-
debug("Received signature '" + (packet.data.toString('base64')) + "'");
|
|
153
|
-
if (!this.signature) {
|
|
154
|
-
this.signature = packet.data;
|
|
155
|
-
}
|
|
156
|
-
debug('O:A_AUTH');
|
|
157
|
-
return this.write(Packet.assemble(Packet.A_AUTH, AUTH_TOKEN, 0, this.token));
|
|
158
|
-
case AUTH_RSAPUBLICKEY:
|
|
159
|
-
if (!this.signature) {
|
|
160
|
-
throw new Socket.AuthError("Public key sent before signature");
|
|
161
|
-
}
|
|
162
|
-
if (!(packet.data && packet.data.length >= 2)) {
|
|
163
|
-
throw new Socket.AuthError("Empty RSA public key");
|
|
164
|
-
}
|
|
165
|
-
debug("Received RSA public key '" + (packet.data.toString('base64')) + "'");
|
|
166
|
-
return Auth.parsePublicKey(this._skipNull(packet.data)).then((function(_this) {
|
|
167
|
-
return function(key) {
|
|
168
|
-
var digest, sig;
|
|
169
|
-
digest = _this.token.toString('binary');
|
|
170
|
-
sig = _this.signature.toString('binary');
|
|
171
|
-
if (!key.verify(digest, sig)) {
|
|
172
|
-
debug("Signature mismatch");
|
|
173
|
-
throw new Socket.AuthError("Signature mismatch");
|
|
174
|
-
}
|
|
175
|
-
debug("Signature verified");
|
|
176
|
-
return key;
|
|
177
|
-
};
|
|
178
|
-
})(this)).then((function(_this) {
|
|
179
|
-
return function(key) {
|
|
180
|
-
return _this.options.auth(key)["catch"](function(err) {
|
|
181
|
-
debug("Connection rejected by user-defined auth handler");
|
|
182
|
-
throw new Socket.AuthError("Rejected by user-defined handler");
|
|
183
|
-
});
|
|
184
|
-
};
|
|
185
|
-
})(this)).then((function(_this) {
|
|
186
|
-
return function() {
|
|
187
|
-
return _this._deviceId();
|
|
188
|
-
};
|
|
189
|
-
})(this)).then((function(_this) {
|
|
190
|
-
return function(id) {
|
|
191
|
-
_this.authorized = true;
|
|
192
|
-
debug('O:A_CNXN');
|
|
193
|
-
return _this.write(Packet.assemble(Packet.A_CNXN, Packet.swap32(_this.version), _this.maxPayload, id));
|
|
194
|
-
};
|
|
195
|
-
})(this));
|
|
196
|
-
default:
|
|
197
|
-
throw new Error("Unknown authentication method " + packet.arg0);
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
Socket.prototype._handleOpenPacket = function(packet) {
|
|
202
|
-
var localId, name, remoteId, service;
|
|
203
|
-
if (!this.authorized) {
|
|
204
|
-
throw new Socket.UnauthorizedError();
|
|
205
|
-
}
|
|
206
|
-
remoteId = packet.arg0;
|
|
207
|
-
localId = this.remoteId.next();
|
|
208
|
-
if (!(packet.data && packet.data.length >= 2)) {
|
|
209
|
-
throw new Error("Empty service name");
|
|
210
|
-
}
|
|
211
|
-
name = this._skipNull(packet.data);
|
|
212
|
-
debug("Calling " + name);
|
|
213
|
-
service = new Service(this.client, this.serial, localId, remoteId, this);
|
|
214
|
-
return new Promise((function(_this) {
|
|
215
|
-
return function(resolve, reject) {
|
|
216
|
-
service.on('error', reject);
|
|
217
|
-
service.on('end', resolve);
|
|
218
|
-
_this.services.insert(localId, service);
|
|
219
|
-
debug("Handling " + _this.services.count + " services simultaneously");
|
|
220
|
-
return service.handle(packet);
|
|
221
|
-
};
|
|
222
|
-
})(this))["catch"](function(err) {
|
|
223
|
-
return true;
|
|
224
|
-
})["finally"]((function(_this) {
|
|
225
|
-
return function() {
|
|
226
|
-
_this.services.remove(localId);
|
|
227
|
-
debug("Handling " + _this.services.count + " services simultaneously");
|
|
228
|
-
return service.end();
|
|
229
|
-
};
|
|
230
|
-
})(this));
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
Socket.prototype._forwardServicePacket = function(packet) {
|
|
234
|
-
var localId, remoteId, service;
|
|
235
|
-
if (!this.authorized) {
|
|
236
|
-
throw new Socket.UnauthorizedError();
|
|
237
|
-
}
|
|
238
|
-
remoteId = packet.arg0;
|
|
239
|
-
localId = packet.arg1;
|
|
240
|
-
if (service = this.services.get(localId)) {
|
|
241
|
-
return service.handle(packet);
|
|
242
|
-
} else {
|
|
243
|
-
return debug("Received a packet to a service that may have been closed already");
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
Socket.prototype.write = function(chunk) {
|
|
248
|
-
if (this.ended) {
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
return this.socket.write(chunk);
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
Socket.prototype._createToken = function() {
|
|
255
|
-
return Promise.promisify(crypto.randomBytes)(TOKEN_LENGTH);
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
Socket.prototype._skipNull = function(data) {
|
|
259
|
-
return data.slice(0, -1);
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
Socket.prototype._deviceId = function() {
|
|
263
|
-
debug("Loading device properties to form a standard device ID");
|
|
264
|
-
return this.client.getProperties(this.serial).then(function(properties) {
|
|
265
|
-
var id, prop;
|
|
266
|
-
id = ((function() {
|
|
267
|
-
var i, len, ref, results;
|
|
268
|
-
ref = ['ro.product.name', 'ro.product.model', 'ro.product.device'];
|
|
269
|
-
results = [];
|
|
270
|
-
for (i = 0, len = ref.length; i < len; i++) {
|
|
271
|
-
prop = ref[i];
|
|
272
|
-
results.push(prop + "=" + properties[prop] + ";");
|
|
273
|
-
}
|
|
274
|
-
return results;
|
|
275
|
-
})()).join('');
|
|
276
|
-
return new Buffer("device::" + id + "\0");
|
|
277
|
-
});
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
return Socket;
|
|
281
|
-
|
|
282
|
-
})(EventEmitter);
|
|
283
|
-
|
|
284
|
-
Socket.AuthError = (function(superClass) {
|
|
285
|
-
extend(AuthError, superClass);
|
|
286
|
-
|
|
287
|
-
function AuthError(message) {
|
|
288
|
-
this.message = message;
|
|
289
|
-
Error.call(this);
|
|
290
|
-
this.name = 'AuthError';
|
|
291
|
-
Error.captureStackTrace(this, Socket.AuthError);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
return AuthError;
|
|
295
|
-
|
|
296
|
-
})(Error);
|
|
297
|
-
|
|
298
|
-
Socket.UnauthorizedError = (function(superClass) {
|
|
299
|
-
extend(UnauthorizedError, superClass);
|
|
300
|
-
|
|
301
|
-
function UnauthorizedError() {
|
|
302
|
-
Error.call(this);
|
|
303
|
-
this.name = 'UnauthorizedError';
|
|
304
|
-
this.message = "Unauthorized access";
|
|
305
|
-
Error.captureStackTrace(this, Socket.UnauthorizedError);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
return UnauthorizedError;
|
|
309
|
-
|
|
310
|
-
})(Error);
|
|
311
|
-
|
|
312
|
-
module.exports = Socket;
|
package/lib/adb/tracker.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
var EventEmitter, Parser, Promise, Tracker,
|
|
2
|
-
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
3
|
-
hasProp = {}.hasOwnProperty;
|
|
4
|
-
|
|
5
|
-
EventEmitter = require('events').EventEmitter;
|
|
6
|
-
|
|
7
|
-
Promise = require('bluebird');
|
|
8
|
-
|
|
9
|
-
Parser = require('./parser');
|
|
10
|
-
|
|
11
|
-
Tracker = (function(superClass) {
|
|
12
|
-
extend(Tracker, superClass);
|
|
13
|
-
|
|
14
|
-
function Tracker(command) {
|
|
15
|
-
this.command = command;
|
|
16
|
-
this.deviceList = [];
|
|
17
|
-
this.deviceMap = {};
|
|
18
|
-
this.reader = this.read()["catch"](Promise.CancellationError, function() {
|
|
19
|
-
return true;
|
|
20
|
-
})["catch"](Parser.PrematureEOFError, function() {
|
|
21
|
-
throw new Error('Connection closed');
|
|
22
|
-
})["catch"]((function(_this) {
|
|
23
|
-
return function(err) {
|
|
24
|
-
_this.emit('error', err);
|
|
25
|
-
};
|
|
26
|
-
})(this))["finally"]((function(_this) {
|
|
27
|
-
return function() {
|
|
28
|
-
return _this.command.parser.end().then(function() {
|
|
29
|
-
return _this.emit('end');
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
})(this));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
Tracker.prototype.read = function() {
|
|
36
|
-
return this.command._readDevices().cancellable().then((function(_this) {
|
|
37
|
-
return function(list) {
|
|
38
|
-
_this.update(list);
|
|
39
|
-
return _this.read();
|
|
40
|
-
};
|
|
41
|
-
})(this));
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
Tracker.prototype.update = function(newList) {
|
|
45
|
-
var changeSet, device, i, j, len, len1, newMap, oldDevice, ref;
|
|
46
|
-
changeSet = {
|
|
47
|
-
removed: [],
|
|
48
|
-
changed: [],
|
|
49
|
-
added: []
|
|
50
|
-
};
|
|
51
|
-
newMap = {};
|
|
52
|
-
for (i = 0, len = newList.length; i < len; i++) {
|
|
53
|
-
device = newList[i];
|
|
54
|
-
oldDevice = this.deviceMap[device.id];
|
|
55
|
-
if (oldDevice) {
|
|
56
|
-
if (oldDevice.type !== device.type) {
|
|
57
|
-
changeSet.changed.push(device);
|
|
58
|
-
this.emit('change', device, oldDevice);
|
|
59
|
-
}
|
|
60
|
-
} else {
|
|
61
|
-
changeSet.added.push(device);
|
|
62
|
-
this.emit('add', device);
|
|
63
|
-
}
|
|
64
|
-
newMap[device.id] = device;
|
|
65
|
-
}
|
|
66
|
-
ref = this.deviceList;
|
|
67
|
-
for (j = 0, len1 = ref.length; j < len1; j++) {
|
|
68
|
-
device = ref[j];
|
|
69
|
-
if (!newMap[device.id]) {
|
|
70
|
-
changeSet.removed.push(device);
|
|
71
|
-
this.emit('remove', device);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
this.emit('changeSet', changeSet);
|
|
75
|
-
this.deviceList = newList;
|
|
76
|
-
this.deviceMap = newMap;
|
|
77
|
-
return this;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
Tracker.prototype.end = function() {
|
|
81
|
-
this.reader.cancel();
|
|
82
|
-
return this;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
return Tracker;
|
|
86
|
-
|
|
87
|
-
})(EventEmitter);
|
|
88
|
-
|
|
89
|
-
module.exports = Tracker;
|
package/lib/adb/util.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var Auth, Parser;
|
|
2
|
-
|
|
3
|
-
Parser = require('./parser');
|
|
4
|
-
|
|
5
|
-
Auth = require('./auth');
|
|
6
|
-
|
|
7
|
-
module.exports.readAll = function(stream, callback) {
|
|
8
|
-
return new Parser(stream).readAll(stream).nodeify(callback);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
module.exports.parsePublicKey = function(keyString, callback) {
|
|
12
|
-
return Auth.parsePublicKey(keyString).nodeify(callback);
|
|
13
|
-
};
|
package/lib/adb.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
var Adb, Client, Keycode, util;
|
|
2
|
-
|
|
3
|
-
Client = require('./adb/client');
|
|
4
|
-
|
|
5
|
-
Keycode = require('./adb/keycode');
|
|
6
|
-
|
|
7
|
-
util = require('./adb/util');
|
|
8
|
-
|
|
9
|
-
Adb = (function() {
|
|
10
|
-
function Adb() {}
|
|
11
|
-
|
|
12
|
-
Adb.createClient = function(options) {
|
|
13
|
-
if (options == null) {
|
|
14
|
-
options = {};
|
|
15
|
-
}
|
|
16
|
-
options.host || (options.host = process.env.ADB_HOST);
|
|
17
|
-
options.port || (options.port = process.env.ADB_PORT);
|
|
18
|
-
return new Client(options);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
return Adb;
|
|
22
|
-
|
|
23
|
-
})();
|
|
24
|
-
|
|
25
|
-
Adb.Keycode = Keycode;
|
|
26
|
-
|
|
27
|
-
Adb.util = util;
|
|
28
|
-
|
|
29
|
-
module.exports = Adb;
|