コード例 #1
0
ファイル: HTTPSUtilities.cs プロジェクト: ploxolq/Unreal.FGO
        internal static string GetProtocolListAsString(byte[] arrData)
        {
            int num = ((int)arrData[0] << 8) + (int)arrData[1];

            byte[] array = new byte[num];
            Buffer.BlockCopy(arrData, 2, array, 0, array.Length);
            return(HTTPSUtilities.GetExtensionString(array));
        }
コード例 #2
0
        public override string ToString()
        {
            StringBuilder stringBuilder = new StringBuilder(512);

            if (this._HandshakeVersion == 2)
            {
                stringBuilder.Append("A SSLv2-compatible ClientHello handshake was found. Fiddler extracted the parameters below.\n\n");
            }
            else
            {
                stringBuilder.Append("A SSLv3-compatible ClientHello handshake was found. Fiddler extracted the parameters below.\n\n");
            }
            stringBuilder.AppendFormat("Version: {0}\n", HTTPSUtilities.HTTPSVersionToString(this._MajorVersion, this._MinorVersion));
            stringBuilder.AppendFormat("Random: {0}\n", Utilities.ByteArrayToString(this._Random));
            stringBuilder.AppendFormat("SessionID: {0}\n", Utilities.ByteArrayToString(this._SessionID));
            stringBuilder.AppendFormat("Extensions: \n{0}\n", HTTPSClientHello.ExtensionListToString(this._Extensions));
            stringBuilder.AppendFormat("Ciphers: \n{0}\n", HTTPSClientHello.CipherSuitesToString(this._CipherSuites));
            stringBuilder.AppendFormat("Compression: \n{0}\n", HTTPSClientHello.CompressionSuitesToString(this._CompressionSuites));
            return(stringBuilder.ToString());
        }
コード例 #3
0
        public override string ToString()
        {
            StringBuilder stringBuilder = new StringBuilder(512);

            if (this._HandshakeVersion == 2)
            {
                stringBuilder.Append("A SSLv2-compatible ServerHello handshake was found. In v2, the ~client~ selects the active cipher after the ServerHello, when sending the Client-Master-Key message. Fiddler only parses the handshake.\n\n");
            }
            else
            {
                stringBuilder.Append("A SSLv3-compatible ServerHello handshake was found. Fiddler extracted the parameters below.\n\n");
            }
            stringBuilder.AppendFormat("Version: {0}\n", HTTPSUtilities.HTTPSVersionToString(this._MajorVersion, this._MinorVersion));
            stringBuilder.AppendFormat("SessionID:\t{0}\n", Utilities.ByteArrayToString(this._SessionID));
            if (this._HandshakeVersion == 3)
            {
                stringBuilder.AppendFormat("Random:\t\t{0}\n", Utilities.ByteArrayToString(this._Random));
                stringBuilder.AppendFormat("Cipher:\t\t{0} [0x{1:X4}]\n", this.CipherSuite, this._iCipherSuite);
            }
            stringBuilder.AppendFormat("CompressionSuite:\t{0} [0x{1:X2}]\n", this.CompressionSuite, this._iCompression);
            stringBuilder.AppendFormat("Extensions:\n\t{0}\n", HTTPSServerHello.ExtensionListToString(this._Extensions));
            return(stringBuilder.ToString());
        }
コード例 #4
0
        private void ParseServerHelloExtension(int iExtType, byte[] arrData)
        {
            if (this._Extensions == null)
            {
                this._Extensions = new List <string>();
            }
            if (iExtType <= 35)
            {
                switch (iExtType)
                {
                case 0:
                    this._Extensions.Add(string.Format("\tserver_name\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 1:
                    this._Extensions.Add(string.Format("\tmax_fragment_length\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 2:
                    this._Extensions.Add(string.Format("\tclient_certificate_url\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 3:
                    this._Extensions.Add(string.Format("\ttrusted_ca_keys\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 4:
                    this._Extensions.Add(string.Format("\ttruncated_hmac\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 5:
                    this._Extensions.Add(string.Format("\tstatus_request\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 6:
                    this._Extensions.Add(string.Format("\tuser_mapping\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 7:
                case 8:
                case 15:
                    break;

                case 9:
                    this._Extensions.Add(string.Format("\tcert_type\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 10:
                    this._Extensions.Add(string.Format("\telliptic_curves\t{0}", HTTPSUtilities.GetECCCurvesAsString(arrData)));
                    return;

                case 11:
                    this._Extensions.Add(string.Format("\tec_point_formats\t{0}", HTTPSUtilities.GetECCPointFormatsAsString(arrData)));
                    return;

                case 12:
                    this._Extensions.Add(string.Format("\tsrp_rfc_5054\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 13:
                    this._Extensions.Add(string.Format("\tsignature_algorithms\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 14:
                    this._Extensions.Add(string.Format("\tuse_srtp\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 16:
                {
                    string protocolListAsString = HTTPSUtilities.GetProtocolListAsString(arrData);
                    this._Extensions.Add(string.Format("\tALPN\t\t{0}", protocolListAsString));
                    if (protocolListAsString.Contains("spdy/"))
                    {
                        this.bALPNToSPDY = true;
                        return;
                    }
                    return;
                }

                default:
                    if (iExtType == 35)
                    {
                        this._Extensions.Add(string.Format("\tSessionTicket TLS\t{0}", Utilities.ByteArrayToString(arrData)));
                        return;
                    }
                    break;
                }
            }
            else
            {
                if (iExtType != 13172)
                {
                    if (iExtType == 30031)
                    {
                        this._Extensions.Add(string.Format("\tchannel_id(GoogleDraft)\t{0}", Utilities.ByteArrayToString(arrData)));
                        return;
                    }
                    if (iExtType == 65281)
                    {
                        this._Extensions.Add(string.Format("\trenegotiation_info\t{0}", Utilities.ByteArrayToString(arrData)));
                        return;
                    }
                }
                else
                {
                    string extensionString = HTTPSUtilities.GetExtensionString(arrData);
                    this._Extensions.Add(string.Format("\tNextProtocolNegotiation\t{0}", extensionString));
                    if (extensionString.Contains("spdy/"))
                    {
                        this.bNPNToSPDY = true;
                        return;
                    }
                    return;
                }
            }
            this._Extensions.Add(string.Format("\t0x{0:x4}\t\t{1}", iExtType, Utilities.ByteArrayToString(arrData)));
        }
コード例 #5
0
        private void ParseClientHelloExtension(int iExtType, byte[] arrData)
        {
            if (this._Extensions == null)
            {
                this._Extensions = new List <string>();
            }
            if (iExtType <= 35)
            {
                switch (iExtType)
                {
                case 0:
                {
                    StringBuilder stringBuilder = new StringBuilder();
                    int           num2;
                    for (int i = 2; i < arrData.Length; i += 3 + num2)
                    {
                        int num = (int)arrData[i];
                        num2 = ((int)arrData[i + 1] << 8) + (int)arrData[i + 2];
                        string @string = Encoding.ASCII.GetString(arrData, i + 3, num2);
                        if (num == 0)
                        {
                            this._ServerNameIndicator = @string;
                            stringBuilder.AppendFormat("{0}{1}", (stringBuilder.Length > 1) ? "; " : string.Empty, @string);
                        }
                    }
                    this._Extensions.Add(string.Format("\tserver_name\t{0}", stringBuilder.ToString()));
                    return;
                }

                case 1:
                    this._Extensions.Add(string.Format("\tmax_fragment_length\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 2:
                    this._Extensions.Add(string.Format("\tclient_certificate_url\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 3:
                    this._Extensions.Add(string.Format("\ttrusted_ca_keys\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 4:
                    this._Extensions.Add(string.Format("\ttruncated_hmac\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 5:
                    this._Extensions.Add(string.Format("\tstatus_request\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 6:
                    this._Extensions.Add(string.Format("\tuser_mapping\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 7:
                case 8:
                case 15:
                    break;

                case 9:
                    this._Extensions.Add(string.Format("\tcert_type\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 10:
                    this._Extensions.Add(string.Format("\telliptic_curves\t{0}", HTTPSUtilities.GetECCCurvesAsString(arrData)));
                    return;

                case 11:
                    this._Extensions.Add(string.Format("\tec_point_formats\t{0}", HTTPSUtilities.GetECCPointFormatsAsString(arrData)));
                    return;

                case 12:
                    this._Extensions.Add(string.Format("\tsrp_rfc_5054\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 13:
                    this._Extensions.Add(string.Format("\tsignature_algorithms\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 14:
                    this._Extensions.Add(string.Format("\tuse_srtp\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;

                case 16:
                {
                    string protocolListAsString = HTTPSUtilities.GetProtocolListAsString(arrData);
                    this._Extensions.Add(string.Format("\tALPN\t\t{0}", protocolListAsString));
                    return;
                }

                default:
                    if (iExtType == 35)
                    {
                        this._Extensions.Add(string.Format("\tSessionTicket TLS\t{0}", Utilities.ByteArrayToString(arrData)));
                        return;
                    }
                    break;
                }
            }
            else
            {
                if (iExtType == 13172)
                {
                    this._Extensions.Add(string.Format("\tNextProtocolNegotiation\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;
                }
                if (iExtType == 30031)
                {
                    this._Extensions.Add(string.Format("\tchannel_id(GoogleDraft)\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;
                }
                if (iExtType == 65281)
                {
                    this._Extensions.Add(string.Format("\trenegotiation_info\t{0}", Utilities.ByteArrayToString(arrData)));
                    return;
                }
            }
            this._Extensions.Add(string.Format("\t0x{0:x4}\t\t{1}", iExtType, Utilities.ByteArrayToString(arrData)));
        }