Announcement

Collapse
No announcement yet.

Official Bot Fix

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Official Bot Fix

    Hello guys, since xats function to get the chat ip and port for the bot to connect to the chat. I have a fix but it might now work. I have sent a ticket to Admin and he says he is working on it.
    NOTE: YOU MAY NEED TO CHANGE SOME OF THIS DEPENDING ON YOUR BOT SCRIPT
    Steps:
    1.Use xat's official bot login server
    Go to the login function and remove all the parts for register.php
    add this line instead of all that coding to use register.php:

    [PHP]$this->send('<v r="'.$this->roomID.'" p="'.$this->regPassword.'" n="'.$this->regName.'" />');[/PHP]
    Find this in the join funciton: [PHP]$this->send('<y m="1" />');[/PHP]
    Now add this after it:
    [php]$this->send('<y r="'.$this->roomID.'" />');[/php]
    Note: You need to edit the variables depending on the bot you have.
    Here is what the login function should look like.
    [PHP]
    function login() {
    $this->connect($this->ip(),"10001");
    $this->send('<v r="'.$this->roomID.'" p="'.$this->regPassword.'" n="'.$this->regName.'" />');
    $this->read();
    $this->regInfo = $this->packet['v'];
    $this->userID = $this->packet['v']['i'];
    $this->regName = $this->packet['v']['n'];
    if(count($this->regInfo)>4) $this->loggedIn = true;
    return true;
    }
    [/PHP]

    2.For the login function, change from port 10000 to 10001
    3.Find anything having to do with the connect function like this for example:
    [PHP]
    $this->connect("**IP**,**port**");
    [/PHP]
    then change it to this:
    [PHP]
    $this->connect($this->ip(),$this->port());
    [/PHP]
    4.The get ip and get port functions:
    [PHP]
    function ip(){
    $res = $this->get("http://xathelp.x10.mx/chat.php?chat=".$this->roomID,true);
    $ip = $this->stribet($res,'<div id="ip">','</div>');
    return $ip;
    }
    function port(){
    $res = $this->get("http://xathelp.x10.mx/chat.php?chat=".$this->roomID,true);
    $port = $this->stribet($res,'<div id="port">','</div>');
    return $port;
    }
    [/PHP]

    Function required to get ip and port from the site:
    [PHP]
    function stribet($inputstr, $deliLeft, $deliRight) {
    $posLeft = stripos($inputstr, $deliLeft) + strlen($deliLeft);
    $posRight = stripos($inputstr, $deliRight, $posLeft);
    return substr($inputstr, $posLeft, $posRight - $posLeft);
    }

    [/PHP]
    5. Now that everything is finished you need fix all the functions and commands using the variables for ip and port.
    Example:
    $this->connect($this->ip(),$this->port());
    Now go to the q handler and change it to this:
    [PHP]
    case 'q':
    $this->connect($this->ip(),$this->port());
    $this->join($this->roomID);
    break;
    [/PHP]
    Get function if you don't have it:
    [PHP]
    function get($url, $ic = false) {
    $urlp = parse_url($url);
    $fp = fsockopen($urlp['host'], 80);
    $path = explode('/', $url, 4);
    $cp = count($path);
    $path = ($cp >= 4) ? $path[3] : "";
    $req = "GET /$path HTTP/1.0\r\n";
    $req .="Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n";
    $req .="Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n";
    $req .= "Host: $urlp[host]\r\n";
    $req .= "Accept-Language: en-us,en;q=0.5\r\n";
    $req .= "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0\r\n";
    $req .= "Connection: close\r\n\r\n";
    fputs($fp, $req);
    stream_set_timeout($fp,4);
    $res = stream_get_contents($fp);
    fclose($fp);
    if($ic) { return $res; }
    $res = explode("\r\n\r\n",$res,2);
    return $res[1];
    }
    [/PHP]

    After this your bot should be back.
    Last edited by Matthew425; Oct 6th, 2012, 08:37 PM. Reason: Updated Functions
    xHelp (85587017)
    Former Xat Help Moderator And Bot Coder At Your Service

  • #2
    Originally posted by Matthew425 View Post
    Hello guys, since xats function to get the chat ip and port for the bot to connect to the chat. I have a fix but it might now work. I have sent a ticket to Admin and he says he is working on it.
    Steps:
    1.Use xat's official bot login server
    Go to the login function and remove all the parts for register.php
    add this line instead of all that coding to use register.php:
    $this->send('<v r="'.$this->roomID.'" p="'.$this->regPassword.'" n="'.$this->regName.'" />');
    Note: You need to edit the variables depending on the bot you have.
    Here is what the login function should look like.
    [PHP]
    function login() {
    $ips = $this->getIP($this->roomID);
    $this->connect($ips,"10001");
    $this->send('<v r="'.$this->roomID.'" p="'.$this->regPassword.'" n="'.$this->regName.'" />');
    $this->read();
    $this->regInfo = $this->packet['v'];
    $this->userID = $this->packet['v']['i'];
    $this->regName = $this->packet['v']['n'];
    if(count($this->regInfo)>4) $this->loggedIn = true;
    return true;
    }
    [/PHP]

    2.For the login function, change from port 10000 to 10001
    3.Add this function, if this is already an existing function then add these lines to it.
    [PHP]
    public function __construct(){
    $ip = $this->getIP($this->roomID);
    $port = $this->getPort($this->roomID);
    }
    [/PHP]
    4.The get ip and get port functions:
    You may only use one method at once.
    Method One:
    [PHP]
    function getPort($arg){
    if($arg < 8) $port = 10000 - 1 + $arg;
    else $port = 10000 + 7 + ($arg % 32);
    return $port;
    }
    function getIP($arg){
    $Servers = array("69.4.231.251", "69.4.231.250", "69.4.231.248", "69.4.231.249");
    if($arg < 8) $ip = 3;
    else $ip =($arg & 0x60)>>5;
    return $Servers[$ip];
    }
    [/PHP]

    Method Two:
    [PHP]
    function getPort($arg){
    if($arg < 8) {
    $port = 10000 - 1 + $arg;
    } else {
    $port = 10000 + 7 + ($arg % 32);
    }
    return $port;
    }
    function getIP($arg){
    $Servers = array("174.36.56.185", "174.36.242.24", "174.36.242.25", "174.36.242.26", "174.36.242.27", "174.36.242.32", "174.36.242.33", "174.36.242.34", "174.36.242.35", "174.36.242.40", "174.36.242.41", "174.36.242.42", "174.36.242.43", "69.4.231.248", "69.4.231.249", "69.4.231.250", "69.4.231.251");
    if($arg < 8) {
    $ip = 3;
    } else {
    $ip =($arg & 0x60)>>5;
    }
    return $Servers[$ip];
    }
    [/PHP]
    5. Now that everything is finished you need fix all the functions and commands using the variables for ip and port.
    Example:
    $this->connect($ip,$port);
    Now go to the q handler and change it to this:
    [PHP]
    case 'q':
    $ip = $this->getIP($this->roomID);
    $port = $this->getPort($this->roomID);
    $this->connect($ip,$port);
    $this->join($this->roomID);
    break;
    [/PHP]

    Your bot should then be back online for now.

    Interesting.. information. Thanks you.
    Ikor (585981826)-
    @_ikor

    Comment


    • #3
      Forgot to add
      [PHP]$this->send('<y r="'.$this->roomID.'" />');[/PHP]
      xHelp (85587017)
      Former Xat Help Moderator And Bot Coder At Your Service

      Comment


      • #4
        Thank you, Matthew, for settin' me straight with my bot. You did an awesome job!

        Comment


        • #5
          Updated to get the correct ip and port! Also added some more useful stuff.
          xHelp (85587017)
          Former Xat Help Moderator And Bot Coder At Your Service

          Comment


          • #6
            Where do we enter the info?
            555555 / 407291

            Comment


            • #7
              In your bot script, you need to modify the login function and all the settings to connect. What script do you use?
              xHelp (85587017)
              Former Xat Help Moderator And Bot Coder At Your Service

              Comment


              • #8
                I haven't used bot powers. I'm also not smart in coding scripts but ok..
                Originally posted by Matthew425 View Post
                In your bot script, you need to modify the login function and all the settings to connect. What script do you use?
                555555 / 407291

                Comment


                • #9
                  Did you get it to work?
                  If you want, you can pm the script and I can edit it to work again.
                  xHelp (85587017)
                  Former Xat Help Moderator And Bot Coder At Your Service

                  Comment

                  Working...
                  X