惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
Jina AI
Jina AI
博客园_首页
J
Java Code Geeks
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 司徒正美
Hugging Face - Blog
Hugging Face - Blog
S
SegmentFault 最新的问题
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
L
Lohrmann on Cybersecurity
Forbes - Security
Forbes - Security
大猫的无限游戏
大猫的无限游戏
Vercel News
Vercel News
Y
Y Combinator Blog
Google DeepMind News
Google DeepMind News
The Register - Security
The Register - Security
N
News | PayPal Newsroom
S
Security Archives - TechRepublic
量子位
Cisco Talos Blog
Cisco Talos Blog
V
V2EX
C
Cisco Blogs
The Cloudflare Blog
Stack Overflow Blog
Stack Overflow Blog
L
LangChain Blog
Scott Helme
Scott Helme
S
Securelist
Security Latest
Security Latest
爱范儿
爱范儿
TaoSecurity Blog
TaoSecurity Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
I
Intezer
L
LINUX DO - 最新话题
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Check Point Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
美团技术团队
Know Your Adversary
Know Your Adversary
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
PCI Perspectives
PCI Perspectives
月光博客
月光博客
T
Tailwind CSS Blog
Cloudbric
Cloudbric
小众软件
小众软件
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
K
Kaspersky official blog
D
DataBreaches.Net
博客园 - 【当耐特】
有赞技术团队
有赞技术团队

博客园 - 鬼蝶[DFCG]

Mono.Cecil 修改目标.NET的IL代码保存时报异常的处理。 博文阅读密码验证 - 博客园 [转载]斐讯K2 A2版免TTL刷BREED不死Bootloader 博文阅读密码验证 - 博客园 各种UserAgent的列表 自制Console线(已测试CISCO3560可用) [转载]在Vmware ESXI中安装群晖Synology DSM 5.0 (4528) .NET 相关工具 GridView 绑定数据的常用指定格式。 .NET 4.5 HttpClient 中使用Cookie C# 实现快速闪电关机、快速重启 HttpWebRequest常用问题! WebBrowser处理AJAX生成的网页内容! HttpWebRequest请求超时的解决方案! 用正则表达式过滤HTML隐藏SPAN 正则表达式30分钟入门 [转载]Reflector反编译.NET文件后修复 未在本地计算机上注册“Microsoft.Jet.OLEDB.4.0”提供程序。 windows 2008r2解决此错误提示。 TT双拨脚本
AMF入门教程
鬼蝶[DFCG] · 2013-01-18 · via 博客园 - 鬼蝶[DFCG]

解释AMF数据可以采用FluorineFx.AMF3这个包,方法如下。 

FluorineFx.AMF3.ByteArray br = new FluorineFx.AMF3.ByteArray(new MemoryStream(bb));   
br.Position = 0;   
br.ReadShort();//amf版本   
br.ReadShort();//header数量   
br.ReadShort();//body数量   
br.ReadUTFBytes((uint)(br.ReadShort()));//target长度和字符串   
br.ReadUTFBytes((uint)(br.ReadShort()));//Response长度和字符串   
br.ReadInt();//body长度   
br.ReadByte();//body类型   
object o = br.ReadObject();

使用C# 模拟客户端请求,AMF请求 封包。 

class AMF_Post_Data 
    { 
        public List<byte> message; 
 
        /// <summary> 
        /// 初始化Message 
        /// </summary> 
        /// <param name="at"></param> 
        /// <param name="headers"></param> 
        /// <param name="bodies"></param> 
        public AMF_Post_Data(AMFType at, int headers, int bodies) 
        { 
            //AMF版本 
            if (at == AMFType.AMF0) 
            { 
                message = new List<byte>(new byte[] { 0x00, 0x00 }); 
            } 
            else if (at == AMFType.AMF3) 
            { 
                message = new List<byte>(new byte[] { 0x00, 0x03 }); 
            } 
 
            //header数量 
            message.Add(BitConverter.GetBytes(headers)[1]); 
            message.Add(BitConverter.GetBytes(headers)[0]); 
            //body数量 
            message.Add(BitConverter.GetBytes(bodies)[1]); 
            message.Add(BitConverter.GetBytes(bodies)[0]); 
        } 
 
        /// <summary> 
        /// 添加Target 
        /// </summary> 
        /// <param name="target"></param> 
        /// <param name="Response"></param> 
        public void AddTargetAndResponse(string target, string Response) 
        { 
            //添加Target长度 
            message.Add(BitConverter.GetBytes(target.Length)[1]); 
            message.Add(BitConverter.GetBytes(target.Length)[0]); 
            //添加Target内容 
            message.AddRange(Encoding.Default.GetBytes(target)); 
 
            //添加Response长度 
            message.Add(BitConverter.GetBytes(Response.Length)[1]); 
            message.Add(BitConverter.GetBytes(Response.Length)[0]); 
            //添加Response内容 
            message.AddRange(Encoding.Default.GetBytes(Response)); 
        } 
 
        /// <summary> 
        /// 添加Body 
        /// </summary> 
        /// <param name="length"></param> 
        /// <param name="Content"></param> 
        public void AddBody(AMF_Post_Data_Body apdb) 
        { 
            message.AddRange(apdb.getLength()); 
            message.AddRange(apdb.Content.ToArray()); 
        } 
    } 
 
    class AMF_Post_Data_Body 
    { 
        private byte[] length = new byte[4]; 
        public List<byte> Content = new List<byte>(); 
 
        /// <summary> 
        /// 初始化Body 
        /// </summary> 
        /// <param name="dt"></param> 
        /// <param name="ArrayLength"></param> 
        public AMF_Post_Data_Body(DataType dt, int ArrayLength) 
        { 
            //添加类型标识 
            Content.Add((byte)dt); 
 
            //数组的话添加长度 
            if (dt == DataType.Array) 
            { 
                Content.Add(BitConverter.GetBytes(ArrayLength)[3]); 
                Content.Add(BitConverter.GetBytes(ArrayLength)[2]); 
                Content.Add(BitConverter.GetBytes(ArrayLength)[1]); 
                Content.Add(BitConverter.GetBytes(ArrayLength)[0]); 
            } 
        } 
 
        public void AddData(DataType dt, string value) 
        { 
            //添加类型标识 
            Content.Add((byte)dt); 
 
            switch (dt) 
            { 
                case DataType.Number: 
                    AddData_Number(double.Parse(value)); 
                    break; 
                case DataType.String: 
                    AddData_String(value); 
                    break; 
                case DataType.Boolean: 
                    AddData_Boolean(Boolean.Parse(value)); 
                    break; 
            } 
        } 
 
        #region 更种类型处理方法 
        /// <summary> 
        /// Boolean 
        /// </summary> 
        /// <param name="p"></param> 
        private void AddData_Boolean(bool p) 
        { 
            if (p) 
                Content.Add(0x01); 
            else 
                Content.Add(0x00); 
        } 
        /// <summary> 
        /// String 
        /// </summary> 
        /// <param name="value"></param> 
        private void AddData_String(string value) 
        { 
            //添加长度 
            Content.Add(BitConverter.GetBytes(value.Length)[1]); 
            Content.Add(BitConverter.GetBytes(value.Length)[0]); 
            //添加内容 
            Content.AddRange(Encoding.Default.GetBytes(value)); 
        } 
        /// <summary> 
        /// Number 
        /// </summary> 
        /// <param name="p"></param> 
        private void AddData_Number(double p) 
        { 
            byte[] b = new byte[8]; 
            b = BitConverter.GetBytes(p); 
            for (int i = 7; i > -1; i--) 
            { 
                Content.Add(b); 
            } 
        } 
        #endregion 
 
        public byte[] getLength() 
        { 
            length[0] = BitConverter.GetBytes(Content.Count)[3]; 
            length[1] = BitConverter.GetBytes(Content.Count)[2]; 
            length[2] = BitConverter.GetBytes(Content.Count)[1]; 
            length[3] = BitConverter.GetBytes(Content.Count)[0]; 
 
            return length; 
        } 
    } 
 
    #region 类型枚举 
    public enum AMFType 
    { 
        AMF0, 
        AMF3 
    } 
 
    public enum DataType 
    { 
        Number = 0, 
        Boolean = 1, 
        String = 2, 
        UntypedObject = 3, 
        MovieClip = 4, 
        Null = 5, 
        Undefined = 6, 
        ReferencedObject = 7, 
        MixedArray = 8, 
        End = 9, 
        Array = 10,//0x0A 
        Date = 11,//0x0B 
        LongString = 12,//0x0C 
        TypeAsObject = 13,//0x0D 
        Recordset = 14,//0x0E 
        Xml = 15,//0x0F 
        TypedObject = 16,//0x10 
        AMF3data = 17//0x11 
    } 
    #endregion