Remove html from text in Habbo Swf

Results 1 to 17 of 17
  1. #1
    Gaby is offline
    MemberRank
    Apr 2013 Join Date
    Viva HollandiaLocation
    1,607Posts

    Remove html from text in Habbo Swf

    Hello hello,

    I've been trying to edit some code in the Habbo swf, but I keep breaking it every time I edit something.

    The Habbo swf contains the following void:

    Code:
          private function §_-3vG§(param1:§_-1dD§) : void
          {
             var _loc2_:§_-5rd§ = null;
             if(this.§_-0Yk§ == null)
             {
                return;
             }
             var _loc3_:§_-0LF§ = this.§_-0Yk§.roomSessionManager.getSession(this.§_-4pF§);
             if(param1 is §_-1c4§)
             {
                _loc2_ = (param1 as §_-1c4§).§_-1A9§();
             }
             else if(param1 is §_-3Fw§)
             {
                _loc2_ = (param1 as §_-3Fw§).§_-1A9§();
                if(_loc2_ && _loc3_ && _loc2_.userId == _loc3_.§_-1Ge§)
                {
                   return;
                }
             }
             else if(param1 is §_-53l§)
             {
                _loc2_ = (param1 as §_-53l§).§_-1A9§();
             }
             if(_loc2_ == null)
             {
                return;
             }
             this.§_-0Yk§.§_-0Rf§(this.§_-4pF§,_loc2_.userId,_loc2_.gesture);
             this.§_-0Yk§.§_-5Bq§(this.§_-4pF§,_loc2_.userId,§_-1-T§.§_-5en§,Math.ceil(_loc2_.text.length / 10));
          }
    What I want to do is filter all the HTML out of _loc2_.text
    This includes stuff like <b></b> and changing stuff like &#9730; back to its original letter (for example é).

    So the following:
    Code:
     this.§_-0Yk§.§_-5Bq§(this.§_-4pF§,_loc2_.userId,§_-1-T§.§_-5en§,Math.ceil(_loc2_.text.length / 10));
    Becomes something like:
    Code:
     this.§_-0Yk§.§_-5Bq§(this.§_-4pF§,_loc2_.userId,§_-1-T§.§_-5en§,Math.ceil(FlashCodeThatFiltersOutHtml(_loc2_.text).length / 10));
    The problem is that I have no idea if flash contains a functionality like this and how to implement it.

    You see, I can only edit the following weird code and not the actual Flash code:

    Code:
    getlocal_0
    getproperty Qname(PrivateNamespace("_-2GZ"),"_-0Yk")
    getlocal_0
    getproperty Qname(PrivateNamespace("_-2GZ"),"_-4pF")
    getlocal_2
    getproperty Qname(PackageNamespace(""),"userId")
    getlex Qname(PackageNamespace("_-6Sq"),"_-1-T")
    getproperty Qname(PackageNamespace(""),"_-5en")
    getlex Qname(PackageNamespace(""),"Math")
    getlocal_2
    getproperty Qname(PackageNamespace(""),"text")
    getproperty Qname(PackageNamespace(""),"length")
    pushbyte 10
    divide
    callproperty Qname(PackageNamespace(""),"ceil") 1
    callpropvoid Qname(Namespace("_-3NX"),"_-5Bq") 4


  2. #2
    Valued Member Arachis is offline
    MemberRank
    Aug 2014 Join Date
    United StatesLocation
    132Posts

    Re: Remove html from text in Habbo Swf

    You can strip the html tags with regex by inserting these instructions:
    Code:
    ofs00229:debugline 1129 // Start of the line.
    
    // var local4:RegExp = new RegExp("<[^>]*>","gi");
    ofs00232:pushstring "<[^>]*>"
    ofs00236:pushstring "gi"
    ofs00240:constructprop Qname(PackageNamespace(""),"RegExp") 2
    ofs00244:coerce Qname(PackageNamespace(""),"RegExp")
    ofs00247:setlocal 4
    
    // var local5:String = local2.text.replace(local4,"");
    ofs00249:getlocal 2
    ofs00251:getproperty Qname(PackageNamespace(""),"text")
    ofs00254:getlocal 4
    ofs00256:pushstring ""
    ofs00258:callproperty Qname(Namespace("http://adobe.com/AS3/2006/builtin"),"replace") 2
    ofs00262:coerce_s
    ofs00263:setlocal 5
    
    ofs00265:getlocal_0
    ofs00266:getproperty Qname(PrivateNamespace("Namespace_0809"),"_-hx")
    ofs00269:getlocal_0
    ofs00270:getproperty Qname(PrivateNamespace("Namespace_0809"),"_-6O5")
    ofs00273:getlocal_2
    ofs00274:getproperty Qname(PackageNamespace(""),"userId")
    ofs00277:getlex Qname(PackageNamespace("Namespace_0654"),"Class_3132")
    ofs00279:getproperty Qname(PackageNamespace(""),"_-6WV")
    ofs00282:getlex Qname(PackageNamespace(""),"Math")
    ofs00284:getlocal 5 // Utilize the modified string here.
    ofs00286:getproperty Qname(PackageNamespace(""),"length")
    ofs00288:pushbyte 10
    ofs00290:divide
    ofs00291:callproperty Qname(PackageNamespace(""),"ceil") 1
    ofs00295:callpropvoid Qname(Namespace("Namespace_1282"),"_-4gO") 4
    ofs00299:debugline 1131
    ofs00302:returnvoid
    I think you could do the same for the 'encoding', I found this thing: AS3 Encode and Decode HTML Entity Names (Full Set) - ActionScript 3 - Snipplr Social Snippet Repository
    I'm not sure if that's what you want though.

    I got the regex pattern from here: https://www.kirupa.com/forum/showthr...n-actionscript
    If you have a better one, just replace the first 'pushstring' with it.
    Last edited by Arachis; 27-03-17 at 11:05 PM.

  3. #3
    Gaby is offline
    MemberRank
    Apr 2013 Join Date
    Viva HollandiaLocation
    1,607Posts

    Re: Remove html from text in Habbo Swf

    Quote Originally Posted by Arachis View Post
    You can strip the html tags with regex by inserting these instructions:
    Code:
    ofs00229:debugline 1129 // Start of the line.
    
    // var local4:RegExp = new RegExp("<[^>]*>","gi");
    ofs00232:pushstring "<[^>]*>"
    ofs00236:pushstring "gi"
    ofs00240:constructprop Qname(PackageNamespace(""),"RegExp") 2
    ofs00244:coerce Qname(PackageNamespace(""),"RegExp")
    ofs00247:setlocal 4
    
    // var local5:String = local2.text.replace(local4,"");
    ofs00249:getlocal 2
    ofs00251:getproperty Qname(PackageNamespace(""),"text")
    ofs00254:getlocal 4
    ofs00256:pushstring ""
    ofs00258:callproperty Qname(Namespace("http://adobe.com/AS3/2006/builtin"),"replace") 2
    ofs00262:coerce_s
    ofs00263:setlocal 5
    
    ofs00265:getlocal_0
    ofs00266:getproperty Qname(PrivateNamespace("Namespace_0809"),"_-hx")
    ofs00269:getlocal_0
    ofs00270:getproperty Qname(PrivateNamespace("Namespace_0809"),"_-6O5")
    ofs00273:getlocal_2
    ofs00274:getproperty Qname(PackageNamespace(""),"userId")
    ofs00277:getlex Qname(PackageNamespace("Namespace_0654"),"Class_3132")
    ofs00279:getproperty Qname(PackageNamespace(""),"_-6WV")
    ofs00282:getlex Qname(PackageNamespace(""),"Math")
    ofs00284:getlocal 5 // Utilize the modified string here.
    ofs00286:getproperty Qname(PackageNamespace(""),"length")
    ofs00288:pushbyte 10
    ofs00290:divide
    ofs00291:callproperty Qname(PackageNamespace(""),"ceil") 1
    ofs00295:callpropvoid Qname(Namespace("Namespace_1282"),"_-4gO") 4
    ofs00299:debugline 1131
    ofs00302:returnvoid
    I think you could do the same for the 'encoding', I found this thing: AS3 Encode and Decode HTML Entity Names (Full Set) - ActionScript 3 - Snipplr Social Snippet Repository
    I'm not sure if that's what you want though.

    I got the regex pattern from here: https://www.kirupa.com/forum/showthr...n-actionscript
    If you have a better one, just replace the first 'pushstring' with it.
    Oh wow tnx! I'm gonna try it out tomorrow

  4. #4
    Gaby is offline
    MemberRank
    Apr 2013 Join Date
    Viva HollandiaLocation
    1,607Posts

    Re: Remove html from text in Habbo Swf

    It seems I am not able to get it to work @Arachis.

    I added only the first lines (which creates the loc4 var), but everytime I talk, I disconnect with the following error:
    Code:
    error_desc:Error in update receiver "com.sulake.bootstrap::CoreCommunicationManagerBootstrap": VerifyError: Error #1024
    I tried to add the code with both FFDec and some swf compile/decompile tool which got released here, both give me a disconnect when talking.

    I have the following:

    Code:
    L85:
          getlocal0
          getproperty         QName(PrivateNamespace("_-2GZ", "_-5fp:RoomMessageHandler#0"), "_-0Yk")
          getlocal0
          getproperty         QName(PrivateNamespace("_-2GZ", "_-5fp:RoomMessageHandler#0"), "_-4pF")
          getlocal2
          getproperty         QName(PackageNamespace(""), "userId")
          getlocal2
          getproperty         QName(PackageNamespace(""), "gesture")
          callpropvoid        QName(Namespace("_-3NX"), "_-0Rf"), 3
    
    
          debugline           1129
          pushstring          "<[^>]*>"
          pushstring          "gi"
          constructprop       QName(PackageNamespace(""),"RegExp"), 2
          coerce              QName(PackageNamespace(""),"RegExp")
          setlocal            4
          getlocal0
          getproperty         QName(PrivateNamespace("_-2GZ", "_-5fp:RoomMessageHandler#0"), "_-0Yk")
          getlocal0
          getproperty         QName(PrivateNamespace("_-2GZ", "_-5fp:RoomMessageHandler#0"), "_-4pF")
          getlocal2
          getproperty         QName(PackageNamespace(""), "userId")
          getlex              QName(PackageNamespace("_-6Sq"), "_-1-T")
          getproperty         QName(PackageNamespace(""), "_-5en")
          getlex              QName(PackageNamespace(""), "Math")
          getlocal2
          getproperty         QName(PackageNamespace(""), "text")
          getproperty         QName(PackageNamespace(""), "length")
          pushbyte            10
          divide
          callproperty        QName(PackageNamespace(""), "ceil"), 1
          callpropvoid        QName(Namespace("_-3NX"), "_-5Bq"), 4
    
    
          debugline           1131
          returnvoid
    Am I doing something wrong?

    I'm sorry if I'm bothering you now, Flash is like Chinese to me.

  5. #5
    Valued Member Arachis is offline
    MemberRank
    Aug 2014 Join Date
    United StatesLocation
    132Posts

    Re: Remove html from text in Habbo Swf

    It looks like you're missing a step:
    Code:
    L85:
          getlocal0
          getproperty         QName(PrivateNamespace("_-2GZ", "_-5fp:RoomMessageHandler#0"), "_-0Yk")
          getlocal0
          getproperty         QName(PrivateNamespace("_-2GZ", "_-5fp:RoomMessageHandler#0"), "_-4pF")
          getlocal2
          getproperty         QName(PackageNamespace(""), "userId")
          getlocal2
          getproperty         QName(PackageNamespace(""), "gesture")
          callpropvoid        QName(Namespace("_-3NX"), "_-0Rf"), 3
    
    
          debugline           1129
          pushstring          "<[^>]*>"
          pushstring          "gi"
          constructprop       QName(PackageNamespace(""),"RegExp"), 2
          coerce              QName(PackageNamespace(""),"RegExp")
          setlocal            4
    
    // Missed a chunk of instructions here.
    
          getlocal0
          getproperty         QName(PrivateNamespace("_-2GZ", "_-5fp:RoomMessageHandler#0"), "_-0Yk")
          getlocal0
          getproperty         QName(PrivateNamespace("_-2GZ", "_-5fp:RoomMessageHandler#0"), "_-4pF")
          getlocal2
          getproperty         QName(PackageNamespace(""), "userId")
          getlex              QName(PackageNamespace("_-6Sq"), "_-1-T")
          getproperty         QName(PackageNamespace(""), "_-5en")
          getlex              QName(PackageNamespace(""), "Math")
          getlocal2
          getproperty         QName(PackageNamespace(""), "text")
          getproperty         QName(PackageNamespace(""), "length")
          pushbyte            10
          divide
          callproperty        QName(PackageNamespace(""), "ceil"), 1
          callpropvoid        QName(Namespace("_-3NX"), "_-5Bq"), 4
    
    
          debugline           1131
          returnvoid
    This is also needed(after 'setlocal4'):
    Code:
    ofs00249:getlocal 2
    ofs00251:getproperty Qname(PackageNamespace(""),"text")
    ofs00254:getlocal 4
    ofs00256:pushstring ""
    ofs00258:callproperty Qname(Namespace("http://adobe.com/AS3/2006/builtin"),"replace") 2
    ofs00262:coerce_s
    ofs00263:setlocal 5
    In the end it should end up looking like this:
    Code:
          debugline           1129
          pushstring          "<[^>]*>"
          pushstring          "gi"
          constructprop       QName(PackageNamespace(""),"RegExp"), 2
          coerce              QName(PackageNamespace(""),"RegExp")
          setlocal            4
    
    // Don't forget this.
    getlocal 2
    getproperty Qname(PackageNamespace(""),"text")
    getlocal 4
    pushstring ""
    callproperty Qname(Namespace("http://adobe.com/AS3/2006/builtin"),"replace") 2
    coerce_s
    setlocal 5
    
          getlocal0
          getproperty         QName(PrivateNamespace("_-2GZ", "_-5fp:RoomMessageHandler#0"), "_-0Yk")
          getlocal0
          getproperty         QName(PrivateNamespace("_-2GZ", "_-5fp:RoomMessageHandler#0"), "_-4pF")
          getlocal2
          getproperty         QName(PackageNamespace(""), "userId")
          getlex              QName(PackageNamespace("_-6Sq"), "_-1-T")
          getproperty         QName(PackageNamespace(""), "_-5en")
          getlex              QName(PackageNamespace(""), "Math")
          // REMOVE THIS: getlocal2
          // REMOVE THIS: getproperty         QName(PackageNamespace(""), "text")
          // REPLACE WITH: getlocal 5
          getproperty         QName(PackageNamespace(""), "length")
          pushbyte            10
          divide
          callproperty        QName(PackageNamespace(""), "ceil"), 1
          callpropvoid        QName(Namespace("_-3NX"), "_-5Bq"), 4
    
    
          debugline           1131
          returnvoid
    Edit: I've actually haven't tried if this actually works, just editing through jpexs to see if there is a problem with the instructions.
    Last edited by Arachis; 28-03-17 at 10:04 PM.

  6. #6
    Gaby is offline
    MemberRank
    Apr 2013 Join Date
    Viva HollandiaLocation
    1,607Posts

    Re: Remove html from text in Habbo Swf

    Quote Originally Posted by Arachis View Post
    It looks like you're missing a step:
    Code:
    L85:
          getlocal0
          getproperty         QName(PrivateNamespace("_-2GZ", "_-5fp:RoomMessageHandler#0"), "_-0Yk")
          getlocal0
          getproperty         QName(PrivateNamespace("_-2GZ", "_-5fp:RoomMessageHandler#0"), "_-4pF")
          getlocal2
          getproperty         QName(PackageNamespace(""), "userId")
          getlocal2
          getproperty         QName(PackageNamespace(""), "gesture")
          callpropvoid        QName(Namespace("_-3NX"), "_-0Rf"), 3
    
    
          debugline           1129
          pushstring          "<[^>]*>"
          pushstring          "gi"
          constructprop       QName(PackageNamespace(""),"RegExp"), 2
          coerce              QName(PackageNamespace(""),"RegExp")
          setlocal            4
    
    // Missed a chunk of instructions here.
    
          getlocal0
          getproperty         QName(PrivateNamespace("_-2GZ", "_-5fp:RoomMessageHandler#0"), "_-0Yk")
          getlocal0
          getproperty         QName(PrivateNamespace("_-2GZ", "_-5fp:RoomMessageHandler#0"), "_-4pF")
          getlocal2
          getproperty         QName(PackageNamespace(""), "userId")
          getlex              QName(PackageNamespace("_-6Sq"), "_-1-T")
          getproperty         QName(PackageNamespace(""), "_-5en")
          getlex              QName(PackageNamespace(""), "Math")
          getlocal2
          getproperty         QName(PackageNamespace(""), "text")
          getproperty         QName(PackageNamespace(""), "length")
          pushbyte            10
          divide
          callproperty        QName(PackageNamespace(""), "ceil"), 1
          callpropvoid        QName(Namespace("_-3NX"), "_-5Bq"), 4
    
    
          debugline           1131
          returnvoid
    This is also needed(after 'setlocal4'):
    Code:
    ofs00249:getlocal 2
    ofs00251:getproperty Qname(PackageNamespace(""),"text")
    ofs00254:getlocal 4
    ofs00256:pushstring ""
    ofs00258:callproperty Qname(Namespace("http://adobe.com/AS3/2006/builtin"),"replace") 2
    ofs00262:coerce_s
    ofs00263:setlocal 5
    In the end it should end up looking like this:
    Code:
          debugline           1129
          pushstring          "<[^>]*>"
          pushstring          "gi"
          constructprop       QName(PackageNamespace(""),"RegExp"), 2
          coerce              QName(PackageNamespace(""),"RegExp")
          setlocal            4
    
    // Don't forget this.
    getlocal 2
    getproperty Qname(PackageNamespace(""),"text")
    getlocal 4
    pushstring ""
    callproperty Qname(Namespace("http://adobe.com/AS3/2006/builtin"),"replace") 2
    coerce_s
    setlocal 5
    
          getlocal0
          getproperty         QName(PrivateNamespace("_-2GZ", "_-5fp:RoomMessageHandler#0"), "_-0Yk")
          getlocal0
          getproperty         QName(PrivateNamespace("_-2GZ", "_-5fp:RoomMessageHandler#0"), "_-4pF")
          getlocal2
          getproperty         QName(PackageNamespace(""), "userId")
          getlex              QName(PackageNamespace("_-6Sq"), "_-1-T")
          getproperty         QName(PackageNamespace(""), "_-5en")
          getlex              QName(PackageNamespace(""), "Math")
          // REMOVE THIS: getlocal2
          // REMOVE THIS: getproperty         QName(PackageNamespace(""), "text")
          // REPLACE WITH: getlocal 5
          getproperty         QName(PackageNamespace(""), "length")
          pushbyte            10
          divide
          callproperty        QName(PackageNamespace(""), "ceil"), 1
          callpropvoid        QName(Namespace("_-3NX"), "_-5Bq"), 4
    
    
          debugline           1131
          returnvoid
    Edit: I've actually haven't tried if this actually works, just editing through jpexs to see if there is a problem with the instructions.
    Tried it out, still no luck though. Found out that I had to up localcount to 6 to enable the usage of local 4 and local 5. still disconnect when I talk with this error:

    Code:
    Error in update receiver "com.sulake.bootstrap::CoreCommunicationManagerBootstrap": VerifyError: Error #1024
    This is the total code within the method, do you know what I did wrong?

    Code:
    trait method Qname(PrivateNamespace("_-2GZ"),"_-3vG")
    dispid 0
    method
    name null
    param Qname(PackageNamespace("_-1Z6"),"_-1dD")
    returns Qname(PackageNamespace(""),"void")
    
    
    body
    maxstack 7
    localcount 6
    initscopedepth 4
    maxscopedepth 5
    
    
    code
    debugfile "k"
    debugline 1110
    getlocal_0
    pushscope
    pushnull
    coerce Qname(PackageNamespace("_-28H"),"_-5rd")
    setlocal_2
    debug 1 "k" 0 1110
    debug 1 "k" 1 1113
    debug 1 "k" 2 1114
    debugline 1112
    getlocal_0
    getproperty Qname(PrivateNamespace("_-2GZ"),"_-0Yk")
    pushnull
    ifne ofs002b
    returnvoid
    ofs002b:getlocal_0
    getproperty Qname(PrivateNamespace("_-2GZ"),"_-0Yk")
    getproperty Qname(Namespace("_-5Aw"),"roomSessionManager")
    getlocal_0
    getproperty Qname(PrivateNamespace("_-2GZ"),"_-4pF")
    callproperty Qname(Namespace("_-1Bx"),"getSession") 1
    coerce Qname(PackageNamespace("_-0ZD"),"_-0LF")
    setlocal_3
    debugline 1116
    getlocal_1
    getlex Qname(PackageNamespace("_-6AD"),"_-1c4")
    istypelate
    iffalse ofs005d
    debugline 1117
    getlocal_1
    getlex Qname(PackageNamespace("_-6AD"),"_-1c4")
    astypelate
    callproperty Qname(PackageNamespace(""),"_-1A9") 0
    coerce Qname(PackageNamespace("_-28H"),"_-5rd")
    setlocal_2
    jump ofs00b7
    ofs005d:getlocal_1
    getlex Qname(PackageNamespace("_-6AD"),"_-3Fw")
    istypelate
    iffalse ofs009c
    debugline 1119
    getlocal_1
    getlex Qname(PackageNamespace("_-6AD"),"_-3Fw")
    astypelate
    callproperty Qname(PackageNamespace(""),"_-1A9") 0
    coerce Qname(PackageNamespace("_-28H"),"_-5rd")
    setlocal_2
    debugline 1120
    getlocal_2
    coerce_a
    convert_b
    dup
    iffalse ofs0084
    pop
    getlocal_3
    coerce_a
    convert_b
    ofs0084:dup
    iffalse ofs0093
    pop
    getlocal_2
    getproperty Qname(PackageNamespace(""),"userId")
    getlocal_3
    getproperty Qname(Namespace("_-2kn"),"_-1Ge")
    equals
    ofs0093:iffalse ofs0098
    returnvoid
    ofs0098:jump ofs00b7
    ofs009c:getlocal_1
    getlex Qname(PackageNamespace("_-6AD"),"_-53l")
    istypelate
    iffalse ofs00b7
    debugline 1122
    getlocal_1
    getlex Qname(PackageNamespace("_-6AD"),"_-53l")
    astypelate
    callproperty Qname(PackageNamespace(""),"_-1A9") 0
    coerce Qname(PackageNamespace("_-28H"),"_-5rd")
    setlocal_2
    debugline 1125
    ofs00b7:getlocal_2
    pushnull
    ifne ofs00be
    returnvoid
    ofs00be:getlocal_0
    getproperty Qname(PrivateNamespace("_-2GZ"),"_-0Yk")
    getlocal_0
    getproperty Qname(PrivateNamespace("_-2GZ"),"_-4pF")
    getlocal_2
    getproperty Qname(PackageNamespace(""),"userId")
    getlocal_2
    getproperty Qname(PackageNamespace(""),"gesture")
    callpropvoid Qname(Namespace("_-3NX"),"_-0Rf") 3
    debugline 1129
    pushstring "<[^>]*>"
    pushstring "gi"
    constructprop Qname(PackageNamespace(""),"RegExp") 2
    coerce Qname(PackageNamespace(""),"RegExp")
    setlocal 4
    getlocal_2
    getproperty Qname(PackageNamespace(""),"text")
    getlocal 4
    pushstring ""
    callproperty Qname(Namespace("http://adobe.com/AS3/2006/builtin"),"replace") 2
    coerce_s
    setlocal 5
    getlocal_0
    getproperty Qname(PrivateNamespace("_-2GZ"),"_-0Yk")
    getlocal_0
    getproperty Qname(PrivateNamespace("_-2GZ"),"_-4pF")
    getlocal_2
    getproperty Qname(PackageNamespace(""),"userId")
    getlex Qname(PackageNamespace("_-6Sq"),"_-1-T")
    getproperty Qname(PackageNamespace(""),"_-5en")
    getlex Qname(PackageNamespace(""),"Math")
    getlocal 5
    getproperty Qname(PackageNamespace(""),"length")
    pushbyte 10
    divide
    callproperty Qname(PackageNamespace(""),"ceil") 1
    callpropvoid Qname(Namespace("_-3NX"),"_-5Bq") 4
    debugline 1131
    returnvoid ; trait
    end ; code
    end ; body
    end ; method
    end ; trait
    It translates to:

    Code:
             var _loc2_:§_-5rd§ = null;
             if(this.§_-0Yk§ == null)
             {
                return;
             }
             var _loc3_:§_-0LF§ = this.§_-0Yk§.roomSessionManager.getSession(this.§_-4pF§);
             if(param1 is §_-1c4§)
             {
                _loc2_ = (param1 as §_-1c4§).§_-1A9§();
             }
             else if(param1 is §_-3Fw§)
             {
                _loc2_ = (param1 as §_-3Fw§).§_-1A9§();
                if(_loc2_ && _loc3_ && _loc2_.userId == _loc3_.§_-1Ge§)
                {
                   return;
                }
             }
             else if(param1 is §_-53l§)
             {
                _loc2_ = (param1 as §_-53l§).§_-1A9§();
             }
             if(_loc2_ == null)
             {
                return;
             }
             this.§_-0Yk§.§_-0Rf§(this.§_-4pF§,_loc2_.userId,_loc2_.gesture);
             var _loc4_:RegExp = /<[^>]*>/gi;
             var _loc5_:String = _loc2_.text.replace(_loc4_,"");
             this.§_-0Yk§.§_-5Bq§(this.§_-4pF§,_loc2_.userId,§_-1-T§.§_-5en§,Math.ceil(_loc5_.length / 10));

  7. #7
    Valued Member Arachis is offline
    MemberRank
    Aug 2014 Join Date
    United StatesLocation
    132Posts

    Re: Remove html from text in Habbo Swf

    Quote Originally Posted by Gaby View Post
    Code:
    Error in update receiver "com.sulake.bootstrap::CoreCommunicationManagerBootstrap": VerifyError: Error #1024
    This is the total code within the method, do you know what I did wrong?
    I forgot to include the instruction that pulls the name/type RegExp out of thin air, so the regexp object initialization should look like this:
    Code:
    findpropstrict Qname(PackageNamespace(""),"RegExp") // I forgot this.
    pushstring "<[^<]+?>"
    pushstring "gi"
    constructprop Qname(PackageNamespace(""),"RegExp") 2
    coerce Qname(PackageNamespace(""),"RegExp")
    setlocal 4
    I was playing around with this today, and it seems the method we're modifying doesn't really affect what the client displays to the user, there is another method we need to edit. The current message being given to this method is used somewhere else too, this is were we need to edit the actual text to strip the html tags.

    I'm not sure what revision you're on, but I'll be using the latest one(PRODUCTION-201704251205-586769896) as an example when posting the class names, etc. Unfortunately, the method name is obfuscated, but here it is anyways _-2xA in class _-3l8.

    Now that you're there, it should look something like this:
    Code:
    var local2:§_-6Sy§ = null;
    var local3:§_-s2§ = null;
    var local4:String = null;
    var local5:int = 0;
    var local6:§_-4GL§ = null;
    if(listener && listener.events)
    {
    local2 = param1 as §_-6Sy§;
    if(local2 && local2.§_-5Eq§())
    {
       local3 = listener.getSession(§_-0uB§);
       if(local3 == null)
       {
    	  return;
       }
       local4 = §_-4fu§.§_-2Av§;
       local5 = §_-4fu§.§_-Zq§;
       local6 = local2.§_-5Eq§();
       var local7:RegExp = new RegExp("<[^<]+?>","gi");
       var local8:String = local6.text.replace(local7,"");
       listener.events.dispatchEvent(new §_-4fu§(local4,local3,local6.userId,local8,local5,local6.styleId,local6.links));
    }
    }
    Except for that last part where it does the regex thing, we'll do that right now. We basically do the same thing we did in the other method, we insert these instructions:
    Code:
    debugline 278 // Just a point of reference of where it is.
    
    findpropstrict Qname(PackageNamespace(""),"RegExp")
    pushstring "<[^<]+?>"
    pushstring "gi"
    constructprop Qname(PackageNamespace(""),"RegExp") 2
    coerce Qname(PackageNamespace(""),"RegExp")
    setlocal 7
    getlocal 6
    getproperty Qname(PackageNamespace(""),"text")
    getlocal 7
    pushstring ""
    callproperty Qname(Namespace("http://adobe.com/AS3/2006/builtin"),"replace") 2
    coerce_s
    setlocal 8
    // We're inserting these instructions before that getlex listener instruciton.
    
    getlex Qname(PackageNamespace(""),"listener")
    getproperty Qname(Namespace("_-0v"),"events")
    findpropstrict Qname(PackageNamespace("_-1Hp"),"_-4fu")
    getlocal 4
    getlocal_3
    getlocal 6
    getproperty Qname(PackageNamespace(""),"userId")
    getlocal 8 //////////////  <<<<<<<<<<<<<<< This is where we insert the new modified text.
    getlocal 5
    getlocal 6
    getproperty Qname(PackageNamespace(""),"styleId")
    getlocal 6
    getproperty Qname(PackageNamespace(""),"links")
    constructprop Qname(PackageNamespace("_-1Hp"),"_-4fu") 7
    callpropvoid Qname(Namespace("flash.events:IEventDispatcher"),"dispatchEvent") 1
    Also, yea forgot to mention, you might need to pump up that localcount value by 2. I've got no idea how to unescape the characters thing, you might want to do all of this in the emulator though, assuming you have access to the code.

    Imgur

  8. #8
    Proficient Member spreedblood is offline
    MemberRank
    May 2014 Join Date
    165Posts

    Re: Remove html from text in Habbo Swf

    Instead of making it so advanced just do 2 methods, 1 with the nametag, 1 normal name, send nametag before room message is sent, and 1 after message is sent, that way the nametag will only apply in the text.

    Skickat från min FRD-L09 via Tapatalk

  9. #9
    Apprentice Zanoma is offline
    MemberRank
    Oct 2016 Join Date
    13Posts

    Re: Remove html from text in Habbo Swf

    Quote Originally Posted by spreedblood View Post
    Instead of making it so advanced just do 2 methods, 1 with the nametag, 1 normal name, send nametag before room message is sent, and 1 after message is sent, that way the nametag will only apply in the text.

    Skickat från min FRD-L09 via Tapatalk
    Hey SpreedBlood, could you explain what to implement where?

  10. #10
    Proficient Member spreedblood is offline
    MemberRank
    May 2014 Join Date
    165Posts

    Re: Remove html from text in Habbo Swf

    Quote Originally Posted by Zanoma View Post
    Hey SpreedBlood, could you explain what to implement where?
    Well you basically create a method with with nametag or w/e you'd like, and then you create another method which will change your username back to normal. Then you first send the nametag before you've written a message, then you send the method containing the username when the message has been sent. It all depends on which emulator you're using and where you need to send the different packets. Though the concept is just like how I wrote it. :) Good luck!

  11. #11
    Gaby is offline
    MemberRank
    Apr 2013 Join Date
    Viva HollandiaLocation
    1,607Posts

    Re: Remove html from text in Habbo Swf

    I feel like I need to clarify something to you guys hehe. The method I was editing, is the method that calculates how long the mouth of a user should keep moving. If I send a lot of html in the speechbubble, the mouth will keep opening and closing indefinitely. This is why I want to strip all the html out of the mouth moving method.

    Will try to implement the new code in a few minutes. :)

    - - - Updated - - -
    @Arachis

    It works!!



    The swf doesn't count the html in as actual said characters anymore.

    Now I only have to find a way to change codes such as &#9730; back to their original character, so that it doesn't get counted as 7 characters.

    Will keep you guys updated if I find something for this myself. If any of you have an idea, please shoot. :)

  12. #12
    Valued Member Arachis is offline
    MemberRank
    Aug 2014 Join Date
    United StatesLocation
    132Posts

    Re: Remove html from text in Habbo Swf

    I can automate this process in HabBit if you'd like, along with the character 'decoder', since that'd probably require a new class to be inserted: https://github.com/as3/as3-utils/blo.../htmlDecode.as(Or not, would look nicer though)

    Btw did you just specifically wanted to alter length of the text, or did you also want to strip the actual text?

    Html decode method in here too: AS3 Encode and Decode HTML Entity Names (Full Set) - ActionScript 3 - Snipplr Social Snippet Repository
    Last edited by Arachis; 27-04-17 at 09:16 PM.

  13. #13
    Gaby is offline
    MemberRank
    Apr 2013 Join Date
    Viva HollandiaLocation
    1,607Posts

    Re: Remove html from text in Habbo Swf

    Quote Originally Posted by Arachis View Post
    I can automate this process in HabBit if you'd like, along with the character 'decoder', since that'd probably require a new class to be inserted: https://github.com/as3/as3-utils/blo.../htmlDecode.as(Or not, would look nicer though)

    Btw did you just specifically wanted to alter length of the text, or did you also want to strip the actual text?

    Html decode method in here too: AS3 Encode and Decode HTML Entity Names (Full Set) - ActionScript 3 - Snipplr Social Snippet Repository
    Only wanted to alter the length check hehe. :)

    Those classes seem to only go over stuff like &amp;, not &#9730; for example, or is this included in some other method?

    How would I go over adding a class to the swf?

  14. #14
    Apprentice Zanoma is offline
    MemberRank
    Oct 2016 Join Date
    13Posts

    Re: Remove html from text in Habbo Swf

    Quote Originally Posted by Gaby View Post
    Only wanted to alter the length check hehe. :)

    Those classes seem to only go over stuff like &amp;, not &#9730; for example, or is this included in some other method?





    How would I go over adding a class to the swf?
    Could you share, what you've edited and changed?

  15. #15
    Gaby is offline
    MemberRank
    Apr 2013 Join Date
    Viva HollandiaLocation
    1,607Posts

    Re: Remove html from text in Habbo Swf

    Quote Originally Posted by Zanoma View Post
    Could you share, what you've edited and changed?
    Exactly what Arachis described, except I only edited the RoomMessageHandler class.

  16. #16
    Apprentice Zanoma is offline
    MemberRank
    Oct 2016 Join Date
    13Posts

    Re: Remove html from text in Habbo Swf

    Quote Originally Posted by Gaby View Post
    Tried it out, still no luck though. Found out that I had to up localcount to 6 to enable the usage of local 4 and local 5. still disconnect when I talk with this error:

    Code:
    Error in update receiver "com.sulake.bootstrap::CoreCommunicationManagerBootstrap": VerifyError: Error #1024
    This is the total code within the method, do you know what I did wrong?

    Code:
    trait method Qname(PrivateNamespace("_-2GZ"),"_-3vG")
    dispid 0
    method
    name null
    param Qname(PackageNamespace("_-1Z6"),"_-1dD")
    returns Qname(PackageNamespace(""),"void")
    
    
    body
    maxstack 7
    localcount 6
    initscopedepth 4
    maxscopedepth 5
    
    
    code
    debugfile "k"
    debugline 1110
    getlocal_0
    pushscope
    pushnull
    coerce Qname(PackageNamespace("_-28H"),"_-5rd")
    setlocal_2
    debug 1 "k" 0 1110
    debug 1 "k" 1 1113
    debug 1 "k" 2 1114
    debugline 1112
    getlocal_0
    getproperty Qname(PrivateNamespace("_-2GZ"),"_-0Yk")
    pushnull
    ifne ofs002b
    returnvoid
    ofs002b:getlocal_0
    getproperty Qname(PrivateNamespace("_-2GZ"),"_-0Yk")
    getproperty Qname(Namespace("_-5Aw"),"roomSessionManager")
    getlocal_0
    getproperty Qname(PrivateNamespace("_-2GZ"),"_-4pF")
    callproperty Qname(Namespace("_-1Bx"),"getSession") 1
    coerce Qname(PackageNamespace("_-0ZD"),"_-0LF")
    setlocal_3
    debugline 1116
    getlocal_1
    getlex Qname(PackageNamespace("_-6AD"),"_-1c4")
    istypelate
    iffalse ofs005d
    debugline 1117
    getlocal_1
    getlex Qname(PackageNamespace("_-6AD"),"_-1c4")
    astypelate
    callproperty Qname(PackageNamespace(""),"_-1A9") 0
    coerce Qname(PackageNamespace("_-28H"),"_-5rd")
    setlocal_2
    jump ofs00b7
    ofs005d:getlocal_1
    getlex Qname(PackageNamespace("_-6AD"),"_-3Fw")
    istypelate
    iffalse ofs009c
    debugline 1119
    getlocal_1
    getlex Qname(PackageNamespace("_-6AD"),"_-3Fw")
    astypelate
    callproperty Qname(PackageNamespace(""),"_-1A9") 0
    coerce Qname(PackageNamespace("_-28H"),"_-5rd")
    setlocal_2
    debugline 1120
    getlocal_2
    coerce_a
    convert_b
    dup
    iffalse ofs0084
    pop
    getlocal_3
    coerce_a
    convert_b
    ofs0084:dup
    iffalse ofs0093
    pop
    getlocal_2
    getproperty Qname(PackageNamespace(""),"userId")
    getlocal_3
    getproperty Qname(Namespace("_-2kn"),"_-1Ge")
    equals
    ofs0093:iffalse ofs0098
    returnvoid
    ofs0098:jump ofs00b7
    ofs009c:getlocal_1
    getlex Qname(PackageNamespace("_-6AD"),"_-53l")
    istypelate
    iffalse ofs00b7
    debugline 1122
    getlocal_1
    getlex Qname(PackageNamespace("_-6AD"),"_-53l")
    astypelate
    callproperty Qname(PackageNamespace(""),"_-1A9") 0
    coerce Qname(PackageNamespace("_-28H"),"_-5rd")
    setlocal_2
    debugline 1125
    ofs00b7:getlocal_2
    pushnull
    ifne ofs00be
    returnvoid
    ofs00be:getlocal_0
    getproperty Qname(PrivateNamespace("_-2GZ"),"_-0Yk")
    getlocal_0
    getproperty Qname(PrivateNamespace("_-2GZ"),"_-4pF")
    getlocal_2
    getproperty Qname(PackageNamespace(""),"userId")
    getlocal_2
    getproperty Qname(PackageNamespace(""),"gesture")
    callpropvoid Qname(Namespace("_-3NX"),"_-0Rf") 3
    debugline 1129
    pushstring "<[^>]*>"
    pushstring "gi"
    constructprop Qname(PackageNamespace(""),"RegExp") 2
    coerce Qname(PackageNamespace(""),"RegExp")
    setlocal 4
    getlocal_2
    getproperty Qname(PackageNamespace(""),"text")
    getlocal 4
    pushstring ""
    callproperty Qname(Namespace("http://adobe.com/AS3/2006/builtin"),"replace") 2
    coerce_s
    setlocal 5
    getlocal_0
    getproperty Qname(PrivateNamespace("_-2GZ"),"_-0Yk")
    getlocal_0
    getproperty Qname(PrivateNamespace("_-2GZ"),"_-4pF")
    getlocal_2
    getproperty Qname(PackageNamespace(""),"userId")
    getlex Qname(PackageNamespace("_-6Sq"),"_-1-T")
    getproperty Qname(PackageNamespace(""),"_-5en")
    getlex Qname(PackageNamespace(""),"Math")
    getlocal 5
    getproperty Qname(PackageNamespace(""),"length")
    pushbyte 10
    divide
    callproperty Qname(PackageNamespace(""),"ceil") 1
    callpropvoid Qname(Namespace("_-3NX"),"_-5Bq") 4
    debugline 1131
    returnvoid ; trait
    end ; code
    end ; body
    end ; method
    end ; trait
    It translates to:

    Code:
             var _loc2_:§_-5rd§ = null;
             if(this.§_-0Yk§ == null)
             {
                return;
             }
             var _loc3_:§_-0LF§ = this.§_-0Yk§.roomSessionManager.getSession(this.§_-4pF§);
             if(param1 is §_-1c4§)
             {
                _loc2_ = (param1 as §_-1c4§).§_-1A9§();
             }
             else if(param1 is §_-3Fw§)
             {
                _loc2_ = (param1 as §_-3Fw§).§_-1A9§();
                if(_loc2_ && _loc3_ && _loc2_.userId == _loc3_.§_-1Ge§)
                {
                   return;
                }
             }
             else if(param1 is §_-53l§)
             {
                _loc2_ = (param1 as §_-53l§).§_-1A9§();
             }
             if(_loc2_ == null)
             {
                return;
             }
             this.§_-0Yk§.§_-0Rf§(this.§_-4pF§,_loc2_.userId,_loc2_.gesture);
             var _loc4_:RegExp = /<[^>]*>/gi;
             var _loc5_:String = _loc2_.text.replace(_loc4_,"");
             this.§_-0Yk§.§_-5Bq§(this.§_-4pF§,_loc2_.userId,§_-1-T§.§_-5en§,Math.ceil(_loc5_.length / 10));
    Only thing i dont get is, WHAT did you CHANGE and WHERE dit you change it.. i dont get where that files come from ( Als je het uitlegt mag het ook in het NL )

  17. #17
    Gaby is offline
    MemberRank
    Apr 2013 Join Date
    Viva HollandiaLocation
    1,607Posts

    Re: Remove html from text in Habbo Swf

    Quote Originally Posted by Zanoma View Post
    Only thing i dont get is, WHAT did you CHANGE and WHERE dit you change it.. i dont get where that files come from ( Als je het uitlegt mag het ook in het NL )
    - RoomMessageHandler.class.asasm
    - Removing HTML from mouth moving time calculator.
    - Can't tell you which void, because 99/100 chance that we are not on the same swf revision.
    - Code which needs changing is in Arachis' posts.

    What I am still looking for is a method to change &#9730; and stuff back to its original character or how to add the class that Arachis suggested to the swf.



Advertisement