0

Is it possible to get the pid of the current open application or its name from command-line on a jailbreaked iOS device?

I want this so it is faster to hook cycript to the current application, than having to find it using ps.

My current solution requires that you know the name of the application:

cycript2 () 
{ 
    cycript -p $(ps aux | grep -i $1 | head -1 | awk '{ print $2 }')
}
Tyilo
  • 28,998
  • 40
  • 113
  • 198

1 Answers1

0

I have now idea on how to do it in command line, but you could write a small tweak with 2 components communicating for example via CPDistributedMessagingCenter

  1. a dylib injectd into SpringBoard, which accepts a message, gets the currently frontmost app and returns information about it (PID, name, ...)

  2. An CL executable which sends the message to the dylib and accepts the return information and uses it to launch cycript.

This probably won't need more than 30 lines of code :)

YllierDev
  • 571
  • 4
  • 16