For Android there is ADB (Android debug bridge) which allows to get a shell on the connected device:
adb shell
Is there something similar for iOS?
I'd like to type some shell commands on my Mac that would be executed on the connected iPhone.
Is there a built-in Terminal on iPhone?
There isn't anything for it built in, but if you are jailbroken or can sideload apps (a.k.a., you have a mac with XCode), you can run a local terminal with apps like MobileTerminal, which aren't available on the app store.
To access a shell from a computer, if you are jailbroken (and possibly even if you aren't, if you can sideload apps) you can install openssh or openssh-server from Cydia (I believe it is just called "OpenSSH" in the GUI). Once that is running on your device, you can connect the device over USB and use this shell script I made called idb to access a shell, push and pull files, and so on. This sets up a USB link to relay TCP packets from the SSH server on the device, and then 'wraps' around SSH and SCP to perform the required tasks.
You'll have to compile a program to make it work called iproxy; this program relays TCP over the USB bus to allow ssh over a cable. The comments in the script I wrote explain how to do this (sorry... I plan to move it into README.md eventually).
The program follows most of the syntax of adb and implements some of the more commonly used operations of it.
Without jailbreaking, your options are more limited, but it may be possible to do something. I haven't tried since I don't regularly use iOS anymore.
use ssh through network (e.g. Wi-Fi), and iphone/ipad need download and enable ssh service, firstly.
Related
I am working on a hardware device running OpenWrt. I was wondering if I can manage my hardware and run shell scripts etc. remotely using OpenWisp2. Is it possible? If yes, then how to do that?
Not at the moment I'm writing.
You can only send configuration files, which can include scripts that can be also added to the crontab.
Sending commands will be possible once this branch is merged: https://github.com/openwisp/openwisp-controller/pull/31
Google has changed and removed the i2c device from the /dev/ path.
They add/remove the device I you are using this:
I2cDevice dev = pService.openI2cDevice("I2C1", 0x68)
And the /dev/i2c-1 is gone if you disconnect the I2C device: dev.close();
This is the reason why you do not have access via:
open("/dev/i2c-1", O_RDWR);
(this was possible in the Version 4.1 without issues)
So, now google made it complicated... and the question is, how I can bring back the device i2c-1 after boot?
#Kyle what you're doing may work, but it definitely isn't supported by Android Things. When Android Things leaves developer preview, you may no longer be able to directly access device files at all (due to the device being in SELinux enforcing mode).
In the meantime, you can probably execute the following to recreate the device node. At best this is a temporary solution, since you'll have to run these commands every boot (unless you add them to one of the init scripts).
$ adb shell
rpi3:/ $ su
rpi3:/ # mknod /dev/i2c-1 c 89 1
I am trying to install an app to a jailbroken iPhone from PC via USB (using AFC2), for personal research. The app is actually an installer, so it has no UI.
My biggest 2 problems are: I don't know any API to run a command via an USB services, to run the binary after copying.
Then, I installed a LaunchDaemon plist to start my installer, but it seems that the binary is copied with no execution rights (maybe a limitation in AFC2), so the launch daemon fails.
So now I am stucked. Do you have any ideeas?
UPDATE
Thanks to creker I made some steps into achieving my goal. He provided me with several solutions, but I chosen the automatically install DEB via Cydia, since it looks the most simple and elegant method of all.
Nevertheless, I hit some bumps with this method also:
now I am able to succesfully install the .deb file via Cydia; I load the app and a launch daemon in the deb, but the launch daemon is unable to start the app, since installd fails to validate the app, which was fake-signed with ldid (I thought ldid signing is sufficient for running in jailbroken environment); so I guess either I sign it for real or I use a tweak like AppSync, to bypass validation
I also tried the following formula: a launch daemon to launch a bash script, which then starts the app, since I saw that cydia and OpenSSH registers some launch daemons like that, but my script / launch daemon is ignored, so I presume there should be a trick somewhere. Am I missing something here?
Do you have a WiFi? If not, you can use USB tunneling. Then you can SCP your app on a device and install it with SSH (give it persmissions you need and then launch). That's enough for testing. Or you can pack it into debian package with postinst script that will do all the installation. Debian packages can be installed manually through ssh and deb -i command. Or you can copy it into /var/root/Media/Cydia/AutoInstall and it will be installed automatically on device boot.
As for root:wheel, you can do this in your postinst script. The script by default is executed with root permissions. Just set all necessary permissions in it for all your files. If it's a daemon, you can even manually add it to launchd and launch immediatelly.
I am investigating the feasibility of testing native, hybrid, and web-based applications using Selenium for Windows (web only), Android, and iOS mobile devices (e.g. iPad).
The ideal setup for a tester would be a Windows machine with physical devices connected via USB. This works with Android as all that is needed (excluding the ADK and USB driver setup) is Selendroid's stand-alone server and a JAR dependency. However, from my understanding, this is not possible with iOS mobile devices using ios-driver. I have also checked out Appium, and they too state that a Mac computer would be needed to test iOS devices.
So that brings us to my question: Is there a way to test iOS mobile apps (web, hybrid, native) from a Windows machine?
Here is a list of preferences:
- Use Selenium and other Selenium-compatible plug-ins
- Run tests from Windows machine
- Cannot use iOS VM
- Cannot use Mac machine with "middle-man" application to communicate with Windows machine
- Have to test physical mobile devices
- No "hacks" (e.g. Jailbreaking)
It is also safe to assume that I have no experience developing iOS applications.
It is possible to run the tests from a Windows machine but not the way you are probably thinking. You will still need a Mac. Here are the requirements:
A mac on your network with Appium server running
Has Appium environment installed properly
Has the .app on the machine
If you have these three requirements fulfilled and there is no firewall blocking network access to the Mac then you can do it. You will have to actual tests on the Windows machine but instead of specifying 127.0.0.1:8080 in the setup method as the IP address of Appium server you will replace it with this: yourmacsipaddress:8080 and this should execute the test properly.
Remember that you have to specify the path of the .app in the test which is running from your Windows machine. But the catch is that the path has to be the path of the .app in the Mac and not on your Windows machine.
So the tests will run from your Windows machine but the installation of the app, the automation, and the testing will be done on the Mac but you will get the "pass" or "fail" update on your Windows machine.
If you do not want to set up appium in your local machine, You can also go with sauce lab.
sauce lab provide vm to you. select appropriate device and run using appiumDriver. Provide below capabilty and run using appiumDriver. your remote url will be like this
http://your_username:your_access_key#ondemand.saucelabs.com:80/wd/hub
For iOS Native,
{"driver.class":"io.appium.java_client.ios.IOSDriver","platformName":"iOS","browserName":"","platformVersion":"your os version","deviceName":"device Name","appiumVersion":"1.5.3","app":"sauce-storage:Your application name on sauce storage"}
Your application should be available on sauce storage. You can upload using sauce api .
You can also use this same for web application, android/ ios native application.
I would like to run a script on a device that I have established an SSH session into. However, the script is on my local Windows machine.
For my experiment, I have:
A python script on my local machine (Windows)
A jailbroken iOS device that I can SSH into using putty
I want to run the python script, that's located on my windows machine, on my jailbroken device.
Is this possible?
I know on a Mac, you can actually use the terminal to do just that and it would look something like this.
python [pythonfile].py [parameters] [target device]
The reason why I can't just run the python script on my device is because I can't install python on that device (at least it isn't on Cydia). Plus, I don't want to pay for an app that executes it.
Let me know if you have any suggestions, thanks.
Have you tried this libssh2-for-iOS. Its an open source library which does exactly the same thing you are looking for.