5

I'm reversing engineering a old flash game and on login process a POST request is send to server. ActionScript2:

req.username = inicial.login_mc.username_txt.text;
req.password = inicial.login_mc.password_txt.text;

xmlResponse = new LoadVars();
xmlResponse.onLoad = function() {
    xml = new XML(xmlResponse.xml);
    trace("login xml: " + xml);

    user = xml.childNodes[0];
};

url_login = "api/auth/user";
req.sendAndLoad(url_login, xmlResponse, "POST");

Request:

Request URL: http://localhost:3000/api/auth/user
Request Method: POST
Status Code: 200 OK
Remote Address: [::1]:3000
Referrer Policy: no-referrer-when-downgrade
username: aaaa
password: aaaa

My response:

Connection: keep-alive
Content-Length: 58
Content-Type: application/xml; charset=utf-8
Date: Sun, 18 Mar 2018 20:19:50 GMT
ETag: W/"3a-G4M/BpWRvMgDdvlmOtNMapl/lLw"
X-Powered-By: Express
<response hello="world"><hi>howdoing</hi></response>

The issue: the flash don't get any response, and xml is always empty. flashlog.txt:

Warning: getClassStyleDeclaration is not a function
login xml:

Content-Type: text/xml don't work too.

What it could be?

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356

2 Answers2

0

This may help you

var my_xml = new XML(); 
var myLoginReply_xml = new XML(); 

myLoginReply_xml.ignoreWhite = true; 

myLoginReply_xml.onLoad = function(success){ 

    if (success) { 
        // xml response with success
    } else { 
        // failure
    } 

}; 

my_xml.sendAndLoad("YOUR_URL", myLoginReply_xml);
Phd. Burak Öztürk
  • 1,727
  • 19
  • 29
  • How can I change the swf code? I tried some tools some weeks ago, but no one worked. –  Mar 29 '18 at 16:02
0

If you're My response (quoted below) :

My response:

Connection: keep-alive
Content-Length: 58
Content-Type: application/xml; charset=utf-8
Date: Sun, 18 Mar 2018 20:19:50 GMT
ETag: W/"3a-G4M/BpWRvMgDdvlmOtNMapl/lLw"
X-Powered-By: Express>
<response hello="world"><hi>howdoing</hi></response>

...Is what you get back into AS2 (into a String) then you could extract an XML from that String.

It looks like this part is your XML data:

<response hello="world"><hi>howdoing</hi></response>

Code below has one example of extracting as XML (eg: consider ParseXML method too):

var txt_response :String = ""; //original response string
var txt_XML :String = ""; //(extracted) string to be converted into XML object

//# //////////////////////////////////////////////////////////
//# 01) Get the Response :

txt_response = "Connection: keep-alive\nContent-Length: 58\nContent-Type: application/xml; charset=utf-8\nDate: Sun, 18 Mar 2018 20:19:50 GMT\nETag: W/\"3a-G4M/BpWRvMgDdvlmOtNMapl/lLw\"\nX-Powered-By: Express\n<response hello=\"world\"><hi>howdoing</hi></response>";
trace("txt_response : \n" + txt_response);//check if expected Response text


//# //////////////////////////////////////////////////////////
//# 02) Extract XML data from Response :
//# using: substring (start_Pos:Number, END_Pos:Number);

var pos_Start :Number = 0;
var pos_End :Number = 0;

pos_Start = txt_response.indexOf("<response");
pos_End = txt_response.indexOf("/response>");

txt_XML = txt_response.substring( pos_Start, pos_End+10); //+10 to reach end of this word (include it)
trace("txt_XML : \n" + txt_XML); //check if correct extract before using as XML


//# //////////////////////////////////////////////////////////
//# 03) Convert extracted text to XML :

var my_xml:XML = new XML(txt_XML);
trace( "checking XML attribute ( hello ) : " + my_xml.firstChild.attributes.hello); //gives: world

Using my_xml.firstChild.attributes.hello shows world as entry. Is this what you need?

VC.One
  • 14,790
  • 4
  • 25
  • 57