public void ExtractXk3yCompatibleFiles(NANDReader nandReader, byte[] cpukey, string outdir) { var origdir = Directory.GetCurrentDirectory(); try { if (!Directory.Exists(outdir)) { Directory.CreateDirectory(outdir); } Directory.SetCurrentDirectory(outdir); var fcrt = _nand.GetFcrt(nandReader); var tmp = new byte[fcrt.Length]; Buffer.BlockCopy(fcrt, 0, tmp, 0, fcrt.Length); _crypto.DecryptFcrt(ref tmp, cpukey); if (!_crypto.VerifyFcrtDecrypted(ref tmp)) { throw new X360UtilsException(X360UtilsException.X360UtilsErrors.DataInvalid, "FCRT Can't be verified to be for this cpukey!"); } File.WriteAllBytes("fcrt_enc.bin", fcrt); var kv = _nand.GetKeyVault(nandReader, cpukey); File.WriteAllText("dvd.txt", _kvutils.GetDVDKey(ref kv)); File.WriteAllText("cpu.txt", StringUtils.ArrayToHex(cpukey)); File.WriteAllText(TranslateOsigToFile(_kvutils.GetOSIGData(ref kv)), ""); } finally { Directory.SetCurrentDirectory(origdir); } }
private void testKvInfobtn_Click(object sender, EventArgs e) { _sw = Stopwatch.StartNew(); var ofd = new OpenFileDialog(); if (ofd.ShowDialog() != DialogResult.OK) { return; } var nand = ofd.FileName; ofd.FileName = "cpukey.txt"; if (ofd.ShowDialog() != DialogResult.OK) { return; } var bw = new BackgroundWorker(); bw.DoWork += (o, args) => { try { var keyutils = new CpukeyUtils(); var key = keyutils.GetCPUKeyFromTextFile(ofd.FileName); using (var reader = new NANDReader(nand)) { AddOutput("Grabbing & Decrypting KV From NAND: "); var kv = _x360NAND.GetKeyVault(reader, key); var kvinfo = new Keyvault(); AddOutput(Environment.NewLine); AddOutput("Console ID: {0}", kvinfo.GetConsoleID(ref kv)); AddOutput(Environment.NewLine); AddOutput("Console Serial: {0}", kvinfo.GetConsoleSerial(ref kv)); AddOutput(Environment.NewLine); AddOutput("DVDKey: {0}", kvinfo.GetDVDKey(ref kv)); AddOutput(Environment.NewLine); AddOutput("FCRT Flag: 0x{0:X}", kvinfo.GetFCRTFlag(ref kv)); AddOutput(Environment.NewLine); AddOutput("FCRT Required: {0}", kvinfo.FCRTRequired(ref kv)); AddOutput(Environment.NewLine); AddOutput("FCRT Used: {0}", kvinfo.FCRTUsed(ref kv)); AddOutput(Environment.NewLine); AddOutput("Game Region: {0}", kvinfo.GetGameRegion(ref kv, true)); AddOutput(Environment.NewLine); AddOutput("MFR-Date (DDMMYY): {0}", kvinfo.GetMfrDate(ref kv, Keyvault.DateFormats.DDMMYY)); AddOutput(Environment.NewLine); AddOutput("OSIG: {0}", kvinfo.GetOSIGData(ref kv)); } } catch (X360UtilsException ex) { AddOutput("FAILED!"); AddException(ex.ToString()); } AddOutput(Environment.NewLine); AddDone(); }; bw.RunWorkerCompleted += BwCompleted; bw.RunWorkerAsync(); }