public virtual bool perform()
        {
            string user = MakeRandomQQ();
            string pass = MakeRandomPassowrd();
            Dictionary <string, string> form = MakeWebform(user, pass);
            string    httpkeyvalue           = MakeHttpKeyValue(form);
            string    result    = "";
            bool      success   = false;
            Exception exception = null;

            try
            {
                HttpWebRequest request = CreateRequest(httpkeyvalue);
                result  = BomberUtils.GetHttpResponse(request);
                success = true;
            }
            catch (Exception ex)
            {
                exception = ex;
                result    = ex.Message;
            }
            if (OnBomberComplete != null)
            {
                OnBomberComplete.Invoke(this, new BomberResultEventArgs(success, user, pass, BaseUrl, result, exception));
            }
            return(success);
        }
        public virtual Dictionary <string, string> MakeWebform(string user, string pass)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add(UserKey, BomberUtils.UrlEncode(user));
            dic.Add(PassowordKey, BomberUtils.UrlEncode(pass));
            return(dic);
        }
Example #3
0
        public bool perform()
        {
            try
            {
                string url;
                string method;
                string content;

                string printcontent;

                lock (machine)
                {
                    machine.Reset();
                    machine.Run();
                    url          = machine.runtimeRegister["提交URL"];
                    method       = machine.runtimeRegister["提交方法"];
                    content      = machine.runtimeRegister["提交内容"];
                    printcontent = this.printContent.ToString();
                    printContent.Clear();
                }
                HttpWebRequest        req    = BomberUtils.MakeHttpRequest(url, content, method);
                string                result = BomberUtils.GetHttpResponse(req);
                BomberResultEventArgs args   = new BomberResultEventArgs(true, "", "", printcontent, result, null);
                if (null != OnBomberComplete)
                {
                    OnBomberComplete.Invoke(this, args);
                }
                return(true);
            }
            catch (Exception ex)
            {
                BomberResultEventArgs args = new BomberResultEventArgs(false, "", "", "", ex.Message, ex);
                if (null != OnBomberComplete)
                {
                    OnBomberComplete.Invoke(this, args);
                }
                return(false);
            }
        }
 public virtual HttpWebRequest CreateRequest(string httpKeyValue)
 {
     return(BomberUtils.MakeHttpRequest(BaseUrl, httpKeyValue, HttpMethod));
 }
 public virtual string MakeHttpKeyValue(Dictionary <string, string> dic)
 {
     return(BomberUtils.DictionaryToHttpKeyValue(dic));
 }
 public virtual string MakeRandomPassowrd()
 {
     return(BomberUtils.RandomPassword());
 }
 public virtual string MakeRandomQQ()
 {
     return(BomberUtils.RandomQQNumber());
 }