public void PromptParameters()
        {
PrompIndex:
            string r = UI.Prompt("What you want to print? \n \t \t Enter [bflg] to BruteForce List OR [csa] to Assemble multiple pipes into a Complex String Assembler ").Trim().ToLower();

            switch (r)
            {
            case "csa":
            case "c":
                CSA c = UI.Lab?.Request <CSA>();
                if (c == null)
                {
                    c = new(UI);
                    c.PromptParameters();
                }
                Pipe = c;
                break;

            case "bflg":
            case "b":
                BFLG b = UI.Lab?.Request <BFLG>();
                if (b == null)
                {
                    b = new(UI);
                    b.PromptParameters();
                }
                Pipe = b;
                break;

            default:
                goto PrompIndex;
            }
        }
        private void RunCSA()
        {
            CSA csa = new CSA(UI);

            csa.PromptParameters();
            csa.BuildFromParameters();

            foreach (string s in csa.GenerateEnumerable())
            {
                UI.Log(s);
            }
        }
        public void PromptParameters()
        {
            UI.Log("");
            UI.Log("    . . . . . . . . . . . . . . . .  .  ");
            UI.Log("               Methane                  ");
            UI.Log("            Bulk HTTP GET               ");
            UI.Log("    . . . . . . . . . . . . . . . .  .  ");
            UI.Log("");


ChooseCookies:
            Cookie = UI.Prompt("Enter cookies to use OR Enter ~filename to read cookies OR [Enter] not to use cookies");

            HasCookie = Cookie.Length > 0;
            if (Cookie.StartsWith('~'))
            {
                if (Cookie == "~")
                {
                    Cookie = "~cookie.txt";
                }
                try
                {
                    Cookie = File.ReadAllText(Cookie.TrimStart('~'));
                }
                catch (Exception ex)
                {
                    UI.LogError(ex);
                    goto ChooseCookies;
                }
            }


ChooseHeaders:
            Headers = UI.Prompt("Enter Headers to use OR Enter ~filename to read Headers OR [Enter] not to use Headers");

            HasHeaders = Headers.Length != 0;
            if (Headers.StartsWith('~'))
            {
                if (Headers == "~")
                {
                    Headers = "~headers.txt";
                }
                try
                {
                    Headers = File.ReadAllText(Headers.TrimStart('~'));
                }
                catch (Exception ex)
                {
                    UI.LogError(ex);
                    goto ChooseHeaders;
                }
            }

            findWith       = UI.Prompt("In a positive response, what text we would find? (Ex :- Wellcome) [or null]");
            hasFindWith    = findWith.Length > 0;
            findWithout    = UI.Prompt("In a positive response, what text we won't find? (Ex :- Wrong password) [or null]");
            hasFindWithout = findWithout.Length > 0;

            UI.Log("Please use the following tool to create GET url data string list");
            csa = UI.Lab?.Request <CSA>();
            if (csa == null)
            {
                csa = new CSA(UI);
                csa.PromptParameters();
            }


PromtHowManyThreads:
            if (!int.TryParse(UI.Prompt("How many threads to use?"), out AllowedThrds))
            {
                goto PromtHowManyThreads;
            }

            UI.Log("Rapid GETer standby    :-) ");
        }
Beispiel #4
0
        public void PromptParameters()
        {
            UI.Log("");
            UI.Log("    . . . . . . . . . . . . . . . .  .  ");
            UI.Log("               Methane                  ");
            UI.Log("            Bulk File Operation         ");
            UI.Log("    . . . . . . . . . . . . . . . .  .  ");
            UI.Log("");



ChooseOutputPath:

            OutputPath = UI.Prompt("Enter output path (Directory) or ~ to use  \"Output/\" ");
            if (OutputPath == "~")
            {
                OutputPath = "Output/";
            }

            try
            {
                if (!string.IsNullOrEmpty(OutputPath))
                {
                    Directory.CreateDirectory(OutputPath);
                    if (!OutputPath.EndsWith('/'))
                    {
                        OutputPath += '/';
                    }
                }
            }
            catch (Exception ex)
            {
                UI.LogError(ex);
                goto ChooseOutputPath;
            }

            bool AllowMultithreading = true;

            operations = new List <Action <string, string> >();

            UI.Log("Please use the following tool to create File name list");

            csa = UI.Lab?.Request <CSA>();
            if (csa == null)
            {
                csa = new CSA(UI);
                csa.PromptParameters();
            }


SelectOp:
            UI.Log("\t \tFile operations are");
            UI.Log("\t \t \t copy. Copy file");
            UI.Log("\t \t \t move. Move file");
            UI.Log("\t \t \t delete. Delete file");
            UI.Log("\t \t \t mkdir. Create new Directory");
            UI.Log("\t \t \t rmdir. Delete Directory with content");
            UI.Log("\t \t \t merge. Merge files to create one file");
            UI.Log("\t \t \t aes. Encrypt or Decrypt file AES");

            string op = UI.Prompt("Enter Index of Operation to use");

            // operations.Add((string inpath, string outpath) => { });
            switch (op)
            {//
            case "copy":
                operations.Add(new Action <string, string>((infile, outpath) =>
                {
                    outpath += Path.GetFileName(infile);
                    File.Copy(infile, outpath, true);
                    UI.Log("Copied " + infile + " -> " + outpath);
                }));
                break;

            case "move":
                operations.Add(new Action <string, string>((infile, outpath) =>
                {
                    outpath += Path.GetFileName(infile);
                    File.Move(infile, outpath);
                    UI.Log("Moved " + infile + " -> " + outpath);
                }));
                break;

            case "delete":
                operations.Add(new Action <string, string>((infile, outpath) =>
                {
                    File.Delete(infile);
                    UI.Log("Deleted " + infile);
                }));
                break;

            case "mkdir":
                operations.Add(new Action <string, string>((infile, outpath) =>
                {
                    Directory.CreateDirectory(infile);
                    UI.Log("Created " + infile);
                }));
                break;

            case "rmdir":
                operations.Add(new Action <string, string>((infile, outpath) =>
                {
                    Directory.Delete(infile, true);
                    UI.Log("Deleted" + infile);
                }));
                break;

            case "aes":
                string aesKey = UI.Prompt("Enter encryption key in BASE64 or ~filename to read it from file");
                byte[] key;
                if (aesKey.StartsWith('~'))
                {
                    aesKey = aesKey.TrimStart('~');
                    if (File.Exists(aesKey))
                    {
                        try
                        {
                            key = File.ReadAllBytes(aesKey);
                        }
                        catch (Exception ex)
                        {
                            UI.LogError(ex, "Cannot read key file");
                            goto SelectOp;
                        }
                    }
                    else
                    {
                        UI.Log($"File not found  - {aesKey}");
                        goto SelectOp;
                    }
                }
                else
                {
                    key = Convert.FromBase64String(aesKey);
                }

                string aesIV = UI.Prompt("Enter IV in BASE64 or ~filename to read it from file or just [Enter] to use 16 null bytes");
                byte[] IV;
                if (aesIV.StartsWith('~'))
                {
                    aesIV = aesIV.TrimStart('~');
                    if (File.Exists(aesIV))
                    {
                        try
                        {
                            IV = File.ReadAllBytes(aesIV);
                        }
                        catch (Exception ex)
                        {
                            UI.LogError(ex, "Cannot read IV file");
                            goto SelectOp;
                        }
                    }
                    else
                    {
                        UI.Log($"File not found  - {aesIV}");
                        goto SelectOp;
                    }
                }
                else if (string.IsNullOrEmpty(aesIV))
                {
                    IV = new byte[16];
                }
                else
                {
                    IV = Convert.FromBase64String(aesIV);
                }

                AesRij aes = new AesRij(key, IV);

                if (UI.Prompt("[e]ncrypt or [D]ecrypt ? (Enter char)").ToLower() == "e")
                {
                    operations.Add(new Action <string, string>((infile, outpath) =>
                    {
                        outpath += Path.GetFileName(infile);
                        if (File.Exists(infile))
                        {
                            try
                            {
                                File.WriteAllBytes(outpath, aes.Encrypt(File.ReadAllBytes(infile)));
                                UI.Log("Encrypted " + infile + " -> " + outpath);
                            }
                            catch (Exception ex)
                            {
                                UI.LogError(ex, $"Error while Encrypting in bulk - File {infile} to {outpath}");
                            }
                        }
                        else
                        {
                            UI.Log($"File not found {infile}");
                        }
                    }));
                }
                else
                {
                    operations.Add(new Action <string, string>((infile, outpath) =>
                    {
                        outpath += Path.GetFileName(infile);
                        if (File.Exists(infile))
                        {
                            try
                            {
                                File.WriteAllBytes(outpath, aes.Decrypt(File.ReadAllBytes(infile)));
                                UI.Log("Decrypted " + infile + " -> " + outpath);
                            }
                            catch (Exception ex)
                            {
                                UI.LogError(ex, $"Error while Encrypting in bulk - File {infile} to {outpath}");
                            }
                        }
                        else
                        {
                            UI.Log($"File not found {infile}");
                        }
                    }));
                }

                break;

            case "merge":
                AllowMultithreading = false;
                operations.Add(new Action <string, string>((infile, outpath) =>
                {
                    outpath += "Merged" + Path.GetExtension(infile);
                    using (var stream = new FileStream(outpath, FileMode.Append))
                    {
                        Stream ins = File.OpenRead(infile);
                        ins.CopyTo(stream);
                        stream.Close();
                        ins.Close();
                    }
                    UI.Log("Merge " + infile + " -> " + outpath);
                }));
                break;

            default:
                UI.Log("Invalid selection");
                goto SelectOp;
            }

            if (AllowMultithreading)
            {
PromptHowManyThreads:
                if (!int.TryParse(UI.Prompt("How many threads to use?"), out AllowedThrds))
                {
                    goto PromptHowManyThreads;
                }
            }
            else
            {
                AllowedThrds = 1;
            }
            UI.Log("File operations standby    :-) ");
        }
        public void PromptParameters()
        {
            found        = false;
            runningThrds = 0;

            UI.Log("---------------------------------");
            UI.Log("|           Methane             |");
            UI.Log("|     Rapid HTTP Request        |");
            UI.Log("|           POSTer              |");
            UI.Log("---------------------------------");

            url = UI.Prompt("Enter Request URL (Ex :- http://DamnWebSite.com/admin/userlogin.php ) : ");

ChooseCookies:
            Cookie = UI.Prompt("Enter cookies to use OR Enter ~filename to read cookies OR [Enter] not to use cookies");

            HasCookie = Cookie.Length != 0;
            if (Cookie.StartsWith('~'))
            {
                if (Cookie == "~")
                {
                    Cookie = "~cookie.txt";
                }
                try
                {
                    Cookie = File.ReadAllText(Cookie.TrimStart('~'));
                }
                catch (Exception ex)
                {
                    UI.LogError(ex);
                    goto ChooseCookies;
                }
            }

ChooseHeaders:
            Headers = UI.Prompt("Enter Headers to use OR Enter ~filename to read Headers OR [Enter] not to use Headers");

            HasHeaders = Headers.Length != 0;
            if (Headers.StartsWith('~'))
            {
                if (Headers == "~")
                {
                    Headers = "~headers.txt";
                }
                try
                {
                    Headers = File.ReadAllText(Headers.TrimStart('~'));
                }
                catch (Exception ex)
                {
                    UI.LogError(ex);
                    goto ChooseHeaders;
                }
            }


            findWith       = UI.Prompt("In a positive response, what text we would find? (Ex :- Wellcome) [or null]");
            hasFindWith    = findWith.Length != 0;
            findWithout    = UI.Prompt("In a positive response, what text we won't find? (Ex :- Wrong password) [or null]");
            hasFindWithout = findWithout.Length != 0;

            UI.Log("Please use the following tool to create POST body data string list");
            csa = UI.Lab?.Request <CSA>();
            if (csa == null)
            {
                csa = new CSA(UI);
                csa.PromptParameters();
            }


PromtHowManyThreads:
            if (!int.TryParse(UI.Prompt("How many threads to use?"), out AllowedThrds))
            {
                goto PromtHowManyThreads;
            }

            UI.Log("Rapid POSTer standby    :-) ");
        }