现在的位置: 首页 > 综合 > 正文

网站提交测试–游戏网站转生操作模拟

2018年03月19日 ⁄ 综合 ⁄ 共 3968字 ⁄ 字号 评论关闭

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Text.RegularExpressions;

namespace ZSMU
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            WebClient client = new WebClient();

            client.Headers.Add("Accept", "*/*");
            client.Headers.Add("Accept-Encoding", "gzip, deflate");
            client.Headers.Add("Accept-Language", "zh-cn");
            client.Headers.Add("Cache-Control", "no-cache");
            client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");//必填项目
            //myWebClient.Headers.Add("Connection", "Keep-Alive");
            client.Headers.Add("Referer", "http://www53.292mu.com/usezs.asp");

            byte[] byteArray = Encoding.Default.GetBytes("mfkuserchr=%C2%BD%C9%CF%B5%C4%D3%E3&mfkusername=admin&mfkpassword=123456");//将提交的数据转化为byte数组

            string resposeData = Encoding.Default.GetString(client.UploadData("http://www53.292mu.com/usezs.asp", "post", byteArray));

            resposeData=resposeData.Remove(0, resposeData.IndexOf("alert('") + 7);
            resposeData=resposeData.Remove(resposeData.IndexOf(")") - 1);
            resposeData=resposeData.Replace("//n", "");
            client.Dispose();
            MessageBox.Show(resposeData);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            //http://www53.292mu.com/userjd.asp

 

            WebClient client = new WebClient();

            client.Headers.Add("Accept", "*/*");
            client.Headers.Add("Accept-Encoding", "gzip, deflate");
            client.Headers.Add("Accept-Language", "zh-cn");
            client.Headers.Add("Cache-Control", "no-cache");
            client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
            client.Headers.Add("Referer", "http://www53.292mu.com/userjd.asp");          

            byte[] byteArray = Encoding.Default.GetBytes("action=dl&userc=%C2%BD%C9%CF%B5%C4%D3%E3&usern=admin&passw=123456");

            string resposeData = Encoding.Default.GetString(client.UploadData("http://www53.292mu.com/userjd.asp", "post", byteArray));

            string str = client.ResponseHeaders[HttpResponseHeader.SetCookie];

            MatchCollection ms = Regex.Matches(resposeData, "<TD class=txt_gray width=/"133/"> (?<values>(.*)) 点");
            int shengyu = int.Parse(ms[0].Groups["values"].Value);
           

            WebClient client2 = new WebClient();
            client2.Headers.Add("Accept", "*/*");
            client2.Headers.Add("Accept-Encoding", "gzip, deflate");
            client2.Headers.Add("Accept-Language", "zh-cn");
            client2.Headers.Add("Cache-Control", "no-cache");
            client2.Headers.Add("Content-Type", "application/x-www-form-urlencoded");//必填项目
            client2.Headers.Add("Referer", "http://www53.292mu.com/userjd.asp");
            client2.Headers.Add(HttpRequestHeader.Cookie, str.Remove(str.LastIndexOf(";")));

            if (shengyu < 1732)
            {
                MessageBox.Show("当前点数小于1732。");
            }
            else
            {
                byteArray = Encoding.Default.GetBytes(string.Format("action=jd&llt={0}&mjt={1}&tlt={2}&zlt={3}", 232, 1500,0, shengyu - 1732));
                resposeData = Encoding.Default.GetString(client2.UploadData("http://www53.292mu.com/userjd.asp", "post", byteArray));
                resposeData = resposeData.Remove(0, resposeData.IndexOf("alert('") + 7);
                resposeData = resposeData.Remove(resposeData.IndexOf(")") - 1);
                resposeData = resposeData.Replace("//n", "");
                MessageBox.Show(resposeData);
            }

            client.Dispose();
            client2.Dispose();
          
        }

    }

}

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/sckoo/archive/2010/01/02/5122741.aspx

抱歉!评论已关闭.