unprompted / fruitstrap

Install and debug iPhone apps from the command line, without using Xcode
Other
81 stars 6 forks source link

new features to apple.py #4

Open thehesiod opened 11 years ago

thehesiod commented 11 years ago

I've been working on apple.py to support automation however one critical feature missing is the ability to figure out which applications are currently running so you don't try launching the app while the old one is shutting down (bad things happen). I know its possible since Instruments does it, and I know that to figure out what the command is one would have to look at the plists that lockdownd is sending to the device. i was able to use socat to look at the data on usbmuxd however one would have to deconstruct the data and dump the plist data (no time for this now). Anyone have anything up their sleeves for doing this? Also, how should I send my contributions? I could email what I have. I suppose I could just fork this but aren't there enough forks? :)

Here's what I've added so far:

thehesiod commented 11 years ago

btw, I found that I can get the launch'd PID like so: self.send('qLaunchSuccess') self._socket.sendall('vCont;c')

self.send('vCont;c') # this will block until the app exists. TODO: To be able to run async we need a way to figure out when the app has completely exited

    self.send('\x03')
    pid = self.send('qC')

with elif response.startswith('QC'): return int(response[2:], 16)

and killing like so: self.send('vAttach;' + str(pid)) return self.send('k')

and it seems pretty stable.

crewbs commented 10 years ago

Is there any chance apple.py could be extended to support specifying a device to use (e.g. it's UDID), rather than just using the device most recently connected?

unprompted commented 10 years ago

I added a --device-id argument.

crewbs commented 10 years ago

Awesome, thanks. works great.

dengwei729 commented 10 years ago

python apple.py -get /var/mobile/Media/jailbreak.log . Waiting for a device... Connected to device with UDID: ae23586414f4d0d70c88fe9566e6de34c5ba95b8 Traceback (most recent call last): File "apple.py", line 1155, in readFile = afc.open(arguments.get_file[0], 'r') File "apple.py", line 871, in open return AFCFile(self._afc, path, mode) File "apple.py", line 835, in init raise RuntimeError('AFCFileRefOpen returned %d' % result)

why?