Exemple #1
0
        public void NewConfigDef()
        {
            ConfigDef configdef = new ConfigDef();

            configdef.Create();
            ConfigDefes.Add(configdef);
        }
Exemple #2
0
        private RequestDef PostData(ConfigDef Cd, RequestDef helper)
        {
            RequestDef R = new RequestDef();

            R.configdef = Cd;
            R.Helper    = helper;
            R.PostData();
            return(R);
        }
Exemple #3
0
        public void ExecuteRequestInstruction(Instruction line)
        {
            RequestDef RD = Controller.GetLastRequestDef();

            switch (line.Type)
            {
            case OpCode.RequestManage:

                string[] Rs = line.Value.Split('.');

                ConfigDef  cd     = Controller.GetConfigdef(int.Parse(Rs[0]));
                RequestDef helper = null;
                if (Rs.Length >= 3)
                {
                    try
                    {
                        if (Rs[2] == "this")
                        {
                            helper = RD;
                        }
                        else
                        {
                            helper = Controller.GetRequestDef(int.Parse(Rs[2]));
                        }
                    }
                    catch { }
                }

                if (Rs[1].ToLower() == "getdata")
                {
                    RD = GetData(cd, helper);
                }
                else if (Rs[1].ToLower() == "postdata")
                {
                    RD = PostData(cd, helper);
                }

                break;

            case OpCode.MemoryString:
                if (line.Value.ToLower().StartsWith("regex"))
                {
                    Controller.AddMemodyString(ParseRegex(line.Value));
                }
                else if (line.Value.ToLower() == "sourcepage")
                {
                    Controller.AddMemodyString(RD.GetSourcePage());
                }
                else if (line.Value.ToLower() == "cookies")
                {
                    Controller.AddMemodyString(RD.GetCookies());
                }
                else
                {
                    Controller.AddMemodyString(line.Value);
                }
                break;

            case OpCode.Ret:
                string val = line.Value;
                if (line.Value.ToLower().StartsWith("regex"))
                {
                    val = ParseRegex(line.Value);
                }
                else if (line.Value.ToLower() == "sourcepage")
                {
                    val = RD.GetSourcePage();
                }
                else if (line.Value.ToLower() == "cookies")
                {
                    val = RD.GetCookies();
                }
                line.Value = val;
                ParseRetModule(line);
                break;

            case OpCode.SetConfig:
                string[]    Res    = line.Value.Split(':');
                ConfigDef   cr     = Controller.GetConfigdef(int.Parse(Res[0]));
                int         indexd = line.Value.IndexOf(':');
                Instruction doc    = Instruction.ReadLine(line.Value.Substring(indexd + 1, line.Value.Length - indexd - 1));
                SetConfig(doc, cr);
                break;

            default:
                CMD.OutPuter.AddMessage("The" + line.Type.ToString() + " Module not support on Request method");
                break;
            }
            Controller.SetLastRequestDef(RD);
        }
Exemple #4
0
        private void SetConfig(Instruction line, ConfigDef config)
        {
            switch (line.Type)
            {
            case OpCode.URL:
                string[] URLs = line.Value.Split('|');
                if (URLs.Length == 2 && URLs[1] == "1")
                {
                    config.SetURL(line.Value, true);
                }
                else
                {
                    config.SetURL(line.Value);
                }
                break;

            case OpCode.UserAgent:
                config.SetUserAgent(line.Value);
                break;

            case OpCode.Referer:
                config.SetReferer(line.Value);
                break;

            case OpCode.KeepAlive:
                config.SetKeepAlive(line.Value);
                break;

            case OpCode.Method:
                config.SetMethod(line.Value);
                break;

            case OpCode.DataSet:
                config.SetDataSet(line.Value);
                break;

            case OpCode.PostData:
                config.SetPostData(line.Value);
                break;

            case OpCode.Cookies:
                config.SetCookes(line.Value);
                break;

            case OpCode.ContectType:
                config.SetContectType(line.Value);
                break;

            case OpCode.AllowAutoRedirect:
                config.SetAllowAutoRedirect(line.Value);
                break;

            case OpCode.AddAuthorization:
                config.AddAuthorization(line.Value);
                break;

            case OpCode.Headers:
                config.SetHeaders(line.Value);
                break;

            case OpCode.AddHeader:
                config.AddHeaders(line.Value);
                break;

            case OpCode.TimeOut:
                config.SetTimeOut(line.Value);
                break;

            case OpCode.Gzip:
                config.SetGzipDecomprossor(line.Value);
                break;

            default:
                CMD.OutPuter.AddMessage("The " + line.Type.ToString() + " Module not support on Config method");
                break;
            }
        }