Example #1
0
 public NandInfo(Nand.PrivateN Nand)
 {
     InitializeComponent();
     lblfcrt.Visible     = false;
     label2blb.Visible   = false;
     label2bla.Visible   = false;
     textBox2BLb.Visible = false;
     setNand(Nand);
 }
Example #2
0
 public void loadvariables(string cpukey, hacktypes ttype, int dash, consoles ctype, List <String> patches, Nand.PrivateN nand, bool altoptions, bool DLpatches, bool includeLaunch, bool audclamp, bool rjtag, bool cr4)
 {
     this._cpukey        = cpukey;
     this._ttype         = ttype;
     this._dash          = dash;
     this._ctype         = ctype;
     this._patches       = patches;
     this._nand          = nand;
     this._altoptions    = altoptions;
     this._DLpatches     = DLpatches;
     this._includeLaunch = includeLaunch;
     this._audclamp      = audclamp;
     this._rjtag         = rjtag;
     this._CR4           = cr4;
 }
Example #3
0
        public void createxebuild_v2(bool custom, Nand.PrivateN nand)
        {
            Classes.xebuild xe = new Classes.xebuild();
            xe.loadvariables(nand._cpukey, (Classes.xebuild.hacktypes)variables.ttyp, variables.dashversion,
                             variables.ctyp, patches, nand, chkxesettings.Checked, checkDLPatches.Checked,
                             chkLaunch.Checked, checkAUDclamp.Checked, chkRJtag.Checked, chkCR4.Checked);

            string ini = (variables.launchpath + @"\" + variables.dashversion + @"\_" + variables.ttyp + ".ini");

            if (!custom)
            {
                if (String.IsNullOrWhiteSpace(variables.filename1))
                {
                    loadFil(ref variables.filename1, true);
                    if (String.IsNullOrWhiteSpace(variables.filename1))
                    {
                        MessageBox.Show("No File Selected");
                        return;
                    }
                }
                if (!File.Exists(variables.filename1))
                {
                    MessageBox.Show("File is missing. Ensure it wasn't moved and app can access it.");
                    return;
                }
                if (Path.GetExtension(variables.filename1) != ".bin")
                {
                    MessageBox.Show("You must select a .bin file", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                    return;
                }
                try
                {
                    string[] files = { "kv.bin", "smc.bin", "smc_config.bin", "fcrt.bin" };
                    foreach (string file in files)
                    {
                        if (File.Exists(Path.Combine(variables.pathforit, @"xebuild\data\" + file)))
                        {
                            if (MessageBox.Show(file + " found. Delete it?\n Unless you put it there, delete it!", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                            {
                                File.Delete(Path.Combine(variables.pathforit, @"xebuild\data\" + file));
                            }
                        }
                    }
                }
                catch (Exception ex) { if (variables.debugme)
                                       {
                                           Console.WriteLine(ex.ToString());
                                       }
                }
                if (!nand.cpukeyverification(nand._cpukey))
                {
                    Console.WriteLine("Wrong cpukey");
                    return;
                }
            }
            else
            {
                string[] filesa = { "kv.bin", "smc.bin", "smc_config.bin" };
                foreach (string file in filesa)
                {
                    if (!File.Exists(Path.Combine(variables.pathforit, @"xebuild\data\" + file)))
                    {
                        MessageBox.Show(file + " is missing");
                        Process.Start(Path.Combine(variables.pathforit, @"xebuild\data"));
                        return;
                    }
                }
                Regex objAlphaPattern = new Regex("[a-fA-F0-9]{32}$");
                bool  sts             = objAlphaPattern.IsMatch(variables.cpkey);
                if ((variables.cpkey.Length == 32 && sts))
                {
                    if (variables.debugme)
                    {
                        Console.WriteLine("Key verification");
                    }
                    long size = 0;
                    if (Nand.Nand.cpukeyverification(Oper.openfile(Path.Combine(variables.pathforit, @"xebuild\data\kv.bin"), ref size, 0), variables.cpkey))
                    {
                        Console.WriteLine("CpuKey is Correct");
                        if (Nand.Nand.getfcrtflag(File.ReadAllBytes(Path.Combine(variables.pathforit, @"xebuild\data\kv.bin")), variables.cpkey))
                        {
                            if (!File.Exists(Path.Combine(variables.pathforit, @"xebuild\data\fcrt.bin")))
                            {
                                MessageBox.Show("fcrt.bin is missing");
                                Process.Start(Path.Combine(variables.pathforit, @"xebuild\data"));
                                return;
                            }
                        }
                    }
                    else
                    {
                        Console.WriteLine("Wrong CpuKey");
                    }
                }

                Forms.xeBuildOptions ldv = new Forms.xeBuildOptions();
                string   cba = "", cbb = "";
                string[] files = parse_ini.parselabel(ini, variables.ctyp.Ini + "bl");
                if (files.Length >= 2)
                {
                    if (files[0].Contains("cb"))
                    {
                        cba = files[0].Substring(files[0].IndexOf("_") + 1, files[0].IndexOf(".bin") - 4);
                    }
                    if (files[1].Contains("cbb"))
                    {
                        cbb = files[1].Substring(files[1].IndexOf("cbb_") + 4, files[1].IndexOf(".bin") - 4);
                    }
                }
                ldv.enumeratecbs(cba, cbb);
                ldv.ShowDialog();
            }

Start:
            switch (xe.createxebuild(custom))
            {
            case Classes.xebuild.XebuildError.nocpukey:
                MessageBox.Show("cpukey is missing");
                return;

            case Classes.xebuild.XebuildError.nodash:
                MessageBox.Show("No Dash Selected");
                return;

            case Classes.xebuild.XebuildError.noinis:
                MessageBox.Show("Ini's are missing");
                return;

            case Classes.xebuild.XebuildError.nobootloaders:
                Console.WriteLine("The specified console bootloader list ({0}) is missing from the ini ({1})", variables.ctyp.Ini + "bl", ini);
                Console.WriteLine("You can either add it manually or ask for it get added if its possible");
                return;

            case Classes.xebuild.XebuildError.wrongcpukey:
                MessageBox.Show("Wrong cpukey");
                return;

            case Classes.xebuild.XebuildError.noconsole:
                variables.ctyp = callconsoletypes(ConsoleTypes.Selected.All);
                if (variables.ctyp.ID == -1)
                {
                    return;
                }
                else
                {
                    xe.loadvariables(nand._cpukey, (Classes.xebuild.hacktypes)variables.ttyp, variables.dashversion,
                                     variables.ctyp, patches, nand, chkxesettings.Checked, checkDLPatches.Checked,
                                     chkLaunch.Checked, checkAUDclamp.Checked, chkRJtag.Checked, chkCR4.Checked);
                    goto Start;
                }

            case Classes.xebuild.XebuildError.none:
                copyfiles(nand._cpukey);
                xe.xeExit += xe_xeExit;
                xe.build();
                break;

            default:
                break;
            }
        }
Example #4
0
 public void loadvariables(string cpukey, hacktypes ttype, int dash, consoles ctype, List <String> patches, Nand.PrivateN nand)
 {
     loadvariables(cpukey, ttype, dash, ctype, patches, nand, false, false, false, false, false, false);
 }
Example #5
0
 public void setNand(Nand.PrivateN Nand)
 {
     this.nand = Nand;
     populateInfo();
 }
Example #6
0
        private void scan(string folder)
        {
            Console.WriteLine("Scanning Files..");
            try
            {
                int           counter = 0, nandfiles = 0, median = 0, textfiles = 0, percent = 0, previous = 0;
                List <float>  lengths   = new List <float>();
                List <string> blacklist = new List <string>();
                lengths.Add(0x4200000); lengths.Add(0x1080000); lengths.Add(0x10800000); lengths.Add(0x21000000); lengths.Add(0x3000000); lengths.Add(0xE0400000);

                string[] filePaths = Directory.GetFiles(folder, "*.txt", SearchOption.AllDirectories);
                foreach (string file in filePaths)
                {
                    if (file.ToUpper().Contains("FUSES") || file.ToUpper().Contains("INFO") || file.ToUpper().Contains("KV") || file.ToUpper().Contains("CPU"))
                    {
                        textfiles++;
                        string[] nandPaths = Directory.GetFiles(Path.GetDirectoryName(file), "*.bin", SearchOption.TopDirectoryOnly);
                        counter += nandPaths.Length;

                        foreach (string nand in nandPaths)
                        {
                            if (variables.debugme)
                            {
                                Console.WriteLine(nand);
                            }

                            #region percent
                            if (variables.debugme)
                            {
                                Console.WriteLine("counter: {0} - i: {1}", counter, textfiles);
                                Console.WriteLine("nandpaths.length: {0}", nandPaths.Length);
                                Console.WriteLine("j: {0} - filepaths.length: {1}", nandfiles, filePaths.Length);
                            }
                            median = (counter) / textfiles;
                            if (median == 0)
                            {
                                median = 1;
                            }
                            percent = ((nandfiles + (textfiles - median)) * 100) / ((filePaths.Length - textfiles) * median);
                            if (percent > previous && percent < 100)
                            {
                                if (percent % 5 == 0)
                                {
                                    Console.WriteLine("\rCompletion {0}%", percent);
                                }
                                Console.Out.Flush();
                                previous = percent;
                            }
                            nandfiles++;
                            #endregion

                            if (nand.ToUpper().Contains("NANDFLASH") || nand.ToUpper().Contains("UPDFLASH"))
                            {
                                continue;
                            }

                            FileInfo fl = new FileInfo(nand);
                            if (lengths.Contains((fl.Length)))
                            {
                                string   cpukey    = "";
                                string[] textlines = File.ReadAllLines(file);

                                foreach (string line in textlines)
                                {
                                    cpukey = (objAlphaPattern.Match(line).Value);

                                    try
                                    {
                                        if (blacklist.Contains(nand))
                                        {
                                            break;
                                        }
                                        if (Nand.Nand.imageknown(nand, false))
                                        {
                                            if (variables.debugme)
                                            {
                                                Console.WriteLine("Verifying key");
                                            }
                                            if (Nand.Nand.cpukeyverification(nand, cpukey, true))
                                            {
                                                break;
                                            }
                                            if (variables.debugme)
                                            {
                                                Console.WriteLine("Key not verified");
                                            }
                                        }
                                        if (variables.debugme)
                                        {
                                            Console.WriteLine("Image not known");
                                        }
                                    }
                                    catch (Exception ex) { blacklist.Add(nand); if (variables.debugme)
                                                           {
                                                               Console.WriteLine(ex.ToString());
                                                           }
                                                           continue; }
                                }

                                bool sts   = objAlphaPattern.IsMatch(cpukey);
                                bool check = false;

                                if (sts)
                                {
                                    try
                                    {
                                        check = Nand.Nand.cpukeyverification(nand, cpukey);
                                    }
                                    catch (Exception ex)
                                    {
                                        if (variables.debugme)
                                        {
                                            Console.WriteLine(nand.ToString() + " Balls");
                                        }
                                        if (variables.debugme)
                                        {
                                            Console.WriteLine(ex.ToString());
                                        }
                                    }
                                }

                                if (check)
                                {
                                    Nand.PrivateN nan      = new Nand.PrivateN(nand, cpukey);
                                    DataTable     cputable = dataSet1.DataTable1;
                                    try
                                    {
                                        bool found = false;
                                        for (int c = 0; c != index; c++)
                                        {
                                            if (!String.IsNullOrWhiteSpace(nan.ki.serial) && cputable.Rows[c]["Serial"].ToString().ToUpper().Contains(nan.ki.serial.ToUpper()))
                                            {
                                                if (String.IsNullOrWhiteSpace(cputable.Rows[c]["Comment"].ToString()) || String.IsNullOrWhiteSpace(cputable.Rows[c]["Region"].ToString()) ||
                                                    String.IsNullOrWhiteSpace(cputable.Rows[c]["DVDKey"].ToString()) || String.IsNullOrWhiteSpace(cputable.Rows[c]["OSIG"].ToString()))
                                                {
                                                    try
                                                    {
                                                        RegistryKey cpukeydb = Registry.CurrentUser.CreateSubKey("CPUKey_DB");
                                                        RegistryKey cpukeys  = cpukeydb.CreateSubKey(cputable.Rows[c]["ID"].ToString());
                                                        //RegistryKey cpukeys = cpukeydb.OpenSubKey(Nand.Nand.getConsoleName(nan, variables.flashconfig), true);
                                                        string moboname = Nand.Nand.getConsoleName(nan, variables.flashconfig);
                                                        cpukeys.SetValue("Mobo", (object)moboname);
                                                        cpukeys.SetValue("DVDKey", (object)nan.ki.dvdkey);
                                                        cpukeys.SetValue("Region", (object)nan.ki.region);
                                                        cpukeys.SetValue("OSIG", (object)nan.ki.osig);
                                                        //Console.WriteLine("Adding {0}", Nand.Nand.getConsoleName(nan, variables.flashconfig) + " to entry found blank in CPUKey db");
                                                        cputable.Rows[c]["Comment"] = moboname;
                                                        cputable.Rows[c]["DVDKey"]  = nan.ki.dvdkey;
                                                        cputable.Rows[c]["Region"]  = nan.ki.region;
                                                        cputable.Rows[c]["OSIG"]    = nan.ki.osig;
                                                    }
                                                    catch (Exception ex1)
                                                    {
                                                        if (variables.debugme)
                                                        {
                                                            Console.WriteLine(ex1.ToString());
                                                        }
                                                    }
                                                }
                                                found = true;
                                            }
                                            else if (cputable.Rows[c]["CPU Key"].ToString().ToUpper().Contains(cpukey.ToUpper()))
                                            {
                                                found = true;
                                            }
                                        }
                                        if (variables.debugme)
                                        {
                                            Console.WriteLine("found {0}", found);
                                        }
                                        if (!found)
                                        {
                                            regentries entry = new regentries();
                                            entry.kvcrc  = nan.kvcrc().ToString("X");
                                            entry.serial = nan.ki.serial;
                                            entry.cpukey = cpukey;
                                            entry.extra  = Nand.Nand.getConsoleName(nan, variables.flashconfig);
                                            entry.osig   = nan.ki.osig;
                                            entry.region = nan.ki.region;
                                            entry.dvdkey = nan.ki.dvdkey;

                                            addkey_s(entry, dataSet1);
                                        }
                                        found = false;
                                    }
                                    catch (Exception ex) { if (variables.debugme)
                                                           {
                                                               Console.WriteLine(ex.ToString());
                                                           }
                                    }
                                }
                                else if (variables.debugme)
                                {
                                    Console.WriteLine("2nd time veri failed");
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex) { if (variables.debugme)
                                   {
                                       Console.WriteLine(ex.ToString());
                                   }
            }
            this.Refresh();
            Console.WriteLine("\rCompletion 100%");
            Console.WriteLine("Done.");
        }