示例#1
0
        public override bool Run()
        {
            IFuzzerPayload payload = (IFuzzerPayload)Payload;

            // Make script with inherited class
            ScriptHelper scripts = ScriptHelper.CreateFromFile(Script.FullName, new ScriptHelper.ScriptOptions()
            {
                includeUsings = new string[]
                {
                    "XPloit.Core.Extensions",
                    "XPloit.Core.Helpers"
                },
                IncludeFiles = new string[]
                {
                    typeof(ScriptClass).Assembly.Location,    // XPloit.Modules
                    typeof(Module).Assembly.Location          // XPloit.Core
                },
                Inherited = new Type[]
                {
                    typeof(StreamFuzzer.ScriptClass)
                }
            });

            WriteInfo("Loading file ...");
            string file = File.ReadAllText(Script.FullName, Encoding.ASCII);

            WriteInfo("File loaded", StringHelper.Convert2KbWithBytes(file.Length), System.ConsoleColor.Green);

            for (int max = To, st = Math.Max(Step, 1); From <= max; From += st)
            {
                WriteInfo("Checking ", From.ToString(), ConsoleColor.Green);

                byte[] data;

                if (CreatePattern)
                {
                    data = PatternHelper.CreateRaw(From);
                }
                else
                {
                    data = new byte[From];
                    for (int x = data.Length - 1; x >= 0; x--)
                    {
                        data[x] = (byte)NotPatternChar;
                    }
                }

                ScriptClass obj = scripts.CreateNewInstance <ScriptClass>();
                obj.Encoding = Encoding;

                try
                {
                    obj.Stream = payload.CreateStream(data);
                    obj.Run(data);
                    obj.Dispose();

                    CopyPropertiesToActiveModule("From");
                }
                catch (Exception e)
                {
                    WriteInfo("Good news :) Payload send fail!");
                    WriteError(e.Message);
                    return(true);
                }
            }

            return(true);
        }