Super One Click ကုိဘယ္လုိေရးထားသလဲ ? ? ?

on Tuesday, June 25, 2013
Super One Click ဆုိတာ ကေတာ့ ဟုိးအရင္ကနာမည္ၾကီး Root Tool တစ္ခုျဖစ္ပါတယ္။

Low level User ေတြေကာ Advance User (Technical) မ်ားပါလြယ္လြယ္ကူကူညီသုံးႏုိင္ေအာင္

Developer မ်ားကေရးသားေပးခဲ့တာျဖစ္ပါတယ္။

.Net Module နဲ႕ေရးသားထားတာျဖစ္ပါတယ္။

ဒီ Tool ေလးရဲ႕ Coding ပုိင္းကလဲ အားရစရာပါပဲ

Form.cs ဆုိတာေလးရဲ႕ Coding ပုိင္းကုိပဲတင္ေပးလုိက္ပါတယ္။

Download Here 



http://www.mediafire.com/?jyg1v9gp8b49w11

namespace SuperOneClick
{
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.IO;
    using System.Management;
    using System.Text;
    using System.Threading;
    using System.Windows.Forms;

    public class Form1 : Form
    {
        private Button btnCaptivateUnlockCode;
        private Button btnNMA;
        private Button btnRoot;
        private Button btnUnroot;
        private Button button2;
        private Button button3;
        private IContainer components;
        private Process console;
        private string exploitFile = "psneuter";
        private GroupBox groupBox1;
        private Hashtable properties = new Hashtable();
        private RadioButton radioButton1;
        private RadioButton radioButton2;
        private ProcessStartInfo si;
        private SplitContainer splitContainer1;
        private TabControl tabControl1;
        private TabPage tabPage1;
        private TabPage tabPage2;
        private TextBox textBox1;

        public Form1()
        {
            this.InitializeComponent();
            this.initializeProcess();
        }

        private void btnCaptivateUnlockCode_Click(object sender, EventArgs e)
        {
            this.tabControl1.Enabled = false;
            this.textBox1.Text = "SuperOneClick v" + Application.ProductVersion.ToString() + Environment.NewLine;
            try
            {
                this.runOperationUI("Killing ADB Server...", "kill-server");
                this.runOperationUI("Starting ADB Server...", "start-server");
                this.runOperationUI("Waiting for device...", "wait-for-device");
                this.runOperationUI("Preparing to copy nv_data.bin to sd...", "shell \"rm /sdcard/nv_data.bin\"");
                this.runOperationUI("Copying nv_data.bin to sd...", "shell \"cat /efs/nv_data.bin > /sdcard/nv_data.bin\"");
                this.runOperationUI("Pulling nv_data.bin...", "pull /sdcard/nv_data.bin");
                this.textBox1.Text = this.textBox1.Text + "Reading nv_data.bin..." + Environment.NewLine;
                FileStream stream = File.OpenRead(AppDomain.CurrentDomain.BaseDirectory + "nv_data.bin");
                stream.Seek(0x18146eL, SeekOrigin.Begin);
                byte[] buffer = new byte[8];
                stream.Read(buffer, 0, buffer.Length);
                stream.Close();
                string str = Encoding.ASCII.GetString(buffer);
                if (str == "FFFFFFFF")
                {
                    throw new Exception("Unlock code: FFFFFFFF");
                }
                this.textBox1.Text = this.textBox1.Text + "Unlock Code: " + str + Environment.NewLine;
                this.textBox1.Text = this.textBox1.Text + "OK" + Environment.NewLine;
                this.textBox1.SelectionStart = this.textBox1.TextLength;
                this.textBox1.ScrollToCaret();
            }
            catch (Exception exception)
            {
                this.textBox1.Text = this.textBox1.Text + exception.Message + Environment.NewLine;
                this.textBox1.Text = this.textBox1.Text + "FAILED" + Environment.NewLine;
                this.textBox1.SelectionStart = this.textBox1.TextLength;
                this.textBox1.ScrollToCaret();
            }
            this.tabControl1.Enabled = true;
        }

        private void btnNMA_Click(object sender, EventArgs e)
        {
            this.tabControl1.Enabled = false;
            try
            {
                this.textBox1.Text = "SuperOneClick v" + Application.ProductVersion.ToString() + Environment.NewLine;
                this.textBox1.Text = this.textBox1.Text + "***Requires root permission! Watch your phone to allow Superuser commmands***" + Environment.NewLine;
                this.runOperationUI("Killing ADB Server...", "kill-server");
                this.runOperationUI("Starting ADB Server...", "start-server");
                this.runOperationUI("Waiting for device...", "wait-for-device");
                bool flag = false;
                try
                {
                    this.runShellCommandUI("Checking for sqlite3", "sqlite3 . .quit;");
                    flag = false;
                }
                catch
                {
                    this.runOperationUI("Pushing sqlite3...", "-d push \"" + AppDomain.CurrentDomain.BaseDirectory + "sqlite3\" /data/local/tmp/sqlite3");
                    this.runShellCommandUI("chmod sqlite3...", "chmod 0755 /data/local/tmp/sqlite3");
                    flag = true;
                }
                this.textBox1.Text = this.textBox1.Text + "Getting settings.db location..." + Environment.NewLine;
                this.textBox1.SelectionStart = this.textBox1.TextLength;
                this.textBox1.ScrollToCaret();
                Application.DoEvents();
                string str = "/data/data/com.android.providers.settings/databases/settings.db";
                if (this.runShellCommand("ls " + str).Contains("No such file or directory"))
                {
                    str = "/dbdata/databases/com.android.providers.settings/settings.db";
                    if (this.runShellCommand("ls " + str).Contains("No such file or directory"))
                    {
                        try
                        {
                            this.runShellCommandUI("Checking for busybox", "busybox true");
                        }
                        catch
                        {
                            this.runOperationUI("Pushing busybox...", "-d push \"" + AppDomain.CurrentDomain.BaseDirectory + "busybox\" /data/local/tmp/busybox");
                            this.runShellCommandUI("chmod busybox...", "chmod 0755 /data/local/tmp/busybox");
                        }
                        str = this.getSettingsLocation();
                    }
                }
                this.textBox1.Text = this.textBox1.Text + str + Environment.NewLine;
                this.textBox1.Text = this.textBox1.Text + "OK" + Environment.NewLine;
                this.textBox1.Text = this.textBox1.Text + Environment.NewLine;
                this.textBox1.Text = this.textBox1.Text + "Checking value... (requires root)" + Environment.NewLine;
                this.textBox1.SelectionStart = this.textBox1.TextLength;
                this.textBox1.ScrollToCaret();
                Application.DoEvents();
                if (this.runShellCommandWithSURoot((flag ? "/data/local/tmp/" : string.Empty) + "sqlite3 " + str + " \"select value from secure where name = 'install_non_market_apps';\" ").Trim() != "1")
                {
                    this.textBox1.Text = this.textBox1.Text + "Non-market applications are disabled." + Environment.NewLine;
                    this.textBox1.Text = this.textBox1.Text + Environment.NewLine;
                    this.textBox1.Text = this.textBox1.Text + "Allow non-market apps... (requires root)" + Environment.NewLine;
                    this.textBox1.SelectionStart = this.textBox1.TextLength;
                    this.textBox1.ScrollToCaret();
                    Application.DoEvents();
                    this.textBox1.Text = this.textBox1.Text + this.runShellCommandWithSURoot((flag ? "/data/local/tmp/" : string.Empty) + "sqlite3 " + str + " \"update secure set value = 1 where name = 'install_non_market_apps';\"");
                    this.textBox1.Text = this.textBox1.Text + "OK" + Environment.NewLine;
                    this.textBox1.Text = this.textBox1.Text + Environment.NewLine;
                    this.textBox1.Text = this.textBox1.Text + "Checking value... (requires root)" + Environment.NewLine;
                    this.textBox1.SelectionStart = this.textBox1.TextLength;
                    this.textBox1.ScrollToCaret();
                    Application.DoEvents();
                    string message = this.runShellCommandWithSURoot((flag ? "/data/local/tmp/" : string.Empty) + "sqlite3 " + str + " \"select value from secure where name = 'install_non_market_apps';\" ");
                    if (message.Trim() != "1")
                    {
                        throw new Exception(message);
                    }
                }
                this.textBox1.Text = this.textBox1.Text + "Non-market applications are enabled!" + Environment.NewLine;
                this.textBox1.Text = this.textBox1.Text + Environment.NewLine;
                this.textBox1.SelectionStart = this.textBox1.TextLength;
                this.textBox1.ScrollToCaret();
                MessageBox.Show("Non-market applications are enabled!");
            }
            catch (Exception exception)
            {
                this.textBox1.Text = this.textBox1.Text + exception.Message + Environment.NewLine;
                this.textBox1.Text = this.textBox1.Text + "FAILED" + Environment.NewLine;
                this.textBox1.SelectionStart = this.textBox1.TextLength;
                this.textBox1.ScrollToCaret();
            }
            this.tabControl1.Enabled = true;
        }

        private void btnRoot_Click(object sender, EventArgs e)
        {
            this.tabControl1.Enabled = false;
            this.textBox1.Text = "SuperOneClick v" + Application.ProductVersion.ToString() + Environment.NewLine;
            this.properties = new Hashtable();
            this.runOperationUI("Killing ADB Server...", "kill-server");
            this.runOperationUI("Starting ADB Server...", "start-server");
            this.runOperationUI("Waiting for device...", "wait-for-device");
            try
            {
                Version version;
                this.runOperationUI("Pushing " + this.exploitFile + "...", "-d push \"" + AppDomain.CurrentDomain.BaseDirectory + this.exploitFile + "\" /data/local/tmp/" + this.exploitFile);
                this.runOperationUI("chmod " + this.exploitFile + "...", "-d shell chmod 0755 /data/local/tmp/" + this.exploitFile);
                while (true)
                {
                    string text = this.textBox1.Text;
                    this.textBox1.Text = text + "Running " + this.exploitFile + "..." + Environment.NewLine;
                    this.textBox1.SelectionStart = this.textBox1.TextLength;
                    this.textBox1.Update();
                    this.textBox1.ScrollToCaret();
                    if (this.runExploit() == "ROOT")
                    {
                        this.textBox1.Text = this.textBox1.Text + "ROOTED" + Environment.NewLine;
                        this.textBox1.Text = this.textBox1.Text + Environment.NewLine;
                        break;
                    }
                    this.textBox1.Text = this.textBox1.Text + "OK" + Environment.NewLine;
                    this.textBox1.Text = this.textBox1.Text + Environment.NewLine;
                    this.textBox1.Text = this.textBox1.Text + "***IF IT KEEPS LOOPING, TRY DISABLING USB DEBUGGING NOW***" + Environment.NewLine;
                    this.textBox1.Text = this.textBox1.Text + Environment.NewLine;
                    this.runOperationUI("Killing ADB Server...", "kill-server");
                    this.runOperationUI("Starting ADB Server...", "start-server");
                    this.runOperationUI("Waiting for device...", "wait-for-device");
                }
                this.runOperationUI("Pushing busybox...", "-d push \"" + AppDomain.CurrentDomain.BaseDirectory + "busybox\" /data/local/tmp/busybox");
                this.runShellCommandUI("chmod busybox...", "chmod 0755 /data/local/tmp/busybox");
                this.textBox1.Text = this.textBox1.Text + "Getting mount path..." + Environment.NewLine;
                this.textBox1.SelectionStart = this.textBox1.TextLength;
                this.textBox1.Update();
                this.textBox1.ScrollToCaret();
                string str = this.getMountPath();
                this.textBox1.Text = this.textBox1.Text + str + Environment.NewLine;
                this.textBox1.Text = this.textBox1.Text + "OK" + Environment.NewLine;
                this.textBox1.Text = this.textBox1.Text + Environment.NewLine;
                this.textBox1.Text = this.textBox1.Text + "Reading OS Version properties..." + Environment.NewLine;
                this.textBox1.SelectionStart = this.textBox1.TextLength;
                this.textBox1.Update();
                this.textBox1.ScrollToCaret();
                try
                {
                    this.readBuildProp();
                    version = new Version(this.properties["ro.build.version.release"].ToString());
                }
                catch
                {
                    switch (MessageBox.Show("Automatic version check failed. Is your OS version 2.0 or higher?", "OS Version Check Failed!", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1))
                    {
                        case DialogResult.Yes:
                            version = new Version("2.0");
                            goto Label_040C;

                        case DialogResult.No:
                            version = new Version("1.5");
                            goto Label_040C;
                    }
                    throw new Exception();
                }
            Label_040C:
                this.textBox1.Text = this.textBox1.Text + "Version: " + version.ToString() + Environment.NewLine;
                this.textBox1.Text = this.textBox1.Text + "OK" + Environment.NewLine;
                this.textBox1.Text = this.textBox1.Text + Environment.NewLine;
                bool flag = true;
                while (flag)
                {
                    try
                    {
                        flag = this.runOperationUI("Remounting system with read-write access...", "-d shell /data/local/tmp/busybox mount -o rw,remount " + str + " /system").Contains("busy");
                    }
                    catch
                    {
                        flag = this.runOperationUI("Remounting system with read-write access... (no busybox)", "-d shell mount -o rw,remount " + str + " /system").Contains("busy");
                    }
                    Thread.Sleep(0x3e8);
                }
                if (version < new Version(2, 0))
                {
                    this.runOperationUI("Pushing su-v1...", "-d push \"" + AppDomain.CurrentDomain.BaseDirectory + "su-v1\" /system/bin/su");
                }
                else
                {
                    this.runOperationUI("Pushing su-v2...", "-d push \"" + AppDomain.CurrentDomain.BaseDirectory + "su-v2\" /system/bin/su");
                }
                this.runOperationUI("chmod su...", "-d shell chmod 4755 /system/bin/su");
                this.runShellCommandUI("Creating /system/xbin...", "mkdir /system/xbin");
                if (!this.runShellCommandUI("Copying busybox (/system/xbin/)...", "/data/local/tmp/busybox cp /data/local/tmp/busybox /system/xbin/busybox").Contains("No space left on device"))
                {
                    this.runShellCommandUI("chmod busybox (/system/xbin/)...", "chmod 0755 /system/xbin/busybox");
                    this.runShellCommandUI("Installing busybox (/system/xbin/)...", "/system/xbin/busybox --install -s /system/xbin");
                }
                if (this.runOperationUI("Pushing Superuser.apk...", "-d push \"" + AppDomain.CurrentDomain.BaseDirectory + "Superuser.apk\" /system/app/Superuser.apk").Contains("No space left on device"))
                {
                    this.runOperationUI("Pushing Superuser.apk... (/data/app)", "-d push \"" + AppDomain.CurrentDomain.BaseDirectory + "Superuser.apk\" /data/app/Superuser.apk");
                }
                flag = true;
                while (flag)
                {
                    try
                    {
                        flag = this.runOperationUI("Remounting system with read-only access...", "-d shell /data/local/tmp/busybox mount -o ro,remount " + str + " /system").Contains("busy");
                    }
                    catch
                    {
                        flag = this.runOperationUI("Remounting system with read-only access... (no busybox)", "-d shell mount -o ro,remount " + str + " /system").Contains("busy");
                    }
                    Thread.Sleep(0x3e8);
                }
                if (MessageBox.Show("Root files have been installed! Would you like run a test?", "Test?", MessageBoxButtons.YesNo, MessageBoxIcon.None, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                {
                    MessageBox.Show("An 'su' command will now be send to your phone. You might have to select Allow in Superuser.", "Testing!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    this.textBox1.Text = this.textBox1.Text + "Running a SU test... " + Environment.NewLine;
                    this.textBox1.SelectionStart = this.textBox1.TextLength;
                    this.textBox1.Update();
                    this.textBox1.ScrollToCaret();
                    if (!this.checkSURoot())
                    {
                        throw new Exception("Test failed!");
                    }
                    this.textBox1.Text = this.textBox1.Text + "Success!" + Environment.NewLine;
                    this.textBox1.SelectionStart = this.textBox1.TextLength;
                    this.textBox1.Update();
                    this.textBox1.ScrollToCaret();
                    if (MessageBox.Show("Your device has been rooted!\n\nWould you like to donate now?", "Rooted!", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                    {
                        Process.Start("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7ELH2CPLUZLQY");
                    }
                }
            }
            catch (Exception exception)
            {
                this.textBox1.Text = this.textBox1.Text + exception.Message + Environment.NewLine;
                this.textBox1.Text = this.textBox1.Text + "FAILED" + Environment.NewLine;
                foreach (object obj2 in this.properties.Keys)
                {
                    this.textBox1.Text = this.textBox1.Text + string.Format("{0}={1}", obj2, this.properties[obj2]) + Environment.NewLine;
                }
            }
            this.textBox1.SelectionStart = this.textBox1.TextLength;
            this.textBox1.ScrollToCaret();
            this.tabControl1.Enabled = true;
        }

        private void btnUnroot_Click(object sender, EventArgs e)
        {
            this.tabControl1.Enabled = false;
            this.textBox1.Text = "SuperOneClick v" + Application.ProductVersion.ToString() + Environment.NewLine;
            this.runOperationUI("Killing ADB Server...", "kill-server");
            this.runOperationUI("Starting ADB Server...", "start-server");
            this.runOperationUI("Waiting for device...", "wait-for-device");
            try
            {
                this.runOperationUI("Pushing " + this.exploitFile + "...", "-d push \"" + AppDomain.CurrentDomain.BaseDirectory + this.exploitFile + "\" /data/local/tmp/" + this.exploitFile);
                this.runOperationUI("chmod " + this.exploitFile + "...", "-d shell chmod 0755 /data/local/tmp/" + this.exploitFile);
                while (true)
                {
                    string text = this.textBox1.Text;
                    this.textBox1.Text = text + "Running " + this.exploitFile + "..." + Environment.NewLine;
                    this.textBox1.SelectionStart = this.textBox1.TextLength;
                    this.textBox1.Update();
                    this.textBox1.ScrollToCaret();
                    if (this.runExploit() == "ROOT")
                    {
                        this.textBox1.Text = this.textBox1.Text + "ROOTED" + Environment.NewLine;
                        this.textBox1.Text = this.textBox1.Text + Environment.NewLine;
                        break;
                    }
                    this.textBox1.Text = this.textBox1.Text + "OK" + Environment.NewLine;
                    this.textBox1.Text = this.textBox1.Text + Environment.NewLine;
                    this.textBox1.Text = this.textBox1.Text + "***IF IT KEEPS LOOPING, TRY DISABLING USB DEBUGGING NOW***" + Environment.NewLine;
                    this.textBox1.Text = this.textBox1.Text + Environment.NewLine;
                    this.runOperationUI("Killing ADB Server...", "kill-server");
                    this.runOperationUI("Starting ADB Server...", "start-server");
                    this.runOperationUI("Waiting for device...", "wait-for-device");
                }
                this.runOperationUI("Pushing busybox...", "-d push \"" + AppDomain.CurrentDomain.BaseDirectory + "busybox\" /data/local/tmp/busybox");
                this.runShellCommandUI("chmod busybox...", "chmod 0755 /data/local/tmp/busybox");
                this.textBox1.Text = this.textBox1.Text + "Getting mount path..." + Environment.NewLine;
                this.textBox1.SelectionStart = this.textBox1.TextLength;
                this.textBox1.Update();
                this.textBox1.ScrollToCaret();
                string str = this.getMountPath();
                this.textBox1.Text = this.textBox1.Text + str + Environment.NewLine;
                this.textBox1.Text = this.textBox1.Text + "OK" + Environment.NewLine;
                this.textBox1.Text = this.textBox1.Text + Environment.NewLine;
                bool flag = true;
                while (flag)
                {
                    try
                    {
                        flag = this.runOperationUI("Remounting system with read-write access...", "-d shell /data/local/tmp/busybox mount -o rw,remount " + str + " /system").Contains("busy");
                    }
                    catch
                    {
                        flag = this.runOperationUI("Remounting system with read-write access... (no busybox)", "-d shell mount -o rw,remount " + str + " /system").Contains("busy");
                    }
                    Thread.Sleep(0x3e8);
                }
                this.runOperationUI("Removing su...", "-d shell rm /system/bin/su");
                if (!this.runShellCommand("ls /system/app/Superuser.apk").Contains("No such file or directory"))
                {
                    this.runOperationUI("Removing Superuser.apk...", "-d shell rm /system/app/Superuser.apk");
                }
                this.runOperationUI("Removing Superuser.apk...", "-d shell pm uninstall com.noshufou.android.su");
                flag = true;
                while (flag)
                {
                    try
                    {
                        flag = this.runOperationUI("Remounting system with read-only access...", "-d shell /data/local/tmp/busybox mount -o ro,remount " + str + " /system").Contains("busy");
                    }
                    catch
                    {
                        flag = this.runOperationUI("Remounting system with read-only access... (no busybox)", "-d shell mount -o ro,remount " + str + " /system").Contains("busy");
                    }
                    Thread.Sleep(0x3e8);
                }
                if (!this.checkSURoot())
                {
                    MessageBox.Show("Device does not have Superuser!");
                }
            }
            catch (Exception exception)
            {
                this.textBox1.Text = this.textBox1.Text + exception.Message + Environment.NewLine;
                this.textBox1.Text = this.textBox1.Text + "FAILED" + Environment.NewLine;
            }
            this.textBox1.SelectionStart = this.textBox1.TextLength;
            this.textBox1.ScrollToCaret();
            this.tabControl1.Enabled = true;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_USBControllerDevice");
            ManagementObjectCollection objects = new ManagementObjectSearcher(query).Get();
            this.textBox1.Text = "SuperOneClick v" + Application.ProductVersion.ToString() + Environment.NewLine;
            foreach (ManagementObject obj2 in objects)
            {
                object text = this.textBox1.Text;
                this.textBox1.Text = string.Concat(new object[] { text, "Antecedent : ", obj2["Antecedent"], Environment.NewLine });
                object obj5 = this.textBox1.Text;
                this.textBox1.Text = string.Concat(new object[] { obj5, "Dependant : ", obj2["Dependent"], Environment.NewLine });
            }
            this.textBox1.Text = this.textBox1.Text + Environment.NewLine;
            ManagementObjectSearcher searcher2 = new ManagementObjectSearcher(@"root\CIMV2", "SELECT * FROM Win32_SystemDriver");
            foreach (ManagementObject obj3 in searcher2.Get())
            {
                this.textBox1.Text = this.textBox1.Text + string.Format("Driver caption: {0}", obj3["Caption"]) + Environment.NewLine;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.tabControl1.Enabled = false;
            this.textBox1.Text = "SuperOneClick v" + Application.ProductVersion.ToString() + Environment.NewLine;
            this.runOperationUI("Killing ADB Server...", "kill-server");
            this.runOperationUI("Starting ADB Server...", "start-server");
            this.runOperationUI("Waiting for device...", "wait-for-device");
            if (!this.checkROTCRoot())
            {
                try
                {
                    this.runOperationUI("Pushing " + this.exploitFile + "...", "-d push \"" + AppDomain.CurrentDomain.BaseDirectory + this.exploitFile + "\" /data/local/tmp/" + this.exploitFile);
                    this.runOperationUI("chmod " + this.exploitFile + "...", "-d shell chmod 0755 /data/local/tmp/" + this.exploitFile);
                    while (true)
                    {
                        string text = this.textBox1.Text;
                        this.textBox1.Text = text + "Running " + this.exploitFile + "..." + Environment.NewLine;
                        this.textBox1.SelectionStart = this.textBox1.TextLength;
                        this.textBox1.Update();
                        this.textBox1.ScrollToCaret();
                        if (this.runExploit() == "ROOT")
                        {
                            this.textBox1.Text = this.textBox1.Text + "ROOTED" + Environment.NewLine;
                            this.textBox1.Text = this.textBox1.Text + Environment.NewLine;
                            break;
                        }
                        this.textBox1.Text = this.textBox1.Text + "OK" + Environment.NewLine;
                        this.textBox1.Text = this.textBox1.Text + Environment.NewLine;
                        this.textBox1.Text = this.textBox1.Text + "***IF IT KEEPS LOOPING, TRY DISABLING USB DEBUGGING NOW***" + Environment.NewLine;
                        this.textBox1.Text = this.textBox1.Text + Environment.NewLine;
                        this.runOperationUI("Killing ADB Server...", "kill-server");
                        this.runOperationUI("Starting ADB Server...", "start-server");
                        this.runOperationUI("Waiting for device...", "wait-for-device");
                    }
                    if (this.checkROTCRoot())
                    {
                        MessageBox.Show("Device has a temporary ADB root!\nReboot your device to remove it");
                    }
                }
                catch (Exception exception)
                {
                    this.textBox1.Text = this.textBox1.Text + exception.Message + Environment.NewLine;
                    this.textBox1.Text = this.textBox1.Text + "FAILED" + Environment.NewLine;
                }
            }
            else
            {
                MessageBox.Show("Device has a temporary ADB root!\nReboot your device to remove it");
            }
            this.textBox1.SelectionStart = this.textBox1.TextLength;
            this.textBox1.ScrollToCaret();
            this.tabControl1.Enabled = true;
        }

        private void button3_Click(object sender, EventArgs e)
        {
        }

        private void button3_Click_1(object sender, EventArgs e)
        {
            Process.Start("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7ELH2CPLUZLQY");
        }

        private bool checkROTCRoot()
        {
            try
            {
                this.console.Kill();
            }
            catch
            {
            }
            this.console.StartInfo.Arguments = "-d shell";
            this.console.StartInfo = this.si;
            this.console.Start();
            string str = string.Empty;
            while (this.console.StandardOutput.Peek() != -1)
            {
                str = str + ((char) this.console.StandardOutput.Read());
            }
            if (str.Contains("#") && !this.console.HasExited)
            {
                this.console.Kill();
                return true;
            }
            try
            {
                this.console.Kill();
            }
            catch
            {
            }
            return false;
        }

        private bool checkSURoot()
        {
            try
            {
                this.console.Kill();
            }
            catch
            {
            }
            this.console.StartInfo.Arguments = "-d shell su";
            this.console.StartInfo = this.si;
            this.console.Start();
            bool flag = false;
            while (this.console.StandardOutput.Peek() != -1)
            {
                Application.DoEvents();
                if (((ushort) this.console.StandardOutput.Read()) == 0x23)
                {
                    flag = true;
                }
                Thread.Sleep(50);
            }
            if (flag)
            {
                this.console.Kill();
            }
            return flag;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                this.runCommand("kill-server");
            }
            catch
            {
            }
            this.console = null;
        }

        private string getMountPath()
        {
            StringReader reader = new StringReader(this.runShellCommand("/data/local/tmp/busybox mount"));
            while (reader.Peek() != -1)
            {
                string str2 = reader.ReadLine();
                if ((!string.IsNullOrEmpty(str2.Trim()) && (str2.Split(new char[] { ' ' }).Length >= 3)) && (str2.Split(new char[] { ' ' })[2] == "/system"))
                {
                    return str2.Split(new char[] { ' ' })[0];
                }
            }
            try
            {
                this.console.Kill();
            }
            catch
            {
            }
            this.console.StartInfo.Arguments = "-d shell mount";
            this.console.StartInfo = this.si;
            this.console.Start();
            DateTime now = DateTime.Now;
            while (!this.console.HasExited)
            {
                Application.DoEvents();
                TimeSpan span = (TimeSpan) (DateTime.Now - now);
                if (span.TotalSeconds >= 30.0)
                {
                    this.console.Kill();
                }
            }
            string message = string.Empty;
            while (this.console.StandardOutput.Peek() != -1)
            {
                Application.DoEvents();
                string[] strArray = this.console.StandardOutput.ReadLine().Split(new char[] { ' ' });
                if ((strArray.Length > 1) && (strArray[1] == "/system"))
                {
                    return strArray[0];
                }
            }
            throw new Exception(message);
        }

        private string getSettingsLocation()
        {
            string s = string.Empty;
            try
            {
                s = this.runShellCommand("busybox find / -name settings.db");
            }
            catch (Exception exception)
            {
                if (!exception.Message.TrimStart(new char[0]).StartsWith("busybox: not found"))
                {
                    throw exception;
                }
                s = this.runShellCommand("/data/local/tmp/busybox find / -name settings.db");
            }
            StringReader reader = new StringReader(s);
            string[] array = new string[0];
            while (reader.Peek() != -1)
            {
                string str2 = reader.ReadLine();
                if (!string.IsNullOrEmpty(str2.Trim()))
                {
                    Array.Resize<string>(ref array, array.Length + 1);
                    array[array.Length - 1] = str2;
                }
            }
            string str3 = string.Empty;
            try
            {
                str3 = this.runShellCommand("busybox find / -name com.android.providers.settings");
            }
            catch (Exception exception2)
            {
                if (!exception2.Message.TrimStart(new char[0]).StartsWith("busybox: not found"))
                {
                    throw exception2;
                }
                str3 = this.runShellCommand("/data/local/tmp/busybox find / -name com.android.providers.settings");
            }
            StringReader reader2 = new StringReader(str3);
            string[] strArray2 = new string[0];
            while (reader2.Peek() != -1)
            {
                string str4 = reader2.ReadLine();
                if (!string.IsNullOrEmpty(str4.Trim()))
                {
                    Array.Resize<string>(ref strArray2, strArray2.Length + 1);
                    strArray2[strArray2.Length - 1] = str4;
                }
            }
            foreach (string str5 in strArray2)
            {
                foreach (string str6 in array)
                {
                    if (str6.Contains(str5))
                    {
                        return str6;
                    }
                }
            }
            throw new Exception("settings.db not found");
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Form1));
            this.textBox1 = new TextBox();
            this.splitContainer1 = new SplitContainer();
            this.tabControl1 = new TabControl();
            this.tabPage1 = new TabPage();
            this.groupBox1 = new GroupBox();
            this.radioButton2 = new RadioButton();
            this.radioButton1 = new RadioButton();
            this.button3 = new Button();
            this.button2 = new Button();
            this.btnUnroot = new Button();
            this.btnNMA = new Button();
            this.btnRoot = new Button();
            this.tabPage2 = new TabPage();
            this.btnCaptivateUnlockCode = new Button();
            this.splitContainer1.Panel1.SuspendLayout();
            this.splitContainer1.Panel2.SuspendLayout();
            this.splitContainer1.SuspendLayout();
            this.tabControl1.SuspendLayout();
            this.tabPage1.SuspendLayout();
            this.groupBox1.SuspendLayout();
            this.tabPage2.SuspendLayout();
            base.SuspendLayout();
            this.textBox1.Dock = DockStyle.Fill;
            this.textBox1.Location = new Point(0, 0);
            this.textBox1.Multiline = true;
            this.textBox1.Name = "textBox1";
            this.textBox1.ReadOnly = true;
            this.textBox1.ScrollBars = ScrollBars.Vertical;
            this.textBox1.Size = new Size(0x372, 0x159);
            this.textBox1.TabIndex = 1;
            this.splitContainer1.Dock = DockStyle.Fill;
            this.splitContainer1.Location = new Point(0, 0);
            this.splitContainer1.Name = "splitContainer1";
            this.splitContainer1.Orientation = Orientation.Horizontal;
            this.splitContainer1.Panel1.Controls.Add(this.tabControl1);
            this.splitContainer1.Panel2.Controls.Add(this.textBox1);
            this.splitContainer1.Size = new Size(0x372, 0x1c0);
            this.splitContainer1.SplitterDistance = 0x63;
            this.splitContainer1.TabIndex = 3;
            this.tabControl1.Controls.Add(this.tabPage1);
            this.tabControl1.Controls.Add(this.tabPage2);
            this.tabControl1.Dock = DockStyle.Fill;
            this.tabControl1.Location = new Point(0, 0);
            this.tabControl1.Name = "tabControl1";
            this.tabControl1.SelectedIndex = 0;
            this.tabControl1.Size = new Size(0x372, 0x63);
            this.tabControl1.TabIndex = 2;
            this.tabPage1.AutoScroll = true;
            this.tabPage1.Controls.Add(this.groupBox1);
            this.tabPage1.Controls.Add(this.button3);
            this.tabPage1.Controls.Add(this.button2);
            this.tabPage1.Controls.Add(this.btnUnroot);
            this.tabPage1.Controls.Add(this.btnNMA);
            this.tabPage1.Controls.Add(this.btnRoot);
            this.tabPage1.Location = new Point(4, 0x16);
            this.tabPage1.Name = "tabPage1";
            this.tabPage1.Padding = new Padding(3);
            this.tabPage1.Size = new Size(0x36a, 0x49);
            this.tabPage1.TabIndex = 0;
            this.tabPage1.Text = "Universal";
            this.tabPage1.UseVisualStyleBackColor = true;
            this.groupBox1.Controls.Add(this.radioButton2);
            this.groupBox1.Controls.Add(this.radioButton1);
            this.groupBox1.Location = new Point(0x2ba, 6);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new Size(160, 0x40);
            this.groupBox1.TabIndex = 9;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Exploit:";
            this.radioButton2.AutoSize = true;
            this.radioButton2.Location = new Point(6, 0x2a);
            this.radioButton2.Name = "radioButton2";
            this.radioButton2.Size = new Size(0x77, 0x11);
            this.radioButton2.TabIndex = 1;
            this.radioButton2.Text = "rageagainstthecage";
            this.radioButton2.UseVisualStyleBackColor = true;
            this.radioButton2.CheckedChanged += new EventHandler(this.radioButton2_CheckedChanged);
            this.radioButton1.AutoSize = true;
            this.radioButton1.Checked = true;
            this.radioButton1.Location = new Point(6, 0x13);
            this.radioButton1.Name = "radioButton1";
            this.radioButton1.Size = new Size(0x42, 0x11);
            this.radioButton1.TabIndex = 0;
            this.radioButton1.TabStop = true;
            this.radioButton1.Text = "psneuter";
            this.radioButton1.UseVisualStyleBackColor = true;
            this.radioButton1.CheckedChanged += new EventHandler(this.radioButton1_CheckedChanged);
            this.button3.Location = new Point(560, 6);
            this.button3.Name = "button3";
            this.button3.Size = new Size(0x84, 0x40);
            this.button3.TabIndex = 8;
            this.button3.Text = "Donate";
            this.button3.UseVisualStyleBackColor = true;
            this.button3.Click += new EventHandler(this.button3_Click_1);
            this.button2.Location = new Point(0x92, 6);
            this.button2.Name = "button2";
            this.button2.Size = new Size(0x84, 0x40);
            this.button2.TabIndex = 7;
            this.button2.Text = "Shell Root";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new EventHandler(this.button2_Click);
            this.btnUnroot.Location = new Point(0x11c, 6);
            this.btnUnroot.Name = "btnUnroot";
            this.btnUnroot.Size = new Size(0x84, 0x40);
            this.btnUnroot.TabIndex = 6;
            this.btnUnroot.Text = "Unroot";
            this.btnUnroot.UseVisualStyleBackColor = true;
            this.btnUnroot.Click += new EventHandler(this.btnUnroot_Click);
            this.btnNMA.Location = new Point(0x1a6, 6);
            this.btnNMA.Name = "btnNMA";
            this.btnNMA.Size = new Size(0x84, 0x40);
            this.btnNMA.TabIndex = 5;
            this.btnNMA.Text = "Allow Non Market Apps\r\n(requires root)";
            this.btnNMA.UseVisualStyleBackColor = true;
            this.btnNMA.Click += new EventHandler(this.btnNMA_Click);
            this.btnRoot.Location = new Point(8, 6);
            this.btnRoot.Name = "btnRoot";
            this.btnRoot.Size = new Size(0x84, 0x40);
            this.btnRoot.TabIndex = 0;
            this.btnRoot.Text = "Root";
            this.btnRoot.UseVisualStyleBackColor = true;
            this.btnRoot.Click += new EventHandler(this.btnRoot_Click);
            this.tabPage2.Controls.Add(this.btnCaptivateUnlockCode);
            this.tabPage2.Location = new Point(4, 0x16);
            this.tabPage2.Name = "tabPage2";
            this.tabPage2.Padding = new Padding(3);
            this.tabPage2.Size = new Size(0x36a, 0x4a);
            this.tabPage2.TabIndex = 1;
            this.tabPage2.Text = "Samsung Captivate";
            this.tabPage2.UseVisualStyleBackColor = true;
            this.btnCaptivateUnlockCode.Location = new Point(8, 6);
            this.btnCaptivateUnlockCode.Name = "btnCaptivateUnlockCode";
            this.btnCaptivateUnlockCode.Size = new Size(0x84, 0x38);
            this.btnCaptivateUnlockCode.TabIndex = 1;
            this.btnCaptivateUnlockCode.Text = "Get Unlock Code";
            this.btnCaptivateUnlockCode.UseVisualStyleBackColor = true;
            this.btnCaptivateUnlockCode.Click += new EventHandler(this.btnCaptivateUnlockCode_Click);
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x372, 0x1c0);
            base.Controls.Add(this.splitContainer1);
            base.Icon = (Icon) manager.GetObject("$this.Icon");
            base.Name = "Form1";
            this.Text = "SuperOneClick";
            base.FormClosing += new FormClosingEventHandler(this.Form1_FormClosing);
            this.splitContainer1.Panel1.ResumeLayout(false);
            this.splitContainer1.Panel2.ResumeLayout(false);
            this.splitContainer1.Panel2.PerformLayout();
            this.splitContainer1.ResumeLayout(false);
            this.tabControl1.ResumeLayout(false);
            this.tabPage1.ResumeLayout(false);
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.tabPage2.ResumeLayout(false);
            base.ResumeLayout(false);
        }

        private void initializeProcess()
        {
            this.console = new Process();
            this.si = new ProcessStartInfo();
            if (Environment.OSVersion.Platform == PlatformID.MacOSX)
            {
                this.si.FileName = AppDomain.CurrentDomain.BaseDirectory + "adbmac";
            }
            else if (Environment.OSVersion.Platform == PlatformID.Unix)
            {
                this.si.FileName = AppDomain.CurrentDomain.BaseDirectory + "adblinux";
            }
            else
            {
                this.si.FileName = AppDomain.CurrentDomain.BaseDirectory + "adb.exe";
            }
            this.si.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory;
            this.si.RedirectStandardOutput = true;
            this.si.RedirectStandardInput = true;
            this.si.RedirectStandardError = true;
            this.si.StandardOutputEncoding = Encoding.ASCII;
            this.si.CreateNoWindow = true;
            this.si.UseShellExecute = false;
            this.console.StartInfo = this.si;
        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            if (this.radioButton1.Checked)
            {
                this.exploitFile = "psneuter";
            }
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            if (this.radioButton2.Checked)
            {
                this.exploitFile = "rageagainstthecage";
            }
        }

        private void readBuildProp()
        {
            string s = string.Empty;
            try
            {
                s = this.runShellCommand("/data/local/tmp/busybox cat /system/build.prop");
            }
            catch
            {
                s = this.runShellCommand("cat /system/build.prop");
            }
            StringReader reader = new StringReader(s);
            this.properties.Clear();
            while (reader.Peek() != -1)
            {
                string str2 = reader.ReadLine();
                if ((!string.IsNullOrEmpty(str2) && !str2.StartsWith("#")) && ((str2.Split(new char[] { '=' }).Length == 2) && !this.properties.ContainsKey(str2.Split(new char[] { '=' })[0])))
                {
                    this.properties.Add(str2.Split(new char[] { '=' })[0], str2.Split(new char[] { '=' })[1]);
                }
            }
        }

        private string runCommand(string arguments)
        {
            try
            {
                this.console.Kill();
            }
            catch
            {
            }
            this.console.StartInfo.Arguments = arguments;
            this.console.StartInfo = this.si;
            this.console.Start();
            string message = string.Empty;
            int num = this.console.StandardOutput.Peek();
            DateTime now = DateTime.Now;
            while (!this.console.HasExited || (num != -1))
            {
                Application.DoEvents();
                if (num != -1)
                {
                    message = message + ((char) this.console.StandardOutput.Read());
                    now = DateTime.Now;
                }
                num = this.console.StandardOutput.Peek();
                TimeSpan span = (TimeSpan) (DateTime.Now - now);
                if (span.TotalSeconds > 30.0)
                {
                    this.console.Kill();
                }
            }
            if ((message.ToLower().Contains("permission denied") || message.Contains("Operation not permitted")) || (message.Contains("not found") || message.Contains("failed to copy")))
            {
                throw new Exception(message);
            }
            if (message != string.Empty)
            {
                return message;
            }
            string str2 = string.Empty;
            while (this.console.StandardError.Peek() != -1)
            {
                Application.DoEvents();
                str2 = str2 + ((char) this.console.StandardError.Read());
            }
            if (str2.TrimStart(new char[0]).StartsWith("error:"))
            {
                throw new Exception(str2);
            }
            return str2;
        }

        private string runExploit()
        {
            try
            {
                this.console.Kill();
            }
            catch
            {
            }
            this.console.StartInfo.Arguments = "-d shell";
            this.console.StartInfo = this.si;
            this.console.Start();
            string message = string.Empty;
            while (this.console.StandardOutput.Peek() != -1)
            {
                message = message + ((char) this.console.StandardOutput.Read());
            }
            if (message.Contains("#") && !this.console.HasExited)
            {
                this.console.Kill();
                return "ROOT";
            }
            if (!message.Contains("$") || this.console.HasExited)
            {
                throw new Exception(message);
            }
            this.console.StandardInput.WriteLine("/data/local/tmp/" + this.exploitFile);
            while (!this.console.HasExited)
            {
                Application.DoEvents();
            }
            while (this.console.StandardOutput.Peek() != -1)
            {
                message = message + ((char) this.console.StandardOutput.Read());
            }
            return message;
        }

        private string runOperationUI(string description, string arguments)
        {
            this.textBox1.Text = this.textBox1.Text + description + Environment.NewLine;
            this.textBox1.SelectionStart = this.textBox1.TextLength;
            this.textBox1.ScrollToCaret();
            Application.DoEvents();
            string str = this.runCommand(arguments);
            this.textBox1.Text = this.textBox1.Text + str + Environment.NewLine;
            this.textBox1.Text = this.textBox1.Text + "OK" + Environment.NewLine;
            this.textBox1.Text = this.textBox1.Text + Environment.NewLine;
            return str;
        }

        private string runShellCommand(string arguments)
        {
            try
            {
                this.console.Kill();
            }
            catch
            {
            }
            this.console.StartInfo.Arguments = "-d shell \"" + arguments.Replace("\"", "\\\"") + "\"";
            this.console.StartInfo = this.si;
            this.console.Start();
            string message = string.Empty;
            int num = this.console.StandardOutput.Peek();
            DateTime now = DateTime.Now;
            while (!this.console.HasExited || (num != -1))
            {
                Application.DoEvents();
                if (num != -1)
                {
                    message = message + ((char) this.console.StandardOutput.Read());
                    now = DateTime.Now;
                }
                num = this.console.StandardOutput.Peek();
                TimeSpan span = (TimeSpan) (DateTime.Now - now);
                if (span.TotalSeconds > 30.0)
                {
                    this.console.Kill();
                }
            }
            if (message.ToLower().Contains("permission denied") || message.Contains("Operation not permitted"))
            {
                return this.runShellCommandWithSURoot(arguments);
            }
            if (message.Contains("not found") || message.Contains("Out of memory"))
            {
                throw new Exception(message);
            }
            if (message != string.Empty)
            {
                return message;
            }
            string str2 = string.Empty;
            while (this.console.StandardError.Peek() != -1)
            {
                Application.DoEvents();
                str2 = str2 + ((char) this.console.StandardError.Read());
            }
            if (str2.TrimStart(new char[0]).StartsWith("error:"))
            {
                throw new Exception(str2);
            }
            return str2;
        }

        private string runShellCommandUI(string description, string arguments)
        {
            this.textBox1.Text = this.textBox1.Text + description + Environment.NewLine;
            this.textBox1.SelectionStart = this.textBox1.TextLength;
            this.textBox1.ScrollToCaret();
            Application.DoEvents();
            string str = this.runShellCommand(arguments);
            this.textBox1.Text = this.textBox1.Text + str + Environment.NewLine;
            this.textBox1.Text = this.textBox1.Text + "OK" + Environment.NewLine;
            this.textBox1.Text = this.textBox1.Text + Environment.NewLine;
            return str;
        }

        private string runShellCommandWithROTCRoot(string arguments)
        {
            try
            {
                this.console.Kill();
            }
            catch
            {
            }
            this.console.StartInfo.Arguments = "-d shell";
            this.console.StartInfo = this.si;
            this.console.Start();
            string message = string.Empty;
            while (this.console.StandardOutput.Peek() != -1)
            {
                message = message + ((char) this.console.StandardOutput.Read());
            }
            if (message.Contains("#") && !this.console.HasExited)
            {
                this.console.StandardInput.WriteLine(arguments + "; exit");
                while (!this.console.HasExited)
                {
                    Application.DoEvents();
                }
            }
            else
            {
                try
                {
                    this.console.Kill();
                }
                catch
                {
                }
                throw new Exception("Could not run command with ROTC root.");
            }
            try
            {
                this.console.Kill();
            }
            catch
            {
            }
            message = string.Empty;
            while (this.console.StandardOutput.Peek() != -1)
            {
                Application.DoEvents();
                message = message + ((char) this.console.StandardOutput.Read());
            }
            if ((message.ToLower().Contains("permission denied") || message.Contains("Operation not permitted")) || (message.Contains("not found") || message.Contains("Out of memory")))
            {
                throw new Exception(message);
            }
            if (message != string.Empty)
            {
                return message;
            }
            string str2 = string.Empty;
            while (this.console.StandardError.Peek() != -1)
            {
                Application.DoEvents();
                str2 = str2 + ((char) this.console.StandardError.Read());
            }
            if (str2.TrimStart(new char[0]).StartsWith("error:"))
            {
                throw new Exception(str2);
            }
            return str2;
        }

        private string runShellCommandWithSURoot(string arguments)
        {
            try
            {
                this.console.Kill();
            }
            catch
            {
            }
            this.console.StartInfo.Arguments = "-d shell \"su -c \\\"" + arguments.Replace("\"", "\\\\\\\"") + "\\\" \"";
            this.console.StartInfo = this.si;
            this.console.Start();
            while (!this.console.HasExited)
            {
                Application.DoEvents();
            }
            string message = string.Empty;
            while (this.console.StandardOutput.Peek() != -1)
            {
                Application.DoEvents();
                message = message + ((char) this.console.StandardOutput.Read());
            }
            if ((message.ToLower().Contains("permission denied") || message.Contains("Operation not permitted")) || message.Contains("Out of memory"))
            {
                throw new Exception(message);
            }
            if (message.Contains("not found"))
            {
                this.runShellCommandWithROTCRoot(arguments);
            }
            if (message != string.Empty)
            {
                return message;
            }
            string str2 = string.Empty;
            while (this.console.StandardError.Peek() != -1)
            {
                Application.DoEvents();
                str2 = str2 + ((char) this.console.StandardError.Read());
            }
            if (str2.TrimStart(new char[0]).StartsWith("error:"))
            {
                throw new Exception(str2);
            }
            return str2;
        }
    }
}

0 comments:

Post a Comment