xat  
Results 1 to 9 of 9

Thread: Official Bot Fix

  1. #1
    Join Date
    Feb 2011
    Location
    Xat
    Posts
    68

    Default 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 Code:
    $this->send('<v r="'.$this->roomID.'" p="'.$this->regPassword.'" n="'.$this->regName.'" />'); 
    Find this in the join funciton:
    PHP Code:
    $this->send('<y m="1" />'); 
    Now add this after it:
    PHP Code:
    $this->send('<y r="'.$this->roomID.'" />'); 
    Note: You need to edit the variables depending on the bot you have.
    Here is what the login function should look like.
    PHP Code:
     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***91;'v'***93;;
            
    $this->userID $this->packet***91;'v'***93;***91;'i'***93;;
            
    $this->regName $this->packet***91;'v'***93;***91;'n'***93;;
            if(
    count($this->regInfo)>4$this->loggedIn true;
            return 
    true;
        } 
    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 Code:
    $this->connect("**IP**,**port**"); 
    then change it to this:
    PHP Code:
    $this->connect($this->ip(),$this->port()); 
    4.The get ip and get port functions:
    PHP Code:
    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;

    Function required to get ip and port from the site:
    PHP Code:
        function stribet($inputstr$deliLeft$deliRight) {
            
    $posLeft stripos($inputstr$deliLeft) + strlen($deliLeft);
            
    $posRight stripos($inputstr$deliRight$posLeft);
            return 
    substr($inputstr$posLeft$posRight $posLeft);
        } 
    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 Code:
    case 'q':
    $this->connect($this->ip(),$this->port());
    $this->join($this->roomID); 
    break; 
    Get function if you don't have it:
    PHP Code:
      function get($url$ic false) {
            
    $urlp parse_url($url); 
            
    $fp fsockopen($urlp***91;'host'***93;, 80); 
            
    $path explode('/'$url4);
            
    $cp count($path);
            
    $path = ($cp >= 4) ? $path***91;3***93; : "";
            
    $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***91;host***93;\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***91;1***93;;
        } 
    After this your bot should be back.
    Last edited by Matthew425; 10-06-2012 at 08:37 PM. Reason: Updated Functions

  2. #2
    Join Date
    Sep 2011
    Location
    Spain
    Posts
    1,045

    Default

    Quote 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 Code:
     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***91;'v'***93;;
            
    $this->userID $this->packet***91;'v'***93;***91;'i'***93;;
            
    $this->regName $this->packet***91;'v'***93;***91;'n'***93;;
            if(
    count($this->regInfo)>4$this->loggedIn true;
            return 
    true;
        } 
    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 Code:
    public function __construct(){
    $ip $this->getIP($this->roomID);
    $port $this->getPort($this->roomID);

    4.The get ip and get port functions:
    You may only use one method at once.
    Method One:
    PHP Code:
    function getPort($arg){       
        if(
    $arg 8$port 10000 $arg;   
        else 
    $port 10000 + ($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***91;$ip***93;;

    Method Two:
    PHP Code:
    function getPort($arg){       
        if(
    $arg 8) {
            
    $port 10000 $arg;   
        } else {
            
    $port 10000 + ($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***91;$ip***93;;

    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 Code:
    case 'q':
    $ip $this->getIP($this->roomID);
    $port $this->getPort($this->roomID);
    $this->connect($ip,$port);
    $this->join($this->roomID); 
    break; 
    Your bot should then be back online for now.

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

  3. #3
    Join Date
    Feb 2011
    Location
    Xat
    Posts
    68

    Default

    Forgot to add
    PHP Code:
    $this->send('<y r="'.$this->roomID.'" />'); 

  4. #4

    Default

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

  5. #5
    Join Date
    Feb 2011
    Location
    Xat
    Posts
    68

    Default

    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

  6. #6
    Join Date
    Nov 2011
    Location
    Where you live
    Posts
    718

    Default

    Where do we enter the info?
    555555 / 407291

  7. #7
    Join Date
    Feb 2011
    Location
    Xat
    Posts
    68

    Default

    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

  8. #8
    Join Date
    Nov 2011
    Location
    Where you live
    Posts
    718

    Default

    I haven't used bot powers. I'm also not smart in coding scripts but ok..
    Quote 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

  9. #9
    Join Date
    Feb 2011
    Location
    Xat
    Posts
    68

    Default

    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

Posting Permissions

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