wyatt8740 / idb

"iOS Debug Bridge" - push/pull files, run shells, install IPA's over USB, like ADB for Android. POSIX shell script. Can also be used for PC-to-PC SSH connections. Requires an SSH daemon on the iDevice for certain functionalities, but other parts use libimobiledevice tools and are still useful on non-jailbroken devices. Unrelated to Facebook idb.
https://gitlab.com/wyatt8740/idb
Other
35 stars 5 forks source link

idb options #1

Open uohoo opened 4 years ago

uohoo commented 4 years ago

Hi, I'd like to know if it's possible to takesnapshots from the iDevice or send action to the iDevice. Does it support instructions like adb shell input keyevent or shell input tap x y?

Thank you.

wyatt8740 commented 4 years ago

Huh, funny you should mention that… I actually implemented screenshotting a month ago and forgot/didn't find the time to clean it up and push the commit. I'll try to do that later on today/tonight.

BTW, it requires the iOS "developer disk" image from Apple in order to work in its current implementation, since it uses libimobiledevice's idevicescreenshot tool the same way it's used in XCode. Since it'll be a little bit before I can get around to pushing the commits, might not be a bad idea to grab the disk image for your version of iOS in advance. It also will require adding the disk image path to an idb.conf file, which is something else I've been working on formalizing. I don't remember the format I used so you'll just have to remember to edit the file when I push. Or maybe I could make it use an environment variable/a flag at run-time.

I should really see about remote button-press simulation, too. That's a good idea.

Thanks for the feedback! If I remember, I'll push the code sometime this evening. If not, please don't hesitate to remind me with a reply.

wyatt8740 commented 3 years ago

I think I have implemented screenshotting as of 64222b90d155fdfa249b21c0f8f80278f18d99ce .

wyatt8740 commented 3 years ago

forgot i still need to do keyevents (if possible).

wyatt8740 commented 3 years ago

Quick update on input keyevent/tap: It looks like there's no standardized way to do touch or key events in iOS system-wide; your options there appear to be very limited. My initial thoughts on how one might do this follow, but I don't think I am likely to do more than possibly keyboard inputs over bluetooth anytime soon:

A Bluetooth keyboard can be used to send keystrokes, so it may be possible (with a machine containing a bluetooth radio) to simulate a bluetooth keyboard using Bluetooth as a side-channel. This might be able to work. I have one bluetooth-enabled Linux laptop, and for reasons I'm not 100% certain of it's pretty hard to get BT to cooperate with it, but I might try to fix it and try doing this. I'm pretty sure most of my Bluetooth issues stem from an improper configuration and a very non-standard setup.

I don't have any iOS 13+ devices (my newest is running 10.2 or so, and my most-used device runs iOS 8), so I can't use bluetooth mouses on there, but if you have an iPad (I do have one of those, an iPad 2 running iOS 9) or an iOS 13+ iPhone it may be possible to get simulated clicks in a very roundabout fashion:

  1. Simulate mouse movements to force the pointer to the very topmost left corner of the screen (or any corner really; the important thing is having a well defined initial position).

  2. Send movements in such a way that pointer acceleration is counteracted to reach your intended point, similarly to how some old Apple ][ floppy disk controllers worked (the head would return home by brute force). Honestly however, I don't think I feel confident that I could accurately do the mouse stuff myself because I have no idea what the acceleration curves are.

If there were a way to make an external graphics tablet function on iDevices, that'd make things much easier.

A USB keyboard (via either the 30-pin "Camera Connection Kit" or the newer "Lightning USB Camera Adapter") could maybe also be used, but I think in order to do so one would have to either make one of their PC's USB host controllers emulate a guest/slave device, which I have no idea how to do (or even if any common PC USB controllers can do it; looking quickly at the µPD720202 datasheet doesn't look like there's any documented way to emulate a USB guest device on it, at least).

Still leaving this issue open just because I might return to it sooner or later. But for now it's likely going to be "no" on tap events and a "maybe someday" on keyevent. I have screenshots working.

It's a shame it's not any easier to do; after I broke the screen on my Nexus 6, using screenshots and keyevent/tap was the only way I could access some of my stuff on it.

Edit: this also exists; if you are on iOS 13 maybe that'd be worth looking into, but I can't test it. My newest device is a 5S, so even if I were willing to update it I still couldn't get beyond 12.