private bool IsValidEncryptedBase(string path) { string titleId = NusContent.CheckEncrypted(path); if (titleId != null && NusContent.CheckCommonKeyFiles() && File.Exists("resources\\jnustool\\JNUSTool.jar")) { string name = NusContent.JNUSToolWrapper(path, 400, 32768, titleId, "/code/cos.xml"); if (name != null && File.Exists(name + "\\code\\cos.xml")) { XmlDocument xmlCos = new XmlDocument(); xmlCos.Load(name + "\\code\\cos.xml"); XmlNode cos_argstr = xmlCos.SelectSingleNode("app/argstr"); Directory.Delete(name, true); if (cos_argstr.InnerText == "hachihachi_ntr.rpx") { return(true); } else { Cll.Log.WriteLine("\"" + path + "\" does not contain a NDS Wii U VC game."); return(false); } } else if (name != null) { Cll.Log.WriteLine("The NUS CONTENT does not contains \"cos.xml\" file."); Directory.Delete(name, true); return(false); } else { Cll.Log.WriteLine("JNUSToolWrapper could not decipher the NUS CONTENT."); return(false); } } else { Cll.Log.WriteLine("Some of the following files are missing:"); Cll.Log.WriteLine(path + "\\title.tmd"); Cll.Log.WriteLine(path + "\\title.tik"); Cll.Log.WriteLine(path + "\\title.cert"); return(false); } }
public void Run(string[] args) { Cll.Log.WriteLine("DSInject " + DSInjector.Release + " - by phacox.cll"); Cll.Log.WriteLine(""); if (NusContent.GetJavaVersion() == null) { Cll.Log.WriteLine("Warning! Apparently the system does not have Java installed!"); Cll.Log.WriteLine("Java is needed to NUSPacker (encrypt) and JNUSTool (decrypt)."); Cll.Log.WriteLine(""); } else { if (!File.Exists("resources\\nuspacker\\NUSPacker.jar")) { Cll.Log.WriteLine("Warning! \"resources\\nuspacker\\NUSPacker.jar\" not found!"); Cll.Log.WriteLine("NUSPacker allows you to encrypt the result for WUPInstaller."); Cll.Log.WriteLine(""); } if (!File.Exists("resources\\jnustool\\JNUSTool.jar")) { Cll.Log.WriteLine("Warning! \"resources\\jnustool\\JNUSTool.jar\" not found!"); Cll.Log.WriteLine("JNUSTool allows you to decrypt Wii U VC games to use as a base."); Cll.Log.WriteLine(""); } } if (NusContent.CheckCommonKeyFiles()) { Cll.Log.WriteLine("Common Key found successfully."); } else { Cll.Log.WriteLine("Common Key not found. Use load-key option."); } if (injector.BaseIsLoaded) { Cll.Log.WriteLine("Base loaded: " + injector.LoadedBase); } else { Cll.Log.WriteLine("Base not found. Use load-base option or specify one using the -base option."); } Cll.Log.WriteLine(""); if (args.Length == 0) { ConsoleHelp(); } else if (args.Length == 1 && args[0] == "help") { ConsoleHelp(); } else if (args.Length == 2 && args[0] == "load-key") { Cll.Log.WriteLine("load-key: " + args[1]); if (NusContent.LoadKey(args[1])) { Cll.Log.WriteLine("Common Key loaded successfully."); } else { Cll.Log.WriteLine("The load of the key failed. Is a valid Common Key?"); } } else if (args.Length == 2 && args[0] == "load-base") { Cll.Log.WriteLine("load-base: " + args[1]); Cll.Log.WriteLine("Loading base, please wait..."); if (injector.LoadBase(args[1])) { Cll.Log.WriteLine("Base loaded: " + injector.LoadedBase); } else { Cll.Log.WriteLine("The base was not loaded correctly."); } } else if (args.Length >= 1 && args[0] == "create-image") { if (CreateImage(args)) { Cll.Log.WriteLine("Image created."); } else { Cll.Log.WriteLine("Image not created."); } } else if (args.Length >= 1 && args[0] == "create-icon") { if (CreateIcon(args)) { Cll.Log.WriteLine("Icon created."); } else { Cll.Log.WriteLine("Icon not created."); } } else if ((args.Length == 3 || args.Length == 5) && (args[0] == "pack" || args[0] == "unpack")) { PackUnpack(args); } else { bool _continue = LoadArgs(args); if (_continue) { _continue = ValidArgs(); } if (_continue) { Inject(); } } Cll.Log.WriteLine("Close."); Cll.Log.WriteLine("----------------------------------------------------------------"); }
public DSInjectGUI() { Cll.Log.SaveIn("DSInject_log.txt"); Cll.Log.WriteLine(DateTime.UtcNow.ToString()); Cll.Log.WriteLine("DSInject open in GUI mode."); injector = new DSInjector(); InitializeComponent(); this.Text = "DSInject " + DSInjector.Release; XmlSettings = new XmlWriterSettings { Indent = true, IndentChars = " ", NewLineChars = "\r\n", NewLineHandling = NewLineHandling.Replace }; XmlConfig = new XmlDocument(); LoadXmlConfig(); if (NusContent.GetJavaVersion() == null) { MessageBox.Show("Warning! Apparently the system does not have Java installed!\n" + "Java is needed to NUSPacker (encrypt) and JNUSTool (decrypt).", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { StringBuilder sb = new StringBuilder(); bool warning = false; if (!File.Exists("resources\\nuspacker\\NUSPacker.jar")) { sb.AppendLine("Warning! \"resources\\nuspacker\\NUSPacker.jar\" not found!"); sb.AppendLine("NUSPacker allows you to encrypt the result for WUPInstaller."); sb.AppendLine(""); warning = true; } if (!File.Exists("resources\\jnustool\\JNUSTool.jar")) { sb.AppendLine("Warning! \"resources\\jnustool\\JNUSTool.jar\" not found!"); sb.AppendLine("JNUSTool allows you to decrypt Wii U VC games to use as a base."); warning = true; } if (warning) { MessageBox.Show(sb.ToString(), "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } if (NusContent.CheckCommonKeyFiles()) { textBoxCommonKey.Enabled = false; panelValidKey.BackgroundImage = Properties.Resources.checkmark_16; } else { textBoxCommonKey.Enabled = true; panelValidKey.BackgroundImage = Properties.Resources.x_mark_16; } labelLoadedBase.Text = "Base: " + injector.LoadedBase; if (injector.BaseIsLoaded) { panelLoadedBase.BackgroundImage = global::DSInject.Properties.Resources.checkmark_16; } if (File.Exists("resources\\boot.png")) { injector.BootTvImg.Frame = new Bitmap("resources\\boot.png"); injector.BootDrcImg.Frame = new Bitmap("resources\\boot.png"); } if (File.Exists("resources\\icon.png")) { injector.IconImg.Frame = new Bitmap("resources\\icon.png"); } if (File.Exists("resources\\title_screen.png")) { TitleScreenPath = "resources\\title_screen.png"; injector.BootTvImg.TitleScreen = new Bitmap(TitleScreenPath); injector.BootDrcImg.TitleScreen = new Bitmap(TitleScreenPath); injector.IconImg.TitleScreen = new Bitmap(TitleScreenPath); } UpdateBootTvPictureBox(); UpdateBootDrcPictureBox(); UpdateIconPictureBox(); }