Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
How does a Proxy works exactly?
Results 1 to 5 of 5

Thread: How does a Proxy works exactly?

  1. #1
    Senior Member
    Join Date
    Jan 2010
    Location
    Venezuela
    Posts
    366

    How does a Proxy works exactly?

    Hey folks,

    In my school I've been programming alot in the C++ programming language, and have managed to control sockets for a chat program, and was thinking about making a simple Proxy for parsing packets to the client.

    If I'm not wrong, I must create a ProxyServer that listens in the localhost:7171 and localhost:7172 (login), and listen to the real tibia servers (tibia01..login01....), then if I get a packet from the Tibia client, I must parse this packet and send it to the real tibia servers, get an answer, and send it back to the client, and repeat this whole thing for both protocols Login and Game.

    Is this correct?.

    Also, Tibia 9.5+ uses Alder32, Rsa and Xtea right?.

  2. #2
    Super Moderator
    Join Date
    May 2007
    Posts
    1,191

    RE: How does a Proxy works exactly?

    1. Overwrite the client's login server(s) and port(s) with your loopback IP and the port you want to listen to
    2. Set up a socket to listen to TCP connections on the port you used earlier
    3. When a connection is accepted, create a new thread or run the next code asynchronously
    4. Either read the client's memory or decrypt the packet and read it to determine where to connect, create a new socket and connect accordingly
      Remember to alter the character list by modyfing the packet or memory writing! You will have to store the original data and connect accordingly when a client wants to connect to a gameserver
    5. At this point you will be able to inspect, modify, remove and send packets


    edit: to clarify, you will need one socket that is listening, one socket for the proxy<->client connection, and one socket for the proxy<->server connection
    edit2: also remember to store the original login servers, as you will need to connect to them

  3. #3
    Senior Member
    Join Date
    Jan 2010
    Location
    Venezuela
    Posts
    366

    RE: How does a Proxy works exactly?

    Quote Originally Posted by Blaster_89
    1. Overwrite the client's login server(s) and port(s) with your loopback IP and the port you want to listen to
    2. Set up a socket to listen to TCP connections on the port you used earlier
    3. When a connection is accepted, create a new thread or run the next code asynchronously
    4. Either read the client's memory or decrypt the packet and read it to determine where to connect, create a new socket and connect accordingly
      Remember to alter the character list by modyfing the packet or memory writing! You will have to store the original data and connect accordingly when a client wants to connect to a gameserver
    5. At this point you will be able to inspect, modify, remove and send packets


    edit: to clarify, you will need one socket that is listening, one socket for the proxy<->client connection, and one socket for the proxy<->server connection
    edit2: also remember to store the original login servers, as you will need to connect to them
    Tibia Server Game 7172 / Tibia Server Login 7171

    Proxy for Client Login 7171 / Proxy for Client Game 7172 / Proxy for both servers 7171/7172

    Correct?.

  4. #4
    Super Moderator
    Join Date
    May 2007
    Posts
    1,191

    RE: How does a Proxy works exactly?

    Quote Originally Posted by Pro-grammer
    Quote Originally Posted by Blaster_89
    1. Overwrite the client's login server(s) and port(s) with your loopback IP and the port you want to listen to
    2. Set up a socket to listen to TCP connections on the port you used earlier
    3. When a connection is accepted, create a new thread or run the next code asynchronously
    4. Either read the client's memory or decrypt the packet and read it to determine where to connect, create a new socket and connect accordingly
      Remember to alter the character list by modyfing the packet or memory writing! You will have to store the original data and connect accordingly when a client wants to connect to a gameserver
    5. At this point you will be able to inspect, modify, remove and send packets


    edit: to clarify, you will need one socket that is listening, one socket for the proxy<->client connection, and one socket for the proxy<->server connection
    edit2: also remember to store the original login servers, as you will need to connect to them
    Tibia Server Game 7172 / Tibia Server Login 7171

    Proxy for Client Login 7171 / Proxy for Client Game 7172 / Proxy for both servers 7171/7172

    Correct?.
    You can use whatever ports you want to, although I would recommend keeping the socket count to a minimum to allow for cleaner code.

  5. #5
    Senior Member
    Join Date
    Oct 2009
    Location
    Poland, Świebodzin
    Posts
    233

    RE: How does a Proxy works exactly?

    I fighted against proxy few months a go. You can check my code in this thread. Also would be great if you find some solution to help me to fix it. NetworkMessage class is from OTServ code by the way.

    Regards, Czepek!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •