Android-ElectricSheep-Automator
view release on metacpan or search on metacpan
apps (e.g. via a regex which it is already supported) in the future.
SCRIPTS
For convenience, a few simple scripts are provided:
electric-sheep-find-installed-apps.pl
Find all install packages in the connected device. E.g.
electric-sheep-find-installed-apps.pl --configfile config/myapp.conf --device Pixel_2_API_30_x86_ --output myapps.json
electric-sheep-find-installed-apps.pl --configfile config/myapp.conf --device Pixel_2_API_30_x86_ --output myapps.json --fast
electric-sheep-open-app.pl
Open an app by its exact name or a keyword matching it (uniquely):
electric-sheep-open-app.pl --configfile config/myapp.conf --name com.android.settings
electric-sheep-open-app.pl --configfile config/myapp.conf --keyword 'clock'
Note that it constructs a regular expression from escaped user input.
electric-sheep-close-app.pl
Close an app by its exact name or a keyword matching it (uniquely):
electric-sheep-close-app.pl --configfile config/myapp.conf --name com.android.settings
electric-sheep-close-app.pl --configfile config/myapp.conf --keyword 'clock'
Note that it constructs a regular expression from escaped user input.
electric-sheep-dump-ui.pl
Dump the current screen UI as XML to STDOUT or to a file:
electric-sheep-dump-ui.pl --configfile config/myapp.conf --output ui.xml
Note that it constructs a regular expression from escaped user input.
electric-sheep-dump-current-location.pl
Dump the GPS / geo-location position for the device from its various
providers, if enabled.
electric-sheep-dump-current-location.pl --configfile config/myapp.conf --output geolocation.json
electric-sheep-emulator-geofix.pl
Set the GPS / geo-location position to the specified coordinates.
electric-sheep-dump-ui.pl --configfile config/myapp.conf --latitude 12.3 --longitude 45.6
electric-sheep-dump-screen-shot.pl
Take a screenshot of the device (current screen) and save to a PNG
file.
electric-sheep-dump-screen-shot.pl --configfile config/myapp.conf --output screenshot.png
electric-sheep-dump-screen-video.pl
Record a video of the device's current screen and save to an MP4 file.
electric-sheep-dump-screen-video.pl --configfile config/myapp.conf --output video.mp4 --time-limit 30
electric-sheep-pull-app-apk.pl
Extract the APK file (java bytecode) for an app installed on the device
and save locally, perhaps, for disassembly and/or modification and/or
re-installation.
electric-sheep-pull-app-apk.pl --package calendar2 --wildcard --output anoutdir --configfile config/myapp.conf --device Pixel_2_API_30_x86_
electric-sheep-install-app
Install an APK file onto the device, passing extra installation
parameters -r (for re-install) and -g (for granting permissions),
electric-sheep-install-app --apk-filename test.apk -p '-r' -p '-g' --configfile config/myapp.conf --device Pixel_2_API_30_x86_
electric-sheep-viber-send-message.pl
Send a message using the Viber app.
electric-sheep-viber-send-message.pl --message 'hello%sthere' --recipient 'george' --configfile config/myapp.conf --device Pixel_2_API_30_x86_
This one saves a lot of debugging information to debug which can be
used to deal with special cases or different versions of Viber:
electric-sheep-viber-send-message.pl --outbase debug --verbosity 1 --message 'hello%sthere' --recipient 'george' --configfile config/myapp.conf --device Pixel_2_API_30_x86_
TESTING
The normal tests under the t/ directory, initiated with make test
command, are quite limited in scope because they do not assume a
connected device. That is, they do not check any functions which
require interaction with a connected device.
The live tests under the xt/live directory, initiated with make
livetest command, require an Android emulator or real device (the
latter is not recommended) connected to your desktop computer on which
you are doing the testing. Note that testing with your smartphone is
not a good idea, please do not do this, unless it is some phone which
you do not store important data. It is very easy to get an emulated
Android device running on any OS.
So, prior to make livetest make sure you have an android emulator up
and running with, for example, emulator -avd Pixel_2_API_30_x86_ . See
section "Android Emulators" for how to install, list and run them
buggers.
At least one of the author tests under the xt/author directory,
initiated with make authortest command, require an APK file (to be
installed on the connected device) which is quite large and it is not
included in the distribution bundle of this module. Anyway, it is not a
good idea to install an unknown APK to your device. But if you want to
make this test then pull an APK of an existing app on your connected
device with electric-sheep-pull-app-apk.pl and point the test file to
( run in 1.435 second using v1.01-cache-2.11-cpan-df04353d9ac )