Search code examples
c#iphonejailbreaktweak

Send command from PC application to Jailbroken iphone


I am making an simple application on PC by C# to send command to jailbroken iphone (exp: open app, get list application installed on iphone..e.t.c..) but I do not know how to send to iphone, searching google but can not find a thing to do this. Anyone know how to send command to iphone please point me out or some documents to learn about this. Thank you.


Solution

  • in my opinion the best way to go is using SSH, here's the steps

    On the Jailbroken device (Skip this steps if you already have an ssh server installed and running)

    1. Download the SSH server from Cydia
    2. Take note of your device's IP address
    3. Default username: root and password: alpine Remember to change that!, also i would recommend creating another user for your app

    In your application

    1. Download and install the SSH.NET library from NuGET here

    2. Implement your appropriate methods to connect,disconnect and send commands, se those examples:

      using (var client = new SshClient("phoneIp", "phoneUsername", "phonePassword")) {
          client.Connect();
          //Open the Facebook app and show your profile
          client.RunCommand("open fb://profile");
          //Alternative method using `uiopen`
          client.RunCommand("uiopen fb://profile");
      
          //Read device network info (install network-cmds first)
          Console.WriteLine(client.RunCommand("ifconfig"));
      
          //List all apps installed via Cydia
          Console.WriteLine(client.RunCommand("dpkg –list"));
      
          //List all apps that are installed from iTunes/Appstore
          Console.WriteLine(client.RunCommand("cat /private/var/mobile/Library/Caches/com.apple.mobile.installation.plist"));
          client.Disconnect();
      }
      

    I haven't tested this code of course, and I have no Jailbroken iOS device, but this should put you on the right path at least!