Esempio n. 1
0
        public unsafe XDocument RequestProperties(string domain)
        {
            iDevice id = Devices[0];
            IntPtr  currDevice;
            string  currUdid = id.Udid;

            LibiMobileDevice.iDeviceError returnCode = LibiMobileDevice.NewDevice(out currDevice, currUdid);
            IntPtr ldService;
            IntPtr lockdownClient;

            Lockdown.LockdownError lockdownReturnCode = Lockdown.Start(currDevice, out lockdownClient, out ldService);
            if (lockdownReturnCode == Lockdown.LockdownError.LOCKDOWN_E_SUCCESS)
            {
                IntPtr resultPlist;
                Lockdown.LockdownError lderror = Lockdown.lockdownd_get_value(lockdownClient, domain, null, out resultPlist);
                XDocument xd = LibiMobileDevice.PlistToXml(resultPlist);
                Lockdown.FreeClient(lockdownClient);
                Lockdown.FreeService(ldService);
                LibiMobileDevice.idevice_free(currDevice);
                return(xd);
            }
            else
            {
                Lockdown.FreeClient(lockdownClient);
                Lockdown.FreeService(ldService);
                LibiMobileDevice.idevice_free(currDevice);
                throw new iPhoneException("Lockdown Encountered an Error {0}", lockdownReturnCode);
            }
        }
Esempio n. 2
0
        public bool SetProperty(string domain, string key, string value)
        {
            bool    rv = false;
            iDevice id = Devices[0];
            IntPtr  currDevice;
            string  currUdid = id.Udid;

            LibiMobileDevice.iDeviceError returnCode = LibiMobileDevice.NewDevice(out currDevice, currUdid);
            IntPtr ldService;
            IntPtr lockdownClient;

            Lockdown.LockdownError lockdownReturnCode = Lockdown.Start(currDevice, out lockdownClient, out ldService);
            if (lockdownReturnCode == Lockdown.LockdownError.LOCKDOWN_E_SUCCESS)
            {
                IntPtr plistString             = LibiMobileDevice.plist_new_string(value);
                Lockdown.LockdownError lderror = Lockdown.lockdownd_set_value(lockdownClient, domain, key, plistString);
                if (lderror == Lockdown.LockdownError.LOCKDOWN_E_SUCCESS)
                {
                    rv = true;
                }
            }
            Lockdown.FreeClient(lockdownClient);
            Lockdown.FreeService(ldService);
            LibiMobileDevice.idevice_free(currDevice);
            return(rv);
        }
Esempio n. 3
0
        public List <iOSApplication> GetApplicationList()
        {
            iDevice id = Devices[0];
            IntPtr  currDevice;
            string  currUdid = id.Udid;

            LibiMobileDevice.iDeviceError returnCode = LibiMobileDevice.NewDevice(out currDevice, currUdid);
            IntPtr ldService;
            IntPtr lockdownClient;

            Lockdown.LockdownError lockdownReturnCode = Lockdown.Start(currDevice, out lockdownClient, out ldService);
            IntPtr InstProxyClient;

            InstallationProxy.InstproxyError ipe = InstallationProxy.Connect(currDevice, ldService, out InstProxyClient);
            List <iOSApplication>            appList;

            InstallationProxy.GetApplications(InstProxyClient, out appList);
            Lockdown.FreeClient(lockdownClient);
            Lockdown.FreeService(ldService);
            if (ipe == InstallationProxy.InstproxyError.INSTPROXY_E_SUCCESS)
            {
                InstallationProxy.instproxy_client_free(InstProxyClient);
                LibiMobileDevice.idevice_free(currDevice);
                return(appList);
            }
            else
            {
                throw new iPhoneException("Installation Proxy encountered an error ({0})", ipe);
            }
        }
Esempio n. 4
0
        public void UninstallApplication(string applicationBundleIdentifier)
        {
            string  appId = applicationBundleIdentifier;
            iDevice id    = Devices[0];
            IntPtr  currDevice;
            string  currUdid = id.Udid;

            LibiMobileDevice.iDeviceError returnCode = LibiMobileDevice.NewDevice(out currDevice, currUdid);
            IntPtr ldService;
            IntPtr lockdownClient;

            Lockdown.LockdownError lockdownReturnCode = Lockdown.Start(currDevice, out lockdownClient, out ldService);
            IntPtr InstProxyClient;
            IntPtr InstProxyServer;

            InstallationProxy.InstproxyError ipe = InstallationProxy.instproxy_client_start_service(currDevice, out InstProxyClient, out InstProxyServer);
            ipe = InstallationProxy.instproxy_uninstall(InstProxyClient, appId, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
            InstallationProxy.instproxy_client_free(InstProxyClient);
            Lockdown.FreeClient(lockdownClient);
            Lockdown.FreeService(ldService);
            LibiMobileDevice.idevice_free(currDevice);
            if (ipe != InstallationProxy.InstproxyError.INSTPROXY_E_SUCCESS)
            {
                throw new iPhoneException("Installation Proxy encountered an error ({0})", ipe);
            }
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            DeviceMonitor.Connected    += DeviceMonitor_Connected;
            DeviceMonitor.Disconnected += DeviceMonitor_Disconnected;

            Console.WriteLine("等待设备连接。。。");
            Console.ReadLine();

            Debug.Assert(dev != IntPtr.Zero);

            Lockdown lockdown = new Lockdown(dev);

            var name = lockdown.GetValue("DeviceName");

            Console.WriteLine(name);

            var sd_sync = lockdown.StartService("com.apple.mobilesync");

            //var dl = new DeviceLinkService(sd_sync);
            //dl.device_link_service_version_exchange(300, 100);

            MobileSync sync = new MobileSync(sd_sync);

            msyncclient.mobilesync_get_all_contacts(sync);
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            DeviceMonitor.Connected    += DeviceMonitor_Connected;
            DeviceMonitor.Disconnected += DeviceMonitor_Disconnected;

            Console.WriteLine("等待设备连接。。。");
            Console.ReadLine();

            Debug.Assert(dev != IntPtr.Zero);

            Lockdown lockdown = new Lockdown(dev);

            var name = lockdown.GetValue("DeviceName");

            var sd_ip = lockdown.StartService("com.apple.mobile.installation_proxy");

            var client_ip = new InstallationProxy(sd_ip);

            //应用列表
            var result = client_ip.GetAppList();

            var temp_file = System.IO.Path.GetTempFileName() + ".xml";

            result.Save(temp_file, PList.PListFormat.Xml);

            Process.Start("IEXPLORE.EXE", temp_file);

            //卸载
            var id = "com.fengbangshou.fbs";

            client_ip.UninstallApplication(id);

            //安装
            client_ip.InstallApplication("测试应用.ipa", new InstallAppCallback(Callback));
        }
Esempio n. 7
0
        static void Main(string[] args)
        {
            DeviceMonitor.Connected    += DeviceMonitor_Connected;
            DeviceMonitor.Disconnected += DeviceMonitor_Disconnected;

            Console.WriteLine("等待设备连接。。。");
            Console.ReadLine();

            Debug.Assert(dev != IntPtr.Zero);

            Lockdown lockdown = new Lockdown(dev);

            var name = lockdown.GetValue("DeviceName");

            Console.WriteLine(name);

            var sd_sbs = lockdown.StartService("com.apple.springboardservices");

            var sbs = new SpringBoard(sd_sbs);

            //桌面状态
            var state = sbs.GetIconState();

            var state_xml = System.IO.Path.GetTempFileName() + ".xml";

            state.WriteXml(System.Xml.XmlWriter.Create(state_xml));
            Process.Start("IEXPLORE.EXE", state_xml);

            //ICON
            var png = sbs.GetIconPNGData("com.baidu.map");

            var png_xml = System.IO.Path.GetTempFileName() + ".xml";

            png.WriteXml(System.Xml.XmlWriter.Create(png_xml));
            Process.Start("IEXPLORE.EXE", png_xml);

            //墙纸
            var wallpaper = sbs.GetHomeScreenWallpaperPNGData();

            var file_wallpaper = System.IO.Path.GetTempFileName() + ".png";

            using (var stream_wallpaper = new FileStream(file_wallpaper, FileMode.Create))
            {
                var wallpaper_png = wallpaper["pngData"] as PListData;

                stream_wallpaper.Write(wallpaper_png.Value, 0, wallpaper_png.Value.Length);
            }
            Process.Start("IEXPLORE.EXE", file_wallpaper);

            //界面方向
            var s = sbs.GetInterfaceOrientation();

            Console.WriteLine(s);

            Console.ReadLine();
        }
Esempio n. 8
0
        static void Main(string[] args)
        {
            DeviceMonitor.Connected    += DeviceMonitor_Connected;
            DeviceMonitor.Disconnected += DeviceMonitor_Disconnected;

            Console.WriteLine("等待设备连接。。。");
            Console.ReadLine();

            Debug.Assert(dev != IntPtr.Zero);

            Lockdown lockdown = new Lockdown(dev);

            var name = lockdown.GetValue("DeviceName");
        }
Esempio n. 9
0
 public void Deactivate()
 {
     if (this.IsConnected)
     {
         iDevice id = Devices[0];
         IntPtr  currDevice;
         string  currUdid = id.Udid;
         LibiMobileDevice.iDeviceError returnCode = LibiMobileDevice.NewDevice(out currDevice, currUdid);
         IntPtr ldService;
         IntPtr lockdownClient;
         Lockdown.LockdownError lockdownReturnCode = Lockdown.Start(currDevice, out lockdownClient, out ldService);
         Lockdown.lockdownd_deactivate(lockdownClient);
         Lockdown.FreeService(ldService);
         Lockdown.FreeClient(lockdownClient);
         LibiMobileDevice.idevice_free(currDevice);
     }
     else
     {
         throw new iPhoneException("Device not connected.");
     }
 }
Esempio n. 10
0
        public void Reboot()
        {
            iDevice id = Devices[0];
            IntPtr  currDevice;
            string  currUdid = id.Udid;

            LibiMobileDevice.iDeviceError returnCode = LibiMobileDevice.NewDevice(out currDevice, currUdid);
            IntPtr ldService;
            IntPtr lockdownClient;

            Lockdown.LockdownError lockdownReturnCode = Lockdown.Start(currDevice, out lockdownClient, out ldService);
            IntPtr diagService;
            IntPtr diagClient;

            iDiagnostics.diagnostics_relay_error_t dre = iDiagnostics.diagnostics_relay_client_start_service(currDevice, out diagClient, out diagService);
            iDiagnostics.diagnostics_relay_restart(diagClient, iDiagnostics.DIAGNOSTICS_RELAY_ACTION_FLAG_DISPLAY_PASS);
            iDiagnostics.diagnostics_relay_client_free(diagClient);
            Lockdown.FreeClient(lockdownClient);
            Lockdown.FreeService(ldService);
            LibiMobileDevice.idevice_free(currDevice);
        }
Esempio n. 11
0
        public void Sleep()
        {
            iDevice id = Devices[0];
            IntPtr  currDevice;
            string  currUdid = id.Udid;

            LibiMobileDevice.iDeviceError returnCode = LibiMobileDevice.NewDevice(out currDevice, currUdid);
            IntPtr ldService;
            IntPtr lockdownClient;

            Lockdown.LockdownError lockdownReturnCode = Lockdown.Start(currDevice, out lockdownClient, out ldService);
            IntPtr diagService;
            IntPtr diagClient;

            iDiagnostics.diagnostics_relay_error_t dre = iDiagnostics.diagnostics_relay_client_start_service(currDevice, out diagClient, out diagService);
            iDiagnostics.diagnostics_relay_sleep(diagClient);
            iDiagnostics.diagnostics_relay_client_free(diagClient);
            Lockdown.FreeClient(lockdownClient);
            Lockdown.FreeService(ldService);
            LibiMobileDevice.idevice_free(currDevice);
        }
Esempio n. 12
0
        static void Main(string[] args)
        {
            DeviceMonitor.Connected    += DeviceMonitor_Connected;
            DeviceMonitor.Disconnected += DeviceMonitor_Disconnected;

            Console.WriteLine("等待设备连接。。。");
            Console.ReadLine();

            Debug.Assert(dev != IntPtr.Zero);

            Lockdown lockdown = new Lockdown(dev);

            var name = lockdown.GetValue("DeviceName");

            Console.WriteLine(name);

            var sd_sync = lockdown.StartService("com.apple.mobilesync");

            eti_sync eti = new eti_sync(sd_sync);

            eti.eti_sync_start_sync();
            var c = eti.eti_sync_get_contacts();

            var contacts = new Dictionary <string, EtiContact>();

            contacts.Add("6", new EtiContact()
            {
                first_name      = "pizixie",
                first_name_yomi = "yomi",
                middle_name     = " "
            });

            eti.eti_sync_send_contacts(contacts);

            eti.eti_sync_stop_sync();
        }
Esempio n. 13
0
 private void CreateCounter(MainModel main, InputViewVM input)
 {
     _lockdown = new Lockdown(main, input);
     _lockdown.Start();
 }