コード例 #1
0
ファイル: Form1.cs プロジェクト: whoami2323/MazzCrypt
 private void testShitHereToolStripMenuItem_Click(object sender, EventArgs e)
 {
     MessageBox.Show(Junk.GenerateCode());
 }
コード例 #2
0
ファイル: BaseFile.cs プロジェクト: whoami2323/MazzCrypt
        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());
                }
            }
        }