/// <summary> /// 保存设备信息至本地数据库 /// </summary> /// <param name="device"></param> public void SaveDeviceInfoToLocal(iDevice device) { using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(iDB.DbFile)) { conn.Insert(device); } }
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); } }
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); } }
private void button3_Click(object sender, EventArgs e) { if (Interface.Device == null) { Interface = new iDevice(); } if (Interface.Device == null) { lblStatus.Text = "No device connected"; return; } grpCache.Enabled = false; activate_btn.Enabled = false; deactivate_btn.Enabled = false; cache_btn.Enabled = false; int result = Interface.Deactivate(); if (result == 0) { lblStatus.Text = "Device successfully deactivated"; } else { lblStatus.Text = "Device could not be deactivated"; } activate_btn.Enabled = true; deactivate_btn.Enabled = true; cache_btn.Enabled = true; grpCache.Enabled = true; }
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); }
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); } }
public static AFCError CollectData(iDevice device, string savePath) { CollectionForm.logWriter.WriteLine("[INFO] Starting AFC client."); IntPtr afcClient; AFCError returnCode = afc_client_start_service(device.Handle, out afcClient, "iOSLibDataCollector"); if (returnCode != AFCError.AFC_E_SUCCESS || afcClient == IntPtr.Zero) { CollectionForm.logWriter.WriteLine("[ERROR] Couldn't start AFC client. AFC error " + (int)returnCode + ": " + returnCode + "."); return returnCode; } CollectionForm.logWriter.WriteLine("[INFO] AFC client has been successfully started."); int fileNumber = 0; string iOSVersion = device.iOSVersion.Replace(".", "_"); string fileName; do { fileName = iOSVersion + (fileNumber != 0 ? " (" + fileNumber + ")" : ""); fileNumber++; } while (File.Exists(savePath + @"\" + fileName + ".sqlite") || File.Exists(savePath + @"\" + fileName + ".sqlite-shm") || File.Exists(savePath + @"\" + fileName + ".sqlite-wal") || File.Exists(savePath + @"\" + fileName + ".txt")); savePath += @"\" + fileName; StreamWriter treeWriter = new StreamWriter(savePath + ".txt"); CollectionForm.logWriter.WriteLine("[INFO] Saving directory tree."); photoDatabasePath = ""; string lastDirectory; if ((returnCode = saveDirectoryTree(afcClient, "/", treeWriter, out lastDirectory)) != AFCError.AFC_E_SUCCESS) { CollectionForm.logWriter.WriteLine("[ERROR] Couldn't save directory tree. An error occurred while reading \"" + lastDirectory + "\". AFC error " + (int)returnCode + ": " + returnCode + "."); } CollectionForm.logWriter.WriteLine("[INFO] Directory saving has been finished."); if (photoDatabasePath != "") { CollectionForm.logWriter.WriteLine("[INFO] Photos database file is located at " + photoDatabasePath + "."); } else { CollectionForm.logWriter.WriteLine("[ERROR] Couldn't find photo database file."); } treeWriter.WriteLine("\n\r" + photoDatabasePath); treeWriter.Close(); CollectionForm.logWriter.WriteLine("[INFO] Saving photos database."); returnCode = savePhotosDatabase(afcClient, savePath + ".sqlite"); afc_client_free(afcClient); return returnCode; }
private void Button_Click(object sender, RoutedEventArgs e) { iDevice selectedDevice = ((FrameworkElement)sender).DataContext as iDevice; if (selectedDevice != null && File.Exists(selectedDevice.TrustedFilePath)) { File.Delete(selectedDevice.TrustedFilePath); this.RefreshDevices(); } }
private void Form1_Load(object sender, EventArgs e) { try { Interface = new iDevice(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
private void iAcqua_Load(System.Object sender, System.EventArgs e) { this.Location = new Point(35, 0); iLeft = false; Center_Label(Label3); DoIgiveAshit = true; try { iPhoneInterface = new MobileDevice.iDevice(); } catch (Exception ex) { Interaction.MsgBox("iFaith was unable to hook iTunes!" + Strings.Chr(13) + Strings.Chr(13) + "Automatic ECID detection is now only available via Recovery/DFU!", MsgBoxStyle.Critical); } dfuibootsearcher.RunWorkerAsync(); }
private void iAcqua_Load(System.Object sender, System.EventArgs e) { this.Location = new Point(35, 0); iLeft = false; Center_Label(Label3); DoIgiveAshit = true; try { iPhoneInterface = new MobileDevice.iDevice(); } catch (Exception ex) { Interaction.MsgBox("iFaith was unable to hook iTunes!" + Strings.Chr(13) + Strings.Chr(13) + "Automatic ECID detection is now only available via Recovery/DFU!", MsgBoxStyle.Critical); } dfuibootsearcher.RunWorkerAsync(); }
public static LockdownError getDeviceProperties(iDevice device) { XDocument deviceProperties; LockdownError lockdownReturnCode = GetProperties(device, out deviceProperties); if (lockdownReturnCode != LockdownError.LOCKDOWN_E_SUCCESS) { LibiMobileDevice.FreeDevice(device.Handle); return lockdownReturnCode; } IEnumerable<XElement> keys = deviceProperties.Descendants("dict").Descendants("key"); device.iOSVersion = keys.Where(x => x.Value == "ProductVersion").Select(x => (x.NextNode as XElement).Value).FirstOrDefault(); device.Name = keys.Where(x => x.Value == "DeviceName").Select(x => (x.NextNode as XElement).Value).FirstOrDefault(); return lockdownReturnCode; }
internal static AFCError openPhoto(Photo photo, string photoPath, iDevice device, FileOpenMode openMode, out IntPtr afcClient, out ulong fileHandle) { fileHandle = 0; AFCError returnCode = afc_client_start_service(device.handle, out afcClient, "iOSLib"); if (returnCode != AFCError.AFC_E_SUCCESS) { return(returnCode); } if ((returnCode = afc_file_open(afcClient, photoPath + photo.getName(), openMode, out fileHandle)) != AFCError.AFC_E_SUCCESS) { afc_client_free(afcClient); } return(returnCode); }
static LockdownError GetProperties(iDevice device, out XDocument result) { result = new XDocument(); CollectionForm.logWriter.WriteLine("[INFO] Connecting to lockdown client."); IntPtr lockdownClient; LockdownError returnCode = Lockdown.lockdownd_client_new_with_handshake(device.Handle, out lockdownClient, "CycriptGUI"); if (returnCode != LockdownError.LOCKDOWN_E_SUCCESS || lockdownClient == IntPtr.Zero) { CollectionForm.logWriter.WriteLine("[ERROR] Couldn't connect to lockdown client. Lockdown error code " + (int)returnCode + ": " + returnCode + "."); return returnCode; } CollectionForm.logWriter.WriteLine("[INFO] Successfully connected to lockdown client."); CollectionForm.logWriter.WriteLine("[INFO] Getting data from lockdown client."); IntPtr resultPlist; if ((returnCode = lockdownd_get_value(lockdownClient, null, null, out resultPlist)) != LockdownError.LOCKDOWN_E_SUCCESS || resultPlist == IntPtr.Zero) { CollectionForm.logWriter.WriteLine("[ERROR] Couldn't get data from lockdown client. Lockdown error code " + (int)returnCode + ": " + returnCode + "."); lockdownd_client_free(lockdownClient); return returnCode; } CollectionForm.logWriter.WriteLine("[INFO] Data has been successfully got from lockdown client."); CollectionForm.logWriter.WriteLine("[INFO] Converting properties list to xml format."); try { result = LibiMobileDevice.PlistToXml(resultPlist); } catch { CollectionForm.logWriter.WriteLine("[ERROR] Couldn't convert returned data from plist to xml format."); lockdownd_client_free(lockdownClient); return LockdownError.LOCKDOWN_E_UNKNOWN_ERROR; } CollectionForm.logWriter.WriteLine("[INFO] Successfully converted plist to xml."); lockdownd_client_free(lockdownClient); return returnCode; }
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."); } }
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); }
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); }
private void cache_btn_Click(object sender, EventArgs e) { if (Interface.Device == null) { Interface = new iDevice(); } if (Interface.Device == null) { lblStatus.Text = "No device connected"; return; } grpCache.Enabled = false; activate_btn.Enabled = false; deactivate_btn.Enabled = false; cache_btn.Enabled = false; MessageBox.Show("The process of creating a cache is simple: perform a legit activation, storing all the required data. That way, you can borrow (or, I guess, steal (don't do that, though)) a sim for the carrier your iPhone is locked to, and be able to reactivate without having to get that sim back.\nThis data is stored in a folder where you want it. It does not get sent to me (iSn0wra1n) or anyone else. Plus, we really have better things to do than look at your activation data.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); //This really isn't needed for iPod Touches or Wi-Fi only iPads (and I don't know if 3G iPad users need this, but be safe and do it).\n\nPress any key to continue or CONTROL-C to abort...\n\n"); if (activationticket.Checked == true && Interface.CopyValue("ActivationState") == "Unactivated") { #region Get Wildcard Ticket string response = null; if (IsConnected() == false) { lblStatus.Text = "No Internet connection available"; return; } lblStatus.Text = "Getting Wildcard ticket from Apple"; ThreadStart starter = delegate { SslTcpClient.RunClient("albert.apple.com", Albert_Apple_Stuff(null), ref response); }; Thread albertThread = new Thread(starter); albertThread.Start(); while (albertThread.IsAlive == true) { Application.DoEvents(); } if (response == "") { lblStatus.Text = "No response returned from Apple"; return; } #endregion #region Grab necessary information lblStatus.Text = "Grabbing information from the Wildcard ticket"; string[] keys = { "AccountTokenCertificate", "AccountToken", "FairPlayKeyData", "DeviceCertificate", "AccountTokenSignature" }; IntPtr[] values = GrabTheData(response); #endregion activationticket: Save.Filter = "Activation Ticket|*.iTicket"; Save.DefaultExt = "iTicket"; Save.ShowDialog(); if (Save.FileName == "") { MessageBox.Show("Please select a location!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); goto activationticket; } File.WriteAllText(Save.FileName, new CFDictionary(keys, values).ToString()); lblStatus.Text = "Activation Ticket saved"; Save.FileName = ""; } else if (activationdata.Checked == true) { activationdata: try { Save.Filter = "Activation Data|*.iData"; Save.DefaultExt = "iData"; Save.ShowDialog(); if (Save.FileName == "") { MessageBox.Show("Please select a location!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); goto activationdata; } File.WriteAllText(Save.FileName, new CFDictionary(Interface.CopyDictionary("ActivationInfo")).ToString()); lblStatus.Text = "Activation Data Saved"; Save.FileName = ""; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } } else if (activationticket.Checked == true && Interface.CopyValue("ActivationState") != "Unactivated") { lblStatus.Text = "Deactivate device to cache Activation Ticket"; } else { lblStatus.Text = "No cache option selected"; } activate_btn.Enabled = true; deactivate_btn.Enabled = true; cache_btn.Enabled = true; grpCache.Enabled = true; }
internal static AFCError openPhoto(Photo photo, string photoPath, iDevice device, FileOpenMode openMode, out IntPtr afcClient, out ulong fileHandle) { fileHandle = 0; AFCError returnCode = afc_client_start_service(device.handle, out afcClient, "iOSLib"); if (returnCode != AFCError.AFC_E_SUCCESS) { return returnCode; } if ((returnCode = afc_file_open(afcClient, photoPath + photo.getName(), openMode, out fileHandle)) != AFCError.AFC_E_SUCCESS) { afc_client_free(afcClient); } return returnCode; }
static void Main(string[] args) { Console.WriteLine("CFManzana by iSn0wra1n"); iDevice dev = new iDevice(); /* Reads various device settings. Values can be * * ActivationPublicKey * ActivationState * ActivationStateAcknowledged * ActivityURL * BasebandBootloaderVersion * BasebandSerialNumber * BasebandStatus * BasebandVersion * BluetoothAddress * BuildVersion * CPUArchitecture * DeviceCertificate * DeviceClass * DeviceColor * DeviceName * DevicePublicKey * DieID * FirmwareVersion * HardwareModel * HardwarePlatform * HostAttached * IMLockdownEverRegisteredKey * IntegratedCircuitCardIdentity * InternationalMobileEquipmentIdentity * InternationalMobileSubscriberIdentity * iTunesHasConnected * MLBSerialNumber * MobileSubscriberCountryCode * MobileSubscriberNetworkCode * ModelNumber * PartitionType * PasswordProtected * PhoneNumber * ProductionSOC * ProductType * ProductVersion * ProtocolVersion * ProximitySensorCalibration * RegionInfo * SBLockdownEverRegisteredKey * SerialNumber * SIMStatus * SoftwareBehavior * SoftwareBundleVersion * SupportedDeviceFamilies * TelephonyCapability * TimeIntervalSince1970 * TimeZone * TimeZoneOffsetFromUTC * TrustedHostAttached * UniqueChipID * UniqueDeviceID * UseActivityURL * UseRaptorCerts * Uses24HourClock * WeDelivered * WiFiAddress * */ Console.WriteLine("\nDevice Name: " + dev.CopyValue("DeviceName")); Console.WriteLine("Device iOS Version: " + dev.CopyValue("ProductVersion")); System.Threading.Thread.Sleep(-1); }
internal static List<Photo> readPhotoList(string photosSqlitePath, iDevice device) { SQLiteConnection sqlConnection = new SQLiteConnection(@"Data Source=" + photosSqlitePath + ";Version=3;New=False;"); sqlConnection.Open(); // Get name of photos and albums associative table. int firstNumber = 0; int secondNumber = 0; DataRowCollection tableRows = sqlConnection.GetSchema("Columns").Rows; foreach (DataRow currTable in tableRows) { Regex regEx = new Regex("Z_([0-9]{1,2})ASSETS"); string tableName = currTable.ItemArray[2].ToString(); if (regEx.IsMatch(tableName)) { firstNumber = Convert.ToInt32(regEx.Match(tableName).Groups[1].ToString()); string columnName = currTable.ItemArray[3].ToString(); regEx = new Regex("Z_([0-9]{1,2})ASSETS"); if (regEx.IsMatch(columnName)) { secondNumber = Convert.ToInt32(regEx.Match(columnName).Groups[1].ToString()); } } } device.Photos.setAlbumToAssetTableNames(firstNumber, secondNumber); // Get list and basic properties of photos. SQLiteDataReader photoGenericReader = makeRequest(sqlConnection, @"SELECT *, cast(ZDATECREATED as string) AS DATECREATED, cast(ZMODIFICATIONDATE as string) AS MODIFICATIONDATE FROM ZGENERICASSET"); List<Photo> photoList = new List<Photo>(); while (photoGenericReader.Read()) { string name = photoGenericReader["ZFILENAME"].ToString(); if (name != "") { // Id, name, extension, media type, filetype, path, creation time, modification time Regex nameRegex = new Regex(@"(.*)\.(.*)"); GroupCollection regexGroups = nameRegex.Match(name).Groups; name = regexGroups[1].ToString(); string extension = regexGroups[2].ToString(); int id = Convert.ToInt32(photoGenericReader["Z_PK"]); string mediaType = Convert.ToInt16(photoGenericReader["ZKIND"]) == 0 ? "Photo" : "Video"; string fileType = photoGenericReader["ZUNIFORMTYPEIDENTIFIER"].ToString(); string path = photoGenericReader["ZDIRECTORY"].ToString(); double creationTimeSeconds = Convert.ToDouble(photoGenericReader["DATECREATED"]); DateTime creationTime = new DateTime(2001, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); creationTime = creationTime.AddSeconds(creationTimeSeconds).ToLocalTime(); double modificationTimeSeconds = Convert.ToDouble(photoGenericReader["MODIFICATIONDATE"]); DateTime modificationTime = new DateTime(2001, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); modificationTime = modificationTime.AddSeconds(modificationTimeSeconds).ToLocalTime(); // File size int size = 0; string additionalId = photoGenericReader["ZADDITIONALATTRIBUTES"].ToString(); if (additionalId != "") { SQLiteDataReader photoAdditionalReader = makeRequest(sqlConnection, @"SELECT ZORIGINALFILESIZE FROM ZADDITIONALASSETATTRIBUTES WHERE Z_PK = " + additionalId); photoAdditionalReader.Read(); size = Convert.ToInt32(photoAdditionalReader["ZORIGINALFILESIZE"]); photoAdditionalReader.Close(); } // Album id and name List<Album> albumList = new List<Album>(); int albumId = 0; string albumName = ""; string albumKeyName = device.Photos.albumKeyName; SQLiteDataReader photoAlbumReader = makeRequest(sqlConnection, @"SELECT " + albumKeyName + " FROM " + device.Photos.assetTableName + " WHERE " + device.Photos.assetKeyName + " = " + id); while (photoAlbumReader.Read()) { albumId = Convert.ToInt32(photoAlbumReader[albumKeyName]); SQLiteDataReader albumTableReader = makeRequest(sqlConnection, @"SELECT ZTITLE FROM ZGENERICALBUM WHERE Z_PK = " + albumId); if (albumTableReader.Read()) { albumName = albumTableReader["ZTITLE"].ToString(); } albumList.Add(new Album(albumId, albumName)); albumTableReader.Close(); } photoAlbumReader.Close(); photoList.Add(new Photo(device.Photos, id, Convert.ToInt32(additionalId), name, extension, mediaType, fileType, device, path, size, creationTimeSeconds, creationTime, modificationTimeSeconds, modificationTime, albumList)); } } photoGenericReader.Close(); sqlConnection.Close(); return photoList; }
internal static List <Photo> readPhotoList(string photosSqlitePath, iDevice device) { SQLiteConnection sqlConnection = new SQLiteConnection(@"Data Source=" + photosSqlitePath + ";Version=3;New=False;"); sqlConnection.Open(); // Get name of photos and albums associative table. int firstNumber = 0; int secondNumber = 0; DataRowCollection tableRows = sqlConnection.GetSchema("Columns").Rows; foreach (DataRow currTable in tableRows) { Regex regEx = new Regex("Z_([0-9]{1,2})ASSETS"); string tableName = currTable.ItemArray[2].ToString(); if (regEx.IsMatch(tableName)) { firstNumber = Convert.ToInt32(regEx.Match(tableName).Groups[1].ToString()); string columnName = currTable.ItemArray[3].ToString(); regEx = new Regex("Z_([0-9]{1,2})ASSETS"); if (regEx.IsMatch(columnName)) { secondNumber = Convert.ToInt32(regEx.Match(columnName).Groups[1].ToString()); } } } device.Photos.setAlbumToAssetTableNames(firstNumber, secondNumber); // Get list and basic properties of photos. SQLiteDataReader photoGenericReader = makeRequest(sqlConnection, @"SELECT *, cast(ZDATECREATED as string) AS DATECREATED, cast(ZMODIFICATIONDATE as string) AS MODIFICATIONDATE FROM ZGENERICASSET"); List <Photo> photoList = new List <Photo>(); while (photoGenericReader.Read()) { string name = photoGenericReader["ZFILENAME"].ToString(); if (name != "") { // Id, name, extension, media type, filetype, path, creation time, modification time Regex nameRegex = new Regex(@"(.*)\.(.*)"); GroupCollection regexGroups = nameRegex.Match(name).Groups; name = regexGroups[1].ToString(); string extension = regexGroups[2].ToString(); int id = Convert.ToInt32(photoGenericReader["Z_PK"]); string mediaType = Convert.ToInt16(photoGenericReader["ZKIND"]) == 0 ? "Photo" : "Video"; string fileType = photoGenericReader["ZUNIFORMTYPEIDENTIFIER"].ToString(); string path = photoGenericReader["ZDIRECTORY"].ToString(); double creationTimeSeconds = Convert.ToDouble(photoGenericReader["DATECREATED"]); DateTime creationTime = new DateTime(2001, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); creationTime = creationTime.AddSeconds(creationTimeSeconds).ToLocalTime(); double modificationTimeSeconds = Convert.ToDouble(photoGenericReader["MODIFICATIONDATE"]); DateTime modificationTime = new DateTime(2001, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); modificationTime = modificationTime.AddSeconds(modificationTimeSeconds).ToLocalTime(); // File size int size = 0; string additionalId = photoGenericReader["ZADDITIONALATTRIBUTES"].ToString(); if (additionalId != "") { SQLiteDataReader photoAdditionalReader = makeRequest(sqlConnection, @"SELECT ZORIGINALFILESIZE FROM ZADDITIONALASSETATTRIBUTES WHERE Z_PK = " + additionalId); photoAdditionalReader.Read(); size = Convert.ToInt32(photoAdditionalReader["ZORIGINALFILESIZE"]); photoAdditionalReader.Close(); } // Album id and name List <Album> albumList = new List <Album>(); int albumId = 0; string albumName = ""; string albumKeyName = device.Photos.albumKeyName; SQLiteDataReader photoAlbumReader = makeRequest(sqlConnection, @"SELECT " + albumKeyName + " FROM " + device.Photos.assetTableName + " WHERE " + device.Photos.assetKeyName + " = " + id); while (photoAlbumReader.Read()) { albumId = Convert.ToInt32(photoAlbumReader[albumKeyName]); SQLiteDataReader albumTableReader = makeRequest(sqlConnection, @"SELECT ZTITLE FROM ZGENERICALBUM WHERE Z_PK = " + albumId); if (albumTableReader.Read()) { albumName = albumTableReader["ZTITLE"].ToString(); } albumList.Add(new Album(albumId, albumName)); albumTableReader.Close(); } photoAlbumReader.Close(); photoList.Add(new Photo(device.Photos, id, Convert.ToInt32(additionalId), name, extension, mediaType, fileType, device, path, size, creationTimeSeconds, creationTime, modificationTimeSeconds, modificationTime, albumList)); } } photoGenericReader.Close(); sqlConnection.Close(); return(photoList); }
internal static void SentCheat(AliParameter aliParameter3, AliParameter aliParameter2, AliParameter aliParameter, iDevice iDevice, commandResult cmdResult, string ip, string port) { Http http = new Http(); http.UnlockComponent("VTMCMH.CB10917_4Vc9gp5C55lc"); http.SocksHostname = ip; http.SocksPort = Convert.ToInt32(port); http.SocksVersion = 5; HttpRequest req1 = new HttpRequest(); req1.HttpVerb = "POST"; req1.SendCharset = false; req1.AddHeader("content-type", "application/x-www-form-urlencoded"); req1.AddHeader("accept-language", iDevice.language + "-" + iDevice.countryCode + ";q=1"); req1.AddHeader("user-agent", iDevice.GetAliUserAgent()); req1.LoadBodyFromString("_aop_nonce=BE6EBD8F-FD9D-4A3F-9E04-7EAB9E19AC08&_aop_signature=2DAE2B7AA159A2195303144DB3657156A0958562&_currency=USD&_lang=en_US&activateTime=2147483647&adId=C1AE31EA-8152-4F76-8F4E-EC4941F19E2C&carrier=SLO%20Cellular%20Inc%20%2F%20Cellular%20One%20of%20San%20Luis&clientName=AliExpress&clientVersion=5.1.6&country=US&deviceId=WH8xrU03%2B2oDAIflU2kgOQWR&deviceMode=iPhone&language=en&lat=1&lifecycle=setting&localtime=2017-01-18%2001%3A13%3A22&osName=iPhone%20OS&osVersion=8.0.1&timezone=America%2FLos_Angeles", "utf-8"); req1.Path = "/openapi/param2/101/aliexpress.mobile/deviceInfo/8495"; http.FollowRedirects = true; HttpResponse httpResponse1 = http.SynchronousRequest("api.aliexpress.com", 443, true, req1); if (httpResponse1 == null) { Console.WriteLine(http.LastErrorText); } else { string bodyStr1 = httpResponse1.BodyStr; } HttpRequest req2 = new HttpRequest(); req2.HttpVerb = "POST"; req2.SendCharset = false; req2.AddHeader("content-type", "application/x-www-form-urlencoded"); req2.AddHeader("accept-language", iDevice.language + "-" + iDevice.countryCode + ";q=1"); req2.AddHeader("User-Agent", iDevice.GetAliUserAgent()); req2.LoadBodyFromString("_aop_nonce=82B91EAC-E831-4772-9201-123E3C42F2F1&_aop_signature=7D89B30AB19F226A8910864B82FE323FBEA650CD&_currency=USD&_lang=en_US&activateTime=1500884105356&adid=F813A1B4-FC96-4775-A71F-333EAB0EB930&afCounter=1&afUid=B0733E4D-5D89-40-05635&carrier=Cambridge%20Telephone%20Company%20Inc.&clientName=AliExpress&clientVersion=5.3.1&country=US&deviceId=WXWsg40QVRIDAAMDdWRD69Yt&deviceMode=iPhone&language=en&lat=1&lifecycle=active&localtime=2017-07-24%2002%3A15%3A05&osName=iPhone%20OS&osVersion=9.3.2&referrer=utmContent%253DC1FBD82B-1967-42ED-9D5A-C43CD40B51DE&timezone=America/Denver&umidToken=WXWsg40QVRIDAAMDdWRD69Yt", "utf-8"); req2.Path = "/openapi/param2/101/aliexpress.mobile/deviceInfo/8495"; http.FollowRedirects = true; HttpResponse httpResponse2 = http.SynchronousRequest("api.aliexpress.com", 443, true, req2); if (httpResponse2 == null) { Console.WriteLine(http.LastErrorText); } else { string bodyStr2 = httpResponse2.BodyStr; } }
private void activate_btn_Click(object sender, EventArgs e) { if (Interface.Device == null) { Interface = new iDevice(); } if (Interface.Device == null) { lblStatus.Text = "No device connected"; return; } if (Interface.CopyValue("ActivationState") != "Unactivated") { lblStatus.Text = "Device already Activated!"; return; } grpCache.Enabled = false; activate_btn.Enabled = false; deactivate_btn.Enabled = false; cache_btn.Enabled = false; string response = null; lblStatus.Text = ""; bool useCache = false; if (activationdata.Checked == true) { opendialog: Open.DefaultExt = "iData"; Open.Filter = "Activation Data|*.iData"; Open.ShowDialog(); if (Open.FileName == "") { MessageBox.Show("Please select a location!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); goto opendialog; } useCache = true; } #region Step 1: Get Wildcard ticket if (IsConnected() == false) { lblStatus.Text = "No Internet connection available"; goto Cleanup; } lblStatus.Text = "Getting Wildcard ticket from Apple"; if (useCache == true) { ThreadStart starter = delegate { SslTcpClient.RunClient("albert.apple.com", Albert_Apple_Stuff(Open.FileName), ref response); }; Thread albertThread = new Thread(starter); albertThread.Start(); while (albertThread.IsAlive == true) { Application.DoEvents(); } } else { ThreadStart starter = delegate { SslTcpClient.RunClient("albert.apple.com", Albert_Apple_Stuff(null), ref response); }; Thread albertThread = new Thread(starter); albertThread.Start(); while (albertThread.IsAlive == true) { Application.DoEvents(); } } if (response.Contains("ack-received") == true) { lblStatus.Text = "Invalid response received from Apple"; goto Cleanup; } if (response == "" || response == null) { lblStatus.Text = "No response returned from Apple"; goto Cleanup; } #endregion #region Step 2: Grab necessary information from Wildcard ticket lblStatus.Text = "Grabbing information from the Wildcard ticket"; IntPtr[] wct = GrabTheData(response); #endregion #region Step 3: Send Wildcard ticket to the iDevice string[] keys = { "AccountTokenCertificate", "AccountToken", "FairPlayKeyData", "DeviceCertificate", "AccountTokenSignature" }; lblStatus.Text = ("Sending Wildcard ticket to device"); int status = Interface.Activate(new CFDictionary(keys, wct)); lblStatus.Text = ("Wildcard ticket sent to device"); #endregion #region Step 4: Check if activation was successful if (status != 0) { lblStatus.Text = "Device could not be activated!"; } else { lblStatus.Text = "Device successfully activated!"; } #endregion Cleanup: activate_btn.Enabled = true; deactivate_btn.Enabled = true; cache_btn.Enabled = true; grpCache.Enabled = true; Open.FileName = ""; }