static void Main(string[] args) { ModuleDefMD module = ModuleDefMD.Load(args[0]); Junk.Run(module); Junk.JunkString(module); StringEnc2.Run(module); SizeOFF.Run(module); StringEnc.Run(module); ControlFlow.Execute(module); Junk.junkfield(module); Numbers.Run(module); Rename.Run(module); proxy.Run(module); hideMethods.Execute(module); var text2 = Path.GetDirectoryName(args[0]); if (text2 != null && !text2.EndsWith("\\")) { text2 += "\\"; } var path = text2 + Path.GetFileNameWithoutExtension(args[0]) + "_protected" + Path.GetExtension(args[0]); module.Write(path, new ModuleWriterOptions(module) { PEHeadersOptions = { NumberOfRvaAndSizes = 13 }, Logger = DummyLogger.NoThrowInstance }); }
private void btn_generateDecryptClass_Click(object sender, EventArgs e) { StringEnc.SetKey(textBox2.Text[0]); int[] result = StringEnc.Encrypt(textBox3.Text); textBox1.Text = ""; textBox1.Text = result.Count().ToString() + ", "; for (int i = 0; i < result.Count(); i++) { if (i == result.Count() - 1) { textBox1.Text += result[i].ToString(); } else { textBox1.Text += result[i].ToString() + ", "; } } }
private void Compile(object data) { int progress = 4; string outputName = Junk.RandomString(25) + ".exe"; SetProgressBar(0, progress); SetStatus("Unzipping.."); HackFile hackFile = (HackFile)data; string directory = string.Concat(Path.GetFileNameWithoutExtension(fileName), "/"); char encKey = Junk.RandomString(1).ToCharArray()[0]; hackFile.Unzip(directory, encKey); StringEnc.SetKey(encKey); SetProgressBar(1, progress); SetStatus("Randomizing and Encrypting.."); string str1 = string.Concat(Path.GetFileNameWithoutExtension(fileName), "_R/"); hackFile.RandomizeAllFiles(directory, str1); SetProgressBar(2, progress); SetStatus("Compiling.."); string str2 = string.Concat(Path.GetDirectoryName(txtCompilerPath.Text), "\\"); ProcessStartInfo processStartInfo = new ProcessStartInfo() { FileName = "cmd.exe" }; string str3 = "/C "; str3 = string.Concat(str3, "cd ", str1, "&"); str3 = string.Concat(str3, "\"", str2, "vcvars32.bat\"&"); string str4 = str3; string[] strArrays = new string[] { str4, "\"", str2, "cl.exe\" ", txtCompilerArgs.Text }; str3 = string.Concat(strArrays); if (!chkboxDebug.Checked) { processStartInfo.UseShellExecute = false; processStartInfo.RedirectStandardInput = true; processStartInfo.WindowStyle = ProcessWindowStyle.Hidden; processStartInfo.CreateNoWindow = true; } else { str3 = string.Concat(str3, "&pause"); } processStartInfo.Arguments = str3; // MessageBox.Show(str3); Process.Start(processStartInfo).WaitForExit(); SetProgressBar(3, progress); SetStatus("Finishing up.."); if (File.Exists(outputName)) { File.Delete(outputName); } bool flag = false; if (File.Exists(string.Concat(str1, outEXEName))) { File.Move(string.Concat(str1, outEXEName), outputName); flag = true; } if (chkBoxDeleteFolders.Checked) { Directory.Delete(directory, true); Directory.Delete(str1, true); } SetProgressBar(4, progress); SetStatus("Done with " + safeFileName); if (!flag) { if (chkBox_PromptMsg.Checked) { MessageBox.Show("Something went wrong when compiling the randomized source!", "Error"); } } else { if (chkBox_PromptMsg.Checked) { MessageBox.Show(string.Concat("File saved as: ", outputName), "Compiling has been completed."); } if (num_Copies.Value == 1) { if (chkBox_PromptMsg.Checked) { DialogResult msgBox = MessageBox.Show("Would you like to run this right now?", "Question", MessageBoxButtons.YesNo); if (msgBox == System.Windows.Forms.DialogResult.Yes) { processStartInfo = new ProcessStartInfo() { FileName = outputName }; Process.Start(processStartInfo).WaitForExit(); } } } } isCompiling = false; }
protected void CheckAll() { bool i; ParseItem fromStack; string str; string str1 = ""; // Check for strings if (Match("\"")) { int currentCursor = cursor; for (i = false; !i; i = fileData[currentCursor - 1] != '\\') { currentCursor++; currentCursor = fileData.IndexOf("\"", currentCursor); if (currentCursor == -1) { break; } } if (i == true) { string literal = ToLiteral(fileData.Substring(cursor + 1, currentCursor - cursor - 1)); if (literal == "Failed") { MessageBox.Show("Error at cursor position: " + currentCursor.ToString()); return; } if (!escapeString) { cursor = currentCursor + 1; } else { // Handle replacing strings with Decrypt method int litLength = literal.Length; string decryptString = "Decrypt(" + litLength.ToString(); int[] encrypted = StringEnc.Encrypt(literal); for (int currentLit = 0; currentLit < literal.Length; currentLit++) { decryptString += "," + encrypted[currentLit]; } decryptString += ")"; SafeRemove(cursor, currentCursor - cursor + 1); SafeInsert(cursor, decryptString); } } } // Check for tags if (Match("[")) { int num1 = fileData.IndexOf("]", cursor + 1); str1 = fileData.Substring(cursor + 1, num1 - cursor - 1); string[] tagArgs = str1.Split(new char[] { ' ' }); string tag = tagArgs[0]; if (IsTag(tag)) { SafeRemove(cursor, num1 - cursor + 1); bool flag = (str1.EndsWith("/") ? false : !str1.StartsWith("/")); string str4 = tag; string str5 = str4; if (str4 != null) { switch (str5) { case "junk_enable": { junkEnabled = true; junkDeclaresOnly = false; // If arguments are listed, (min and max lines) if (tagArgs.Length != 3) { if (tagArgs.Length != 4) { break; } this.junkMinLines = int.Parse(tagArgs[1]); this.junkMaxLines = int.Parse(tagArgs[2]); break; } else { // One parameter junkMaxLines = junkMinLines = int.Parse(tagArgs[1]); break; } } case "add_junk": { int minLines = 5; int maxLines = 10; if (tagArgs.Length == 3) { maxLines = minLines = int.Parse(tagArgs[1]); } else if (tagArgs.Length == 4) { minLines = int.Parse(tagArgs[1]); maxLines = int.Parse(tagArgs[2]); } SafeInsert(cursor, Junk.GenerateCode(minLines, maxLines)); break; } case "add_junk_datamembers": { int minLines = 5; int maxLines = 10; if (tagArgs.Length == 3) { maxLines = minLines = int.Parse(tagArgs[1]); } else if (tagArgs.Length == 4) { minLines = int.Parse(tagArgs[1]); maxLines = int.Parse(tagArgs[2]); } SafeInsert(cursor, Junk.GenerateDeclares(minLines, maxLines, false)); break; } case "add_junk_function": { int minArgs = 1; int maxArgs = 6; if (tagArgs.Length == 3) { maxArgs = minArgs = int.Parse(tagArgs[1]); } else if (tagArgs.Length == 4) { minArgs = int.Parse(tagArgs[1]); maxArgs = int.Parse(tagArgs[2]); } SafeInsert(cursor, Junk.GenerateFunctions(minArgs, maxArgs)); break; } case "add_junk_lambda": { int minArgs = 1; int maxArgs = 6; if (tagArgs.Length == 3) { maxArgs = minArgs = int.Parse(tagArgs[1]); } else if (tagArgs.Length == 4) { minArgs = int.Parse(tagArgs[1]); maxArgs = int.Parse(tagArgs[2]); } SafeInsert(cursor, Junk.GenerateLambda(minArgs, maxArgs)); break; } case "enc_string_enable": { escapeString = true; break; } case "enc_string_disable": { escapeString = false; break; } case "/swap_lines": { fromStack = GetFromStack("swap_lines"); string str6 = fileData.Substring(fromStack.pos, cursor - fromStack.pos); string[] newLine = new string[] { "\n" }; string[] strArrays1 = str6.Split(newLine, StringSplitOptions.None); string[] strArrays2 = new string[(int)strArrays1.Length - 2]; for (int k = 1; k < (int)strArrays1.Length - 1; k++) { strArrays2[k - 1] = strArrays1[k]; } strArrays2 = RandomStringArrays.RandomizeStrings(strArrays2); str = string.Concat(Environment.NewLine, string.Join(Environment.NewLine, strArrays2), Environment.NewLine); SafeRemove(fromStack.pos, fileData.Substring(fromStack.pos, cursor - fromStack.pos).Length); cursor = fromStack.pos; SafeInsert(fromStack.pos, str); break; } } } if (flag) { ParseItem parseItem = new ParseItem(tag, cursor); parseStack.Push(parseItem); } return; } } if (Match(";")) { int num6 = fileData.IndexOf("\n", cursor + 1); if (junkEnabled) { cursor = num6 + 1; SafeInsert(cursor, AddCode()); } } }