示例#1
0
        private void ReplaceKeys(ShockwaveFlash flash)
        {
            foreach (IFlashTag flashTag in _flash.Tags)
            {
                if (flashTag.Header.Tag != FlashTagType.DefineBinaryData)
                {
                    continue;
                }

                var    binTag = (DefineBinaryDataTag)flashTag;
                string binDat = _encoding.GetString(binTag.Data);
                if (binDat.Contains("habbo_login_dialog"))
                {
                    const string dummyFieldPrefix = "name=\"dummy_field\" caption=\"";
                    string       encodedKeys      = binDat.GetChild(dummyFieldPrefix, '"');
                    ExtractRSAKeys(encodedKeys);

                    string encodedFakeKeys = EncodeRSAKeys(_main.RsaKeys[0][0], _main.RsaKeys[0][1]);
                    binDat = binDat.Replace(encodedKeys, encodedFakeKeys);

                    binTag.Data = _encoding.GetBytes(binDat);
                    flash.Compile();
                    break;
                }
            }
        }
示例#2
0
        private void ReplaceRsaKeys(ShockwaveFlash flash)
        {
            foreach (IFlashTag flashTag in _flash.Tags)
            {
                if (flashTag.Header.Tag != FlashTagType.DefineBinaryData)
                {
                    continue;
                }

                var    binaryDataTag = (DefineBinaryDataTag)flashTag;
                string binaryData    = Encoding.UTF8.GetString(binaryDataTag.Data);
                if (binaryData.Contains("habbo_login_dialog"))
                {
                    string extractedRsaKeys = binaryData.GetChild("name=\"dummy_field\" caption=\"", '"');
                    DecodeRsaKeys(extractedRsaKeys);

                    string generatedRsaKeys = EncodeRsaKeys(Main.FAKE_EXPONENT, Main.FAKE_MODULUS);
                    binaryData         = binaryData.Replace(extractedRsaKeys, generatedRsaKeys);
                    binaryDataTag.Data = Encoding.UTF8.GetBytes(binaryData);

                    flash.Compile();
                    break;
                }
            }
        }