近日玩网页游戏七雄争霸,觉得还可以,但是玩起来太累,所以想自己开发个辅助试试

从网上找到了个《流年网页游戏辅助VIP系列教程》,看了下,遇到了一个问题

特来请高手指点。。。。。。

代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Web;
using System.Net.Sockets;
using System.IO;
using FluorineFx;
using FluorineFx.IO;
using FluorineFx.Messaging;
using FluorineFx.Messaging.Messages;
using FluorineFx.AMF3;
using FluorineFx.Net;
using System.Threading;

namespace 异步传输
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

private void Btn_CLose_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

public static byte[] bbb;
        public static byte[] ZuiZhong;
        private void Btn_ShengChengAmf_Click(object sender, EventArgs e)
        {
            txt_log.Clear();
            ByteArray g = new ByteArray();//声明一个byteArray数组

AMFMessage _amf3 = new AMFMessage(3);//定义一条AMF消息

AMFBody _amfbody = new AMFBody(txt_Target.Text, txt_Respones.Text,null);//定义一个body消息
            _amf3.AddBody(_amfbody);
            MemoryStream _Memory = new MemoryStream();//内存流
            AMFSerializer _Serializer = new AMFSerializer(_Memory);//序列化
            _Serializer.WriteMessage(_amf3);//将消息写入
         
          
            byte[] _buffer = _Memory.ToArray();
            txt_LogAmf.Text = System.BitConverter.ToString(_buffer).ToString();

byte[] pinjie = { 00, 00, 00, 12, 10, 00, 00, 00, 01, 17, 12, 09, 48, 130, 174, 83 };//需要拼接的参数
            byte[] data3 = new byte[_buffer.Length + pinjie.Length - 5];//定义data3的长度

System.Array.Copy(_buffer, 0, data3, 0, _buffer.Length - 5);//复制两个字节数组到一个字节数组,复制到data3
            System.Array.Copy(pinjie, 0, data3, _buffer.Length - 5, pinjie.Length);//↑

bbb = data3;            
txt_LogAll.Text = System.BitConverter.ToString(data3);//将data3转换成为16进制
            foreach (byte uu in data3)
            {
                txt_LogString.Text += uu.ToString()+";";//遍历data3中的十进制字节
            }
            foreach (byte jj in _buffer)
            {
                txt_log.Text += jj.ToString() + "\r\n";
        
                
            }
         
        }

private void btn_AllClearn_Click(object sender, EventArgs e)
        {
            txt_LogAmf.Clear();
            txt_log.Clear();
        }

//用Socket发送消息的封装类定义
        public class SocketSendReceiveMs
        {
            public AutoResetEvent ThreadEvent = new AutoResetEvent(false);
         
            public byte[] recvBytes = new byte[1024];
            public MemoryStream Stream1 = new MemoryStream();
            public Socket c;
            public AMFMessage SendMsg;
            public AcknowledgeMessage ReceMsg;

public object ReslutValue = null;
            public SocketSendReceiveMs()//构造函数
            {
                c = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                c.ReceiveTimeout = 100;
            }
        }        
    
        private void Btn_SendAMF_Click(object sender, EventArgs e)
        {
         
            SocketSendReceiveMs ssrems = new SocketSendReceiveMs();
            
            string sendString = "POST /dynasty/messagebroker/amf HTTP/1.1\r\nAccept: */*\r\nAccept-Language: zh-CN\r\nReferer:" + txt_Referer.Text.Trim() + "\r\nx-flash-version: 11,5,502,110\r\nContent-Type: application/x-amf\r\nAccept-Encoding: gzip, deflate\r\nHost:"+txt_Host.Text+"\r\n"
                + "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; EmbeddedWB 14.52 from: http://www.bsalsa.com/ EmbeddedWB 14.52; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)\r\n"
                + "Connection: Keep-Alive\r\nContent-Length:57\r\n"
                + "Cache-Control: no-cache\r\n"
                + "Cookie:" + txt_Cook.Text.Trim() + "\r\n\r\n";

Byte[] ByteGet = Encoding.ASCII.GetBytes(sendString);
    
            MemoryStream _MemoryStream = new MemoryStream();
            _MemoryStream.Write(ByteGet, 0, ByteGet.Length);
            _MemoryStream.Write(bbb, 0, bbb.Length);
            IPAddress _ip = IPAddress.Parse(txt_Ip.Text);
            IPEndPoint EPhost = new IPEndPoint(_ip, 80);

ssrems.c = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            try
            {
                ssrems.c .Connect(EPhost);
            }
            catch
            {
                MessageBox.Show("对不起,链接出错!请检查网络链接!");
            }
            if (!ssrems.c.Connected)
            {

MessageBox.Show("链接失败!");
            }
            try
            {

ssrems.c.Send(_MemoryStream.ToArray(), _MemoryStream.ToArray().Length, 0);
                ssrems.ThreadEvent.WaitOne(6000);
            }
            catch
            {
                MessageBox.Show("sorry!SendMessage Erro!");
            }
            try
            {
           
                ssrems.c.BeginReceive(ssrems.recvBytes, 0, 1024, SocketFlags.None, new AsyncCallback(EX), ssrems);

}
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        
        public void EX(IAsyncResult ar)
        {
            SocketSendReceiveMs tmpSRMsg = (SocketSendReceiveMs)ar.AsyncState;
            int re = 0;

try
            {
                re = tmpSRMsg.c.EndReceive(ar);

tmpSRMsg.ThreadEvent.Set();
            }
            catch (Exception se)
            {
                MessageBox.Show("错误" + se.Message, "提示信息", MessageBoxButtons.RetryCancel, MessageBoxIcon.Information);
            }
        
           
        }

private void Form1_Load(object sender, EventArgs e)
        {
            if (File.Exists(Application.StartupPath + "/文本信息.txt"))
            {
                string hh = File.ReadAllText(Application.StartupPath + "/文本信息.txt", UTF8Encoding.UTF8);
                string[] _ShuZu = hh.Split('~');
                txt_Cook.Text = _ShuZu[0].ToString();
                txt_Host.Text = _ShuZu[2].ToString();
                txt_Referer.Text = _ShuZu[1].ToString();
                txt_Ip.Text = _ShuZu[3].ToString();
                txt_Respones.Text = _ShuZu[4].ToString();
                txt_Target.Text = _ShuZu[5].ToString();
            }
            else
            {
                return;
            }
        }

private void Btn_SavePeiZhi_Click(object sender, EventArgs e)
        {
            string str = string.Format("{0}~{1}~{2}~{3}~{4}~{5}~",
                txt_Cook.Text,
                txt_Referer.Text,
                txt_Host.Text,
                txt_Ip.Text,
                txt_Respones.Text,
                txt_Target.Text);

File.WriteAllText(Application.StartupPath + "/文本信息.txt", str, UTF8Encoding.UTF8);

}

private void Btn_Close_Click_1(object sender, EventArgs e)
        {
            Application.Exit();
        }

}
}

标红的地方即为不明之处。
生成了AMF消息,序列化为字节数组。
“byte[] pinjie = { 00, 00, 00, 12, 10, 00, 00, 00, 01, 17, 12, 09, 48, 130, 174, 83 };//需要拼接的参数”,从何而来,又是干什么用的。
水平有限
请高手指点

FluorineFx.IO.AMFMessage的更多相关文章

  1. 模拟登录,发送amf类型数据

    参考 http://blog.csdn.net/amandag/article/details/5666219 以及 稍微修改了一下AMFPost的类     一.登录 登录过程中主要用到标红的3个请 ...

  2. VS2015编译GEOS

    下载链接:http://trac.osgeo.org/geos/ 1. 打开cmake,加载geos源码和定位geos的工程存放位置: 2.点击configure,会报错,首先设置CMAKE_INST ...

  3. 利用FluorineFx的ByteArray上传图片

    Flex端利用new PNGEncoder().encode(bitmapData)将png图片转换为ByteArray,然后传给服务器,服务端需要定义一个public ByteArray Uploa ...

  4. 高性能IO模型浅析

    高性能IO模型浅析 服务器端编程经常需要构造高性能的IO模型,常见的IO模型有四种: (1)同步阻塞IO(Blocking IO):即传统的IO模型. (2)同步非阻塞IO(Non-blocking  ...

  5. 深究标准IO的缓存

    前言 在最近看了APUE的标准IO部分之后感觉对标准IO的缓存太模糊,没有搞明白,APUE中关于缓存的部分一笔带过,没有深究缓存的实现原理,这样一本被吹上天的书为什么不讲透彻呢?今天早上爬起来赶紧找了 ...

  6. [APUE]标准IO库(下)

    一.标准IO的效率 对比以下四个程序的用户CPU.系统CPU与时钟时间对比 程序1:系统IO 程序2:标准IO getc版本 程序3:标准IO fgets版本 结果: [注:该表截取自APUE,上表中 ...

  7. [APUE]标准IO库(上)

    一.流和FILE对象 系统IO都是针对文件描述符,当打开一个文件时,即返回一个文件描述符,然后用该文件描述符来进行下面的操作,而对于标准IO库,它们的操作则是围绕流(stream)进行的. 当打开一个 ...

  8. [.NET] 利用 async & await 进行异步 IO 操作

    利用 async & await 进行异步 IO 操作 [博主]反骨仔 [出处]http://www.cnblogs.com/liqingwen/p/6082673.html  序 上次,博主 ...

  9. [原] KVM 虚拟化原理探究(6)— 块设备IO虚拟化

    KVM 虚拟化原理探究(6)- 块设备IO虚拟化 标签(空格分隔): KVM [toc] 块设备IO虚拟化简介 上一篇文章讲到了网络IO虚拟化,作为另外一个重要的虚拟化资源,块设备IO的虚拟化也是同样 ...

随机推荐

  1. Codeforces 903D Almost Difference

    Codeforces 903D Almost Difference time limit per test 2 seconds memory limit per test 256 megabytes ...

  2. Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2)(A.思维题,B.思维题)

    A. Vicious Keyboard time limit per test:2 seconds memory limit per test:256 megabytes input:standard ...

  3. hdu3076—概率dp

    hdu3076-概率dp 标签 : 概率dp 题目链接 题意: 2个人分别有AB的血数,轮流扔骰子,数小的自减一血,平的不变,谁先到减0, 谁输,问A赢的概率. 题解: dp[i][j]表示的是第一个 ...

  4. C#应用程序运行到linux【CentOS】

    具体的操作方法在linux.Net中.最近要部署网站在centOS,以及测试下小程序跑到上面.刚好实现了一番 说说C#应用程序如何跑到centOS.非常的简单. 1.准备工具“AnyExec”[工具在 ...

  5. mysql 批量更新与批量更新多条记录的不同值实现方法

    作者: 字体:[增加 减小] 类型:转载 时间:2013-10-02 我要评论 在mysql中批量更新我们可能使用update,replace into来操作,下面小编来给各位同学详细介绍mysql ...

  6. jsp中${}

    jsp中${}----是EL表达式的常规表示方式目的是为了获取{}中指定的对象(参数.对象等)的值 如:${user.name}<====>User user = (User)reques ...

  7. PostgreSql问题:ERROR: operator does not exist: timestamp without time zone > character varying

    问题描述: ERROR:  operator does not exist: timestamp without time zone > character varying 解决方法: //注意 ...

  8. javascript如何自动去除所有空格?

    1.jquery自带了trim方法:    $.trim(" abc ") // abc 2.自己写方法: function trim(str) { return str.repl ...

  9. 使用“消息服务框架”(MSF)实现分布式事务的三阶段提交协议(电商创建订单的示例)

    1,示例解决方案介绍 在上一篇 <消息服务框架(MSF)应用实例之分布式事务三阶段提交协议的实现>中,我们分析了分布式事务的三阶段提交协议的原理,现在我们来看看如何使用消息服务框架(MSF ...

  10. python_如何为元组中每个元素命名

    学生信息系统: (名字,年龄,性别,邮箱地址) 为了减少存储开支,每个学生的信息都以一个元组形式存放 如: ('tom', 18,'male','tom@qq.com' ) ('jom', 18,'m ...