예제 #1
0
        void NewFile()
        {
            saveToolStripMenuItem.Enabled = false;
            _LastFile = "";

            MutationConfig c = new MutationConfig();

            c.Mutations.Add(new MutationalOffset());
            _Cur = c;
            propertyGrid1.SelectedObject = _Cur;
            propertyGrid1.ExpandAllGridItems();
        }
예제 #2
0
        public void LoadConfig(IFuzzingConfig cfg)
        {
            _Cur = cfg;

            if (_Cur != null)
            {
                propertyGrid1.SelectedObject = _Cur;
                propertyGrid1.ExpandAllGridItems();

                saveToolStripMenuItem.Enabled = true;
            }
        }
예제 #3
0
        FuzzingStream GetRandomStream(OpenStreamMessageRequest msg, TuringSocket sender, bool fuzzer, Guid id)
        {
            FuzzerStat <IFuzzingInput> sinput = RandomHelper.GetRandom(Inputs);

            MemoryStream  binput = null;
            IFuzzingInput input  = sinput == null ? null : sinput.Source;

            if (input != null)
            {
                if (sender["INPUT"] == null)
                {
                    List <FuzzerStat <IFuzzingInput> > ls = new List <FuzzerStat <IFuzzingInput> >();
                    ls.Add(sinput);
                    sender["INPUT"] = ls;
                }
                else
                {
                    List <FuzzerStat <IFuzzingInput> > ls = (List <FuzzerStat <IFuzzingInput> >)sender["INPUT"];
                    ls.Add(sinput);
                }
            }

            if (input != null && !(input is EmptyFuzzingInput))
            {
                binput = new MemoryStream(input.GetStream());
            }
            else
            {
                binput = new MemoryStream();
            }

            FuzzingStream ret = null;

            if (fuzzer)
            {
                FuzzerStat <IFuzzingConfig> sconfig = RandomHelper.GetRandom(Configurations);

                if (sconfig != null && sconfig != null)
                {
                    IFuzzingConfig config = sconfig.Source;
                    if (sconfig == null)
                    {
                        throw (new Exception("Require fuzzer configuration"));
                    }

                    if (sender["CONFIG"] == null)
                    {
                        List <FuzzerStat <IFuzzingConfig> > ls = new List <FuzzerStat <IFuzzingConfig> >();
                        ls.Add(sconfig);
                        sender["CONFIG"] = ls;
                    }
                    else
                    {
                        List <FuzzerStat <IFuzzingConfig> > ls = (List <FuzzerStat <IFuzzingConfig> >)sender["CONFIG"];
                        ls.Add(sconfig);
                    }

                    ret = new FuzzingStream(binput, config);
                    if (ret != null)
                    {
                        ret.InputName  = sinput == null ? "None" : sinput.ToString();
                        ret.ConfigName = sconfig.ToString();
                    }
                }
            }

            if (ret == null)
            {
                // Disable Fuzzing
                if (binput == null)
                {
                    ret = new FuzzingStream(new MemoryStream(), null)
                    {
                        InputName = sinput == null ? "None" : sinput.ToString()
                    }
                }
                ;
                else
                {
                    ret = new FuzzingStream(binput, null)
                    {
                        InputName = sinput == null ? "None" : sinput.ToString()
                    }
                };
            }

            //if (!msg.RequireStream)
            //{
            //    ret.CanRead = msg.CanRead;
            //    ret.CanSeek = msg.CanSeek;
            //    ret.CanTimeout = msg.CanTimeout;
            //    ret.CanWrite = msg.CanWrite;
            //}

            return(ret);
        }
    }