Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Drawing;
- using System.IO;
- using System.Runtime.CompilerServices;
- using System.Threading;
- using System.Windows.Forms;
- using iTips.Ref;
- using Microsoft.VisualBasic;
- namespace iTips
- {
- // Token: 0x02000006 RID: 6
- [NullableContext(1)]
- [Nullable(0)]
- public class Form1 : Form
- {
- // Token: 0x06000007 RID: 7 RVA: 0x000020FC File Offset: 0x000002FC
- public Form1()
- {
- this.InitializeComponent();
- this.button2.Hide();
- this.APP_UUID();
- }
- // Token: 0x06000008 RID: 8 RVA: 0x00002148 File Offset: 0x00000348
- private void APP_UUID()
- {
- this.label3.TextAlign = 32;
- string myuuidAsString = Guid.NewGuid().ToString().ToUpper();
- this.label3.Text = "APP_UUID: " + myuuidAsString;
- }
- // Token: 0x06000009 RID: 9 RVA: 0x00002194 File Offset: 0x00000394
- private void CommonConnectDevice(object sender, DeviceCommonConnectEventArgs args)
- {
- bool flag = args.Message == ConnectNotificationMessage.Connected;
- if (flag)
- {
- this.currentiOSDevice = args.Device;
- base.Invoke(delegate()
- {
- this.button2.Show();
- this.label2.Text = string.Concat(new string[]
- {
- " Device Connected: ",
- this.currentiOSDevice.ProductType,
- " iOS ",
- this.currentiOSDevice.ProductVersion,
- "\n\n IMEI: ",
- this.currentiOSDevice.InternationalMobileEquipmentIdentity,
- " MEID: ",
- this.currentiOSDevice.MobileEquipmentIdentifier,
- "\n\n UDID: ",
- this.currentiOSDevice.UniqueDeviceID,
- " SN: ",
- this.currentiOSDevice.SerialNumber,
- "\n\n\n"
- });
- bool flag3 = this.currentiOSDevice.ActivationState == "Activated";
- if (flag3)
- {
- }
- this.UDID = this.currentiOSDevice.UniqueDeviceID;
- });
- }
- else
- {
- bool flag2 = args.Message == ConnectNotificationMessage.Disconnected;
- if (flag2)
- {
- base.Invoke(delegate()
- {
- this.button2.Hide();
- this.label2.Text = "There is not Device Connected";
- this.UDID = null;
- });
- }
- }
- }
- // Token: 0x0600000A RID: 10 RVA: 0x000021F4 File Offset: 0x000003F4
- private void RecoveryConnectDevice(object sender, DeviceRecoveryConnectEventArgs args)
- {
- bool flag = args.Message == ConnectNotificationMessage.Connected;
- if (flag)
- {
- base.Invoke(delegate()
- {
- });
- }
- bool flag2 = args.Message == ConnectNotificationMessage.Disconnected;
- if (flag2)
- {
- base.Invoke(delegate()
- {
- });
- }
- }
- // Token: 0x0600000B RID: 11 RVA: 0x0000226C File Offset: 0x0000046C
- private void ListenError(object sender, ListenErrorEventHandlerEventArgs args)
- {
- bool flag = args.ErrorType == ListenErrorEventType.StartListen;
- if (flag)
- {
- this.Error(args.ErrorMessage);
- throw new Exception(args.ErrorMessage);
- }
- }
- // Token: 0x0600000C RID: 12 RVA: 0x000022A1 File Offset: 0x000004A1
- private void Error(string msg)
- {
- this.AppendLine(" [ERROR] {0}", Color.FromArgb(182, 29, 28), new object[]
- {
- msg
- });
- }
- // Token: 0x0600000D RID: 13 RVA: 0x000022C8 File Offset: 0x000004C8
- private void AppendLine(string format, Color foreground, params object[] args)
- {
- base.Invoke(delegate()
- {
- this.AppendLine(format, foreground, args);
- });
- string text = string.Format(format, args);
- }
- // Token: 0x0600000E RID: 14 RVA: 0x0000231D File Offset: 0x0000051D
- private void label1_Click(object sender, EventArgs e)
- {
- }
- // Token: 0x0600000F RID: 15 RVA: 0x00002320 File Offset: 0x00000520
- private void label2_Click(object sender, EventArgs e)
- {
- }
- // Token: 0x06000010 RID: 16 RVA: 0x00002324 File Offset: 0x00000524
- private void Form1_Load(object sender, EventArgs e)
- {
- DropShadow dropShadow = new DropShadow();
- dropShadow.ApplyShadows(this);
- this.DoubleBuffered = true;
- this.manager.CommonConnectEvent += this.CommonConnectDevice;
- this.manager.RecoveryConnectEvent += this.RecoveryConnectDevice;
- this.manager.ListenErrorEvent += new EventHandler<ListenErrorEventHandlerEventArgs>(this.ListenError);
- new Thread(new ThreadStart(this.manager.StartListen))
- {
- IsBackground = true
- }.Start();
- }
- // Token: 0x06000011 RID: 17 RVA: 0x000023B8 File Offset: 0x000005B8
- public void Start()
- {
- string libPath = "lib";
- string udidFilePath = Path.Combine(libPath, "udid.txt");
- string restoreLogPath = Path.Combine(libPath, "restore_log.txt");
- int udidExitCode = Form1.RunCommand(Path.Combine(libPath, "ideviceinfo.exe"), "-k UniqueDeviceID", udidFilePath);
- bool flag = !File.Exists(udidFilePath) || new FileInfo(udidFilePath).Length == 0L;
- if (flag)
- {
- this.button2.Text = "Failed!";
- Form1.ShowErrorMsg("Error", "UDID file not found or empty.");
- }
- else
- {
- string udidContent = File.ReadAllText(udidFilePath);
- bool flag2 = udidContent.IndexOf("ERROR", 5) >= 0;
- if (flag2)
- {
- this.button2.Text = "Failed!";
- Form1.ShowErrorMsg("Error", udidContent);
- }
- else
- {
- string uuid = udidContent.Trim();
- bool flag3 = string.IsNullOrEmpty(uuid);
- if (flag3)
- {
- this.button2.Text = "Failed!";
- Form1.ShowErrorMsg("UDID Empty", udidContent);
- }
- else
- {
- string args = "restore -u " + uuid + " -s a50b5348f06d8c6528556309344370375eadb495 --system --reboot --settings lib";
- int restoreExitCode = Form1.RunCommand(Path.Combine(libPath, "idevicebackup2.exe"), args, restoreLogPath);
- string restoreLog = File.Exists(restoreLogPath) ? File.ReadAllText(restoreLogPath) : "";
- bool flag4 = restoreLog.IndexOf("ERROR", 5) >= 0;
- if (flag4)
- {
- this.button2.Text = "Failed!";
- Form1.ShowErrorMsg("Restore Error", restoreLog);
- }
- else
- {
- this.button2.Text = "SUCCESSFULLY!";
- Form1.ShowSuccessMsg("Successfully!");
- }
- }
- }
- }
- }
- // Token: 0x06000012 RID: 18 RVA: 0x00002558 File Offset: 0x00000758
- private static int RunCommand(string exePath, string arguments, string outputFilePath)
- {
- int result;
- try
- {
- using (Process process = new Process())
- {
- process.StartInfo.FileName = exePath;
- process.StartInfo.Arguments = arguments;
- process.StartInfo.RedirectStandardOutput = true;
- process.StartInfo.RedirectStandardError = true;
- process.StartInfo.UseShellExecute = false;
- process.StartInfo.CreateNoWindow = true;
- using (StreamWriter outputStream = new StreamWriter(outputFilePath, false))
- {
- process.OutputDataReceived += delegate(object sender, DataReceivedEventArgs args)
- {
- bool flag = args.Data != null;
- if (flag)
- {
- outputStream.WriteLine(args.Data);
- }
- };
- process.ErrorDataReceived += delegate(object sender, DataReceivedEventArgs args)
- {
- bool flag = args.Data != null;
- if (flag)
- {
- outputStream.WriteLine(args.Data);
- }
- };
- process.Start();
- process.BeginOutputReadLine();
- process.BeginErrorReadLine();
- process.WaitForExit();
- result = process.ExitCode;
- }
- }
- }
- catch (Exception ex)
- {
- File.WriteAllText(outputFilePath, "ERROR: " + ex.Message);
- result = -1;
- }
- return result;
- }
- // Token: 0x06000013 RID: 19 RVA: 0x00002684 File Offset: 0x00000884
- private static void ShowErrorMsg(string title, string message)
- {
- bool flag = message.Length > 1000;
- if (flag)
- {
- message = message.Substring(0, 1000) + "...";
- }
- Interaction.MsgBox(message, 16, title);
- }
- // Token: 0x06000014 RID: 20 RVA: 0x000026C7 File Offset: 0x000008C7
- private static void ShowSuccessMsg(string message)
- {
- Interaction.MsgBox(message, 64, "Info");
- }
- // Token: 0x06000015 RID: 21 RVA: 0x000026D8 File Offset: 0x000008D8
- private void button2_Click(object sender, EventArgs e)
- {
- this.button2.Text = "Processing...";
- this.button2.Enabled = false;
- Thread.Sleep(5000);
- this.Start();
- }
- // Token: 0x06000016 RID: 22 RVA: 0x0000270C File Offset: 0x0000090C
- protected override void Dispose(bool disposing)
- {
- bool flag = disposing && this.components != null;
- if (flag)
- {
- this.components.Dispose();
- }
- base.Dispose(disposing);
- }
- // Token: 0x06000017 RID: 23 RVA: 0x00002744 File Offset: 0x00000944
- private void InitializeComponent()
- {
- ComponentResourceManager resources = new ComponentResourceManager(typeof(Form1));
- this.button1 = new Button();
- this.label1 = new Label();
- this.label2 = new Label();
- this.label3 = new Label();
- this.button2 = new Button();
- base.SuspendLayout();
- this.button1.Location = new Point(123, 175);
- this.button1.Name = "button1";
- this.button1.Size = new Size(213, 37);
- this.button1.TabIndex = 0;
- this.button1.Text = "button1";
- this.button1.UseVisualStyleBackColor = true;
- this.label1.AutoSize = true;
- this.label1.Font = new Font("Segoe UI", 9.75f, 0, 3);
- this.label1.Location = new Point(74, 28);
- this.label1.Name = "label1";
- this.label1.Size = new Size(72, 17);
- this.label1.TabIndex = 1;
- this.label1.Text = "APP_UUID: ";
- this.label1.TextAlign = 32;
- this.label1.Click += new EventHandler(this.label1_Click);
- this.label2.Dock = 5;
- this.label2.Font = new Font("Segoe UI", 9.75f, 0, 3);
- this.label2.Location = new Point(0, 0);
- this.label2.Name = "label2";
- this.label2.Size = new Size(533, 236);
- this.label2.TabIndex = 2;
- this.label2.Text = "There is not Device Connected";
- this.label2.TextAlign = 32;
- this.label2.Click += new EventHandler(this.label2_Click);
- this.label3.AutoSize = true;
- this.label3.Font = new Font("Segoe UI", 9.75f, 0, 3);
- this.label3.Location = new Point(104, 11);
- this.label3.Name = "label3";
- this.label3.Size = new Size(72, 17);
- this.label3.TabIndex = 3;
- this.label3.Text = "APP_UUID: ";
- this.button2.Cursor = Cursors.Hand;
- this.button2.Location = new Point(140, 161);
- this.button2.Name = "button2";
- this.button2.Size = new Size(259, 23);
- this.button2.TabIndex = 6;
- this.button2.Text = "Start Blocking";
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new EventHandler(this.button2_Click);
- base.AutoScaleDimensions = new SizeF(7f, 15f);
- base.AutoScaleMode = 1;
- base.ClientSize = new Size(533, 236);
- base.Controls.Add(this.button2);
- base.Controls.Add(this.label3);
- base.Controls.Add(this.label2);
- base.Controls.Add(this.label1);
- base.Controls.Add(this.button1);
- base.FormBorderStyle = 2;
- base.Icon = (Icon)resources.GetObject("$this.Icon");
- base.MaximizeBox = false;
- base.Name = "Form1";
- this.Text = "iTips Helper | made with \ud83d\udc96 from @christianmuhi7";
- base.Load += new EventHandler(this.Form1_Load);
- base.ResumeLayout(false);
- base.PerformLayout();
- }
- // Token: 0x04000004 RID: 4
- private iOSDevice currentiOSDevice;
- // Token: 0x04000005 RID: 5
- private string UDID = "";
- // Token: 0x04000006 RID: 6
- private iOSDeviceManager manager = new iOSDeviceManager();
- // Token: 0x04000007 RID: 7
- [Nullable(0)]
- private IContainer components = null;
- // Token: 0x04000008 RID: 8
- [Nullable(0)]
- private Button button1;
- // Token: 0x04000009 RID: 9
- [Nullable(0)]
- private Label label1;
- // Token: 0x0400000A RID: 10
- [Nullable(0)]
- private Label label2;
- // Token: 0x0400000B RID: 11
- [Nullable(0)]
- private Label label3;
- // Token: 0x0400000C RID: 12
- [Nullable(0)]
- private Button button2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment