Problem with bot for webbrowser game menu

User Tag List

Results 1 to 6 of 6
  1. #1
    viking001's Avatar Member
    Reputation
    1
    Join Date
    Jul 2017
    Posts
    3
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem with bot for webbrowser game

    I'm writing a bot for a webbrowser game to automate the boring tasks of gathering resources. The client is a flash application and communicate with the server with http posts.
    I can reproduce the identical http posts of the flash client but the server returns a strange reply. But not only to my forged http posts the server replies something strange, also if I open the networking panel of FF and resend an original http request of the flash client the server returns the same strange reply. I'm quite confused, what is wrong with these http requests? Why only the flash client receives a good reply from the server? Do I miss something? Do I ignore something? Somebody can help me to figure it out?

    Thanks
    Viking001

    Problem with bot for webbrowser game
  2. #2
    nitr0x11's Avatar Site Donator
    Reputation
    85
    Join Date
    Jun 2007
    Posts
    147
    Thanks G/R
    11/11
    Trade Feedback
    4 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you could post a snippet of what data you are receiving, that would be helpful.

  3. #3
    viking001's Avatar Member
    Reputation
    1
    Join Date
    Jul 2017
    Posts
    3
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi nitr0x11, thank for replying, I can give you more details, first the requests are zlib compressed, they do it in actionscript with the ByteArray class, the request body contains also some http headers, but they don't add them from the code, so I'm quite sure that it is a normal process of the actionscript URLLoader class. The reply of the server is also zlib compressed, but this isn't a problem. Here the first http post of the client to the server, it's a simple log request:

    Code:
    Referer: http://kongregate-vikingage-en.shinezone.com/release/flash/TowerDefanseShell_5.swf
    Content-type: application/octet-stream
    Content-length: 145
    
    xÚ]ŒK‚0E]ËפEOŒȌÒ؇6‚íÃÄöã2…‰§çž{Ÿæ
    O…[ƒ"OÎ*NsK)pÆQ»ªUü,
    k†@?èp&m¬»A4Pò”¨,J³›Ï¯™P€Í…ü“|½÷¦crü7t½¶™ÚŽJÙÍžªÅk¶“+
    kÛ®íCÃ8¹
    As you can see, they have some http headers in the body, the compressed part is json:

    Code:
    ¨[{"requestid":95614790400,"command":1},{"request":["stat","flashloading",["1035182782",{"type":"tdServerTest","content":"tdServerTest_failedTimes=0_preDuration=-1"}]]}]
    There is a request id, but in the loader-wrapper doesn't use it, all its requests have the same request id. The game instead use it and increment it at each request. The reply of the server is:

    Code:
    xœ‹6Ô©V*J-,M-.ÉLQ²²45341·4010**QJÎÏÍMÌŠê(¥æ%U”(YÔêÆ
    Which is again json deflated
    Code:
    [1,{"requestid":95614790400,"command":1,"encrypt":0},1]
    Now if I resend the same request from the network panel of FF, which means the same url, http headers and body, the server replies with

    Code:
    xœ‹6ÔÉ+Íɉ
    which is:

    Code:
    [1,null]

  4. #4
    nitr0x11's Avatar Site Donator
    Reputation
    85
    Join Date
    Jun 2007
    Posts
    147
    Thanks G/R
    11/11
    Trade Feedback
    4 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But you said yourself that the request id is incremented by 1, so you would need to also do that? That's obviously a really simple thing to try first, unless you already tried that?

    Could it also be that the request you are sending is only supposed to be sent once per session? Have you tried sending a different request?
    Last edited by nitr0x11; 07-27-2017 at 02:56 PM.

  5. #5
    viking001's Avatar Member
    Reputation
    1
    Join Date
    Jul 2017
    Posts
    3
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @ nitrox11 thanks for the reply

    Practically the first loaded flash object isn't the game but a preloader for the game, which loads also the game. I have decompiled both and while the flash game uses the request id and increments it at each new request, the preloader has an hard coded request id and sends always the same. This can be checked also by sniffing the traffic to the server, the preloader sends five "log" requests to the server and they have always the same request id.

    And I'm quite sure that you can send the same request more than once, for example the preloader sends the same request three times. Moreover when I use my bot to send the same requests of the preloader, it does it in a new session, but the server replies always with [1,null].

    If I send something wrong I receive an empty response, I know it because at the beginning I had some encoding problems with the zlib and the server was replying with an empty response, now at least I become something back ... but still it isn't what I'm expecting to receive.

  6. #6
    sico's Avatar Member
    Reputation
    3
    Join Date
    Mar 2008
    Posts
    32
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It sounds like you have a good grip on what you're trying to accomplish, so please don't take any offense from my questions if you've already checked these things or know they are unrelated.

    Are you viewing all network requests when monitoring the network tab? The reason I ask is I was curious if any other requests are being made at the same time as your suspect http post. For example, it could be doing some ajax non-sense or some other type of setup / validation in another request near by.

    Is the request being made to the same domain as the game your actually playing or is it different?

    Have you checked your cookies (even server cookies are observable) to see if anything is updated or changing when the native request is made?

    Does the site your on, or the request itself use SSL protocol? (https / 443)

    How are you making your http posts? You don't have to be super specific, but are you doing it in the client window using the same session you logged into with manually or are you actually making posts from outside the client. If you are running headless, outside the client with something like postman for example, or not using the same valid session you obtained when you logged in legitimately, that could be an issue either with invalid / malformed session data or a simple permissions issue.

    Out of curiousity, do you know what platform / language the site itself is written in? For example, is there some angular or react judo going on in the source code? Viewing the controllers might yield some clues.

    I know nothing about flash other than it's the asbestos of the internet, but I am a full-stack developer for my day job. There isn't nearly enough web development discussion on this forum as i'd like, so i'd be happy to help out where I can if you'd like another pair of eyes. I could be completely mistaken, but my first initial gut feeling says something in the headers is missing, incorrect or malformed or some type of post variable such as a session key is incorrect, or some type of permission issue such as same domain policy or perhaps they are using jsonp and you need a callback.

    If your up for some copy and pasting, i'd like to take a look at the entire http request (including headers, body, and response) that you are trying to emulate as well as your own http request (headers, body, response). Or, if you've already figured out the issue i'd be interested to know where the problem was.

Similar Threads

  1. Couple Problems with mangos for me?
    By Warfar3 in forum World of Warcraft Emulator Servers
    Replies: 0
    Last Post: 07-31-2010, 12:57 AM
  2. Replies: 0
    Last Post: 11-16-2009, 07:49 AM
  3. Problem with logging in to game server
    By nightfrost01 in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 08-06-2008, 06:43 PM
  4. problem with VMap for ascent
    By marcosgue in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 02-06-2008, 01:31 PM
  5. Problem with my skin in-game
    By C-Death in forum WoW ME Questions and Requests
    Replies: 3
    Last Post: 01-04-2008, 10:12 PM
All times are GMT -5. The time now is 04:26 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search