[Showcase] PHP msn

Results 1 to 16 of 16
  1. #1
    Vous Pas Reel HotelUnderSeige is offline
    MemberRank
    Nov 2007 Join Date
    ColoradoSpringsLocation
    1,290Posts

    [Showcase] PHP msn

    This is an msn bot, will turn any msn account that you log in with, into a bot! I am still working on some of the packets for the Msn Protocol. I made the layout within like 5 minutes? Its not my best. And this is not finished. Using flumpcases as a base source, And Emesene debug mode for packeting.
    SB: Switch Board
    NS: Notification Server
    Status:
    Changes display name
    Auto Responses on selected dialogue

    Selected Dialogue: ( all caps are lower'd with $message.= strtolower($data); )
    PHP Code:
    if (!strstr($message'TypingUser'))
                            {
                                      if(
    end($mesg) == "hey")
                            {
                            
                                return 
    $last;
                            } elseif (
    end($mesg) == "1") {
                                return 
    "M3GA@stoned.com, johnny10561@hotmail.com";
                            } elseif (
    end($mesg) == "2") {
                                return 
    "HotelunderSeige";
                            } elseif (
    end($mesg) == "fuck you") {
                                return 
    "you to punji";
                                
    $this->_put($nudge);
                            } elseif(
    end($mesg) == "fuck me") {
                                return 
    "not your fat ass";
                            } elseif(
    end($mesg) == "im not fat sorry") {
                                return 
    "and im human";
                            } elseif(
    end($mesg) == "lol") {
                                return 
    "go back to thailand commi, nothing is funny there";
                            } else {    
                                return 
    "speak english you dumb cunt";
                            }
                            
                            } 
    http://70.57.174.108/msn
    Last edited by HotelUnderSeige; 30-05-09 at 09:18 PM.


  2. #2
    :-) s-p-n is offline
    DeveloperRank
    Jun 2007 Join Date
    Next DoorLocation
    2,098Posts

    Re: [Showcase] PHP msn

    Cool man, so the bot can auto message everyone or give timed updates, auto responses? What all can it do?

  3. #3
    Vous Pas Reel HotelUnderSeige is offline
    MemberRank
    Nov 2007 Join Date
    ColoradoSpringsLocation
    1,290Posts

    Re: [Showcase] PHP msn

    Quote Originally Posted by s-p-n View Post
    Cool man, so the bot can auto message everyone or give timed updates, auto responses? What all can it do?
    added to the description.

  4. #4
    :-) s-p-n is offline
    DeveloperRank
    Jun 2007 Join Date
    Next DoorLocation
    2,098Posts

    Re: [Showcase] PHP msn

    Quote Originally Posted by HotelUnderSeige View Post
    added to the description.
    Use if(eregi($mesg,$catch)>1) instead of if(end($mesg)==$catch)

    That way it doesn't limit that data to being on the end of the sentance. Also, I'd make an array of catches and a for() loop to check the stuff.

    That would make it possible for further advancement later. So for example if you wanted a way for users to add catches & responses, it would only be possible with dynamic results.

    Would you mind if I remade some parts of your engine? Remember the "TalkToMe Bot" from before? lol :P

  5. #5
    Vous Pas Reel HotelUnderSeige is offline
    MemberRank
    Nov 2007 Join Date
    ColoradoSpringsLocation
    1,290Posts

    Re: [Showcase] PHP msn

    Quote Originally Posted by s-p-n View Post
    Use if(eregi($mesg,$catch)>1) instead of if(end($mesg)==$catch)

    That way it doesn't limit that data to being on the end of the sentance. Also, I'd make an array of catches and a for() loop to check the stuff.

    That would make it possible for further advancement later. So for example if you wanted a way for users to add catches & responses, it would only be possible with dynamic results.

    Would you mind if I remade some parts of your engine? Remember the "TalkToMe Bot" from before? lol :P
    lol ya, go ahead. and thanks for the if(eregi($mesg,$catch)>1)

  6. #6
    :-) s-p-n is offline
    DeveloperRank
    Jun 2007 Join Date
    Next DoorLocation
    2,098Posts

    Re: [Showcase] PHP msn

    okay I came up with this yet to be debugged code:
    PHP Code:
    <?php
    if (!strstr($message'TypingUser'))
    {
        
        
    $catch = array (
                    
    '1',
                    
    '2',
                    
    'fuck you',
                    
    'fuck me',
                    
    'im not fat sorry',
                    
    'lol'
                    
    );
        
    $response = array (
                    
    'M3GA@stoned.com, johnny10561@hotmail.com',
                    
    'HotelunderSeige',
                    
    'you punji',
                    
    'not your fat ass',
                    
    'and im human',
                    
    'go back to thailand commi, nothing is funny there'
                    
    );
        
    $default = array (
                    
    'speak english you dumb cunt',
                    
    "I can't understand a word you're saying.."
                    
    );
        
        
        if(
    eregi('hey',$mesg)>0)
        {
            return 
    $last;
        } 
        else if(
    strlen($mesg)>0)
        {
            for(
    $i=0;$i<count($catch);$i++)
            {
                if(
    eregi($catch[$i],$mesg)>0)
                {
                    return 
    $response[$i];
                }
            }
        }
        return 
    $default[rand(0,1)]; //default message incase we can't find a match
    }  
    ?>
    Hope you like :)


    update: Now, if the arrays were stored in a database of some sort, we'd be able to grab, insert, & update a limitless amount of messages which connect to responses. With the talktomebot, it actually had multiple responses for multiple messages (related of course), so that if you said hi, hey, hello, or hai, it might give you the same response, or a different one in return.

    I feel that gave the bot a little bit more life. The important thing to keep in mind is to keep it simple, and keep it dynamic. Later we can talk about giving users the power to add responses & such.

  7. #7
    Vous Pas Reel HotelUnderSeige is offline
    MemberRank
    Nov 2007 Join Date
    ColoradoSpringsLocation
    1,290Posts

    Re: [Showcase] PHP msn

    Quote Originally Posted by s-p-n View Post
    okay I came up with this yet to be debugged code:
    PHP Code:
    <?php
    if (!strstr($message'TypingUser'))
    {
        
        
    $catch = array (
                    
    '1',
                    
    '2',
                    
    'fuck you',
                    
    'fuck me',
                    
    'im not fat sorry',
                    
    'lol'
                    
    );
        
    $response = array (
                    
    'M3GA@stoned.com, johnny10561@hotmail.com',
                    
    'HotelunderSeige',
                    
    'you punji',
                    
    'not your fat ass',
                    
    'and im human',
                    
    'go back to thailand commi, nothing is funny there'
                    
    );
        
    $default = array (
                    
    'speak english you dumb cunt',
                    
    "I can't understand a word you're saying.."
                    
    );
        
        
        if(
    eregi('hey',$mesg)>0)
        {
            return 
    $last;
        } 
        else if(
    strlen($mesg)>0)
        {
            for(
    $i=0;$i<count($catch);$i++)
            {
                if(
    eregi($catch[$i],$mesg)>0)
                {
                    return 
    $response[$i];
                }
            }
        }
        return 
    $default[rand(0,1)]; //default message incase we can't find a match
    }  
    ?>
    Hope you like :)


    update: Now, if the arrays were stored in a database of some sort, we'd be able to grab, insert, & update a limitless amount of messages which connect to responses. With the talktomebot, it actually had multiple responses for multiple messages (related of course), so that if you said hi, hey, hello, or hai, it might give you the same response, or a different one in return.

    I feel that gave the bot a little bit more life. The important thing to keep in mind is to keep it simple, and keep it dynamic. Later we can talk about giving users the power to add responses & such.
    thanks man, uh im not sure why? Everythign seems to get closed, and working, but it errors out the switch statment? at line 184.
    PHP Code:
                break;
                          case 
    'MSG':
                        list(,,, 
    $msglen) = explode (' '$data);
                    break;
                    case 
    'BYE':
                        return 
    null;
                    break; 

  8. #8
    :-) s-p-n is offline
    DeveloperRank
    Jun 2007 Join Date
    Next DoorLocation
    2,098Posts

    Re: [Showcase] PHP msn

    Something doesn't look right with this,
    PHP Code:
    list(,,, $msglen) = explode (' '$data); 
    What exactly are you trying to do here? I don't remember seeing this part :)

  9. #9
    Vous Pas Reel HotelUnderSeige is offline
    MemberRank
    Nov 2007 Join Date
    ColoradoSpringsLocation
    1,290Posts

    Re: [Showcase] PHP msn

    Quote Originally Posted by s-p-n View Post
    Something doesn't look right with this,
    PHP Code:
    list(,,, $msglen) = explode (' '$data); 
    What exactly are you trying to do here? I don't remember seeing this part :)
    to be honest, im not realyl sure what it is doing, it was just in the base.

  10. #10
    :-) s-p-n is offline
    DeveloperRank
    Jun 2007 Join Date
    Next DoorLocation
    2,098Posts

    Re: [Showcase] PHP msn

    Quote Originally Posted by HotelUnderSeige View Post
    to be honest, im not realyl sure what it is doing, it was just in the base.
    Just PM me the files
    update: Did you write all the OOP or get it from somewhere? There's allot of code in these files :S
    upate 2:
    Okay I found a bug in the first one, where you placed the new code

    I think a few statements needed to be closed, because the brackets weren't matching up after I looked at it. I also re-indented some code, I hope it's organized right.

    Again, it's not debugged, so it might not work.

    If it fails, then reverting back to your original code is the simplest solution.

    PHP Code:
    <?php
        
    /**
         *
         * desc    :    recieve an IM from the switchboard
         *
         * in    :    none
         * out    :    a. null on fail/no message
         *        b. message string
         *
         */

        
    function rx_im()
        {
            
    $message null;
            
    $msglen null;

            
    stream_set_timeout($this->sb1);

            while (!
    feof($this->sb))
            {
                
    $data = ($msglen) ? $this->_get($msglen) : $this->_get();


                switch (
    substr($data03))
                {
                    default:
                        
    //if (empty($msglen)) continue;

                        
    $message.= strtolower($data);

                        if (
    strlen($message) >= $msglen && !empty($msglen))
                        {
                            
    $mesg explode("\n"trim($message));

                            
    $last "type 1 for people who fail, and 2 for people who win";
                                                                    
                            
    //if (@substr($last, 0, 10) != 'TypingUser')
                            
    if (!strstr($message'TypingUser'))
                            {
                                      
                                
    $catch = array (
                                        
    '1',
                                        
    '2',
                                        
    'fuck you',
                                        
    'fuck me',
                                        
    'im not fat sorry',
                                        
    'lol'
                                        
    );
                                
    $response = array (
                                            
    'M3GA@stoned.com, johnny10561@hotmail.com',
                                            
    'HotelunderSeige',
                                            
    'you to punji',
                                            
    'not your fat ass',
                                            
    'and im human',
                                            
    'go back to thailand commi, nothing is funny there'
                                            
    );
                                
    $default = array (
                                            
    'speak english you dumb cunt',
                                            
    "I can't understand a word you're saying.."
                                            
    );
                            if(
    eregi('hey',$mesg)>0
                            {
                                    return 
    $last;
                            } 
                            else if(
    strlen($mesg)>0
                            {
                                for(
    $i=0;$i<count($catch);$i++) 
                                {
                                    if(
    eregi($catch[$i],$mesg)>0
                                    {
                                        return 
    $response[$i];
                                    }
                                }
                            }
                                
    $msglen null;
                                
    $message null;
                        }
                    }
                    if (
    $this->session_start_time 10 time())
                    {
                        
    // looks like we've been idle for a while
                        
    echo 'IM timed out';
                        
    $this->im_close();
                            return 
    null;
                    }
                    break;
                           case 
    'MSG':
                        list(,,, 
    $msglen) = explode (' '$data);
                    break;
                    case 
    'BYE':
                        return 
    null;
                    break;
                }
            }

            return 
    null;
        }
    ?>
    Last edited by s-p-n; 29-05-09 at 11:19 PM. Reason: fi

  11. #11
    Vous Pas Reel HotelUnderSeige is offline
    MemberRank
    Nov 2007 Join Date
    ColoradoSpringsLocation
    1,290Posts

    Re: [Showcase] PHP msn

    Quote Originally Posted by s-p-n View Post
    Just PM me the files
    update: Did you write all the OOP or get it from somewhere? There's allot of code in these files :S
    upate 2:
    Okay I found a bug in the first one, where you placed the new code

    I think a few statements needed to be closed, because the brackets weren't matching up after I looked at it. I also re-indented some code, I hope it's organized right.

    Again, it's not debugged, so it might not work.

    If it fails, then reverting back to your original code is the simplest solution.

    PHP Code:
    <?php
        
    /**
         *
         * desc    :    recieve an IM from the switchboard
         *
         * in    :    none
         * out    :    a. null on fail/no message
         *        b. message string
         *
         */

        
    function rx_im()
        {
            
    $message null;
            
    $msglen null;

            
    stream_set_timeout($this->sb1);

            while (!
    feof($this->sb))
            {
                
    $data = ($msglen) ? $this->_get($msglen) : $this->_get();


                switch (
    substr($data03))
                {
                    default:
                        
    //if (empty($msglen)) continue;

                        
    $message.= strtolower($data);

                        if (
    strlen($message) >= $msglen && !empty($msglen))
                        {
                            
    $mesg explode("\n"trim($message));

                            
    $last "type 1 for people who fail, and 2 for people who win";
                                                                    
                            
    //if (@substr($last, 0, 10) != 'TypingUser')
                            
    if (!strstr($message'TypingUser'))
                            {
                                      
                                
    $catch = array (
                                        
    '1',
                                        
    '2',
                                        
    'fuck you',
                                        
    'fuck me',
                                        
    'im not fat sorry',
                                        
    'lol'
                                        
    );
                                
    $response = array (
                                            
    'M3GA@stoned.com, johnny10561@hotmail.com',
                                            
    'HotelunderSeige',
                                            
    'you to punji',
                                            
    'not your fat ass',
                                            
    'and im human',
                                            
    'go back to thailand commi, nothing is funny there'
                                            
    );
                                
    $default = array (
                                            
    'speak english you dumb cunt',
                                            
    "I can't understand a word you're saying.."
                                            
    );
                            if(
    eregi('hey',$mesg)>0
                            {
                                    return 
    $last;
                            } 
                            else if(
    strlen($mesg)>0
                            {
                                for(
    $i=0;$i<count($catch);$i++) 
                                {
                                    if(
    eregi($catch[$i],$mesg)>0
                                    {
                                        return 
    $response[$i];
                                    }
                                }
                            }
                                
    $msglen null;
                                
    $message null;
                        }
                    }
                    if (
    $this->session_start_time 10 time())
                    {
                        
    // looks like we've been idle for a while
                        
    echo 'IM timed out';
                        
    $this->im_close();
                            return 
    null;
                    }
                    break;
                           case 
    'MSG':
                        list(,,, 
    $msglen) = explode (' '$data);
                    break;
                    case 
    'BYE':
                        return 
    null;
                    break;
                }
            }

            return 
    null;
        }
    ?>
    Ok. so i added a few things, then it gets rid of the error, but the part where it counts the arrays, it sort of messes up, i added. It does not display any message but when you type hey.
    PHP Code:
    if((end($mesg) == "hey")>0)
                            {
                                    return 
    $last;
                            } 
                            elseif(
    strlen(end($mesg))>0
                            {
                                for(
    $i=0;$i<count($catch);$i++) 
                                {

                    if((
    end($mesg) == $catch[$i])>0)
                                    {
                                        return 
    $response[$i];
                                    }
                                }
                            } 

  12. #12
    Account Upgraded | Title Enabled! Guy is offline
    MemberRank
    Apr 2009 Join Date
    919Posts

    Re: [Showcase] PHP msn

    Ideally, you should be using a database or other method of file storage (i.e.: XML or plaintext) for the list of responses.

    Then again, the bot could be scripted to be self-learning, such as PyBorg.

  13. #13
    Vous Pas Reel HotelUnderSeige is offline
    MemberRank
    Nov 2007 Join Date
    ColoradoSpringsLocation
    1,290Posts

    Re: [Showcase] PHP msn

    Quote Originally Posted by gWX0 View Post
    Ideally, you should be using a database or other method of file storage (i.e.: XML or plaintext) for the list of responses.

    Then again, the bot could be scripted to be self-learning, such as PyBorg.
    and i am actually doing that.

  14. #14
    :-) s-p-n is offline
    DeveloperRank
    Jun 2007 Join Date
    Next DoorLocation
    2,098Posts

    Re: [Showcase] PHP msn

    Wait.. Why did you switch it back to end() instead of eregi() again? For testing?

    I made and debugged this function and it works with a simple form.

    You should easilly be able to plug this into your function
    PHP Code:
    function give_response($mesg)
    {
        
    $last 'hey!';
        
        
        
        
    $catch = array (
            
    '1',
            
    '2',
            
    'fuck you',
            
    'fuck me',
            
    'im not fat sorry',
            
    'lol'
            
    );
        
    $response = array (
                
    'M3GA@stoned.com, johnny10561@hotmail.com',
                
    'HotelunderSeige',
                
    'you to punji',
                
    'not your fat ass',
                
    'and im human',
                
    'go back to thailand commi, nothing is funny there'
                
    );
        
    $default = array (
                
    'speak english you dumb cunt',
                
    "I can't understand a word you're saying.."
                
    );
        
        
        if(
    eregi('hey',$mesg)>0
        {
            return 
    $last;
        } 
        else if(
    strlen($mesg)>0
        {
            for(
    $i=0;$i<count($catch);$i++) 
            {
                if(
    eregi($catch[$i],$mesg)>0
                {
                    return 
    $response[$i];
                }
            }
        } else return 
    $defaultrand(0, (count($default)-1) ) ];

    Enjoy ;)

  15. #15
    Vous Pas Reel HotelUnderSeige is offline
    MemberRank
    Nov 2007 Join Date
    ColoradoSpringsLocation
    1,290Posts

    Re: [Showcase] PHP msn

    Quote Originally Posted by s-p-n View Post
    Wait.. Why did you switch it back to end() instead of eregi() again? For testing?

    I made and debugged this function and it works with a simple form.

    You should easilly be able to plug this into your function
    PHP Code:
    function give_response($mesg)
    {
        
    $last 'hey!';
        
        
        
        
    $catch = array (
            
    '1',
            
    '2',
            
    'fuck you',
            
    'fuck me',
            
    'im not fat sorry',
            
    'lol'
            
    );
        
    $response = array (
                
    'M3GA@stoned.com, johnny10561@hotmail.com',
                
    'HotelunderSeige',
                
    'you to punji',
                
    'not your fat ass',
                
    'and im human',
                
    'go back to thailand commi, nothing is funny there'
                
    );
        
    $default = array (
                
    'speak english you dumb cunt',
                
    "I can't understand a word you're saying.."
                
    );
        
        
        if(
    eregi('hey',$mesg)>0
        {
            return 
    $last;
        } 
        else if(
    strlen($mesg)>0
        {
            for(
    $i=0;$i<count($catch);$i++) 
            {
                if(
    eregi($catch[$i],$mesg)>0
                {
                    return 
    $response[$i];
                }
            }
        } else return 
    $defaultrand(0, (count($default)-1) ) ];

    Enjoy ;)
    First, I did'nt do eragi cause you did $mesg, which would be any message sent, i was being stupid, and didnt ad the if(eregi('hey', end($mesg)) to it, lol. Oh and I figured out the multiple respone thing, with the arrays, lol . Thanks

  16. #16
    :-) s-p-n is offline
    DeveloperRank
    Jun 2007 Join Date
    Next DoorLocation
    2,098Posts

    Re: [Showcase] PHP msn

    Ohhhhh Okay So it must be end('$mesg') because $mesg is an array of messages.. That makes perfect sense, I don't know why I thought otherwise :P

    Okay, so it works then. Cool ;)

    It may be better used like this:

    PHP Code:
    function give_response($mesg,$catch,$response)
    {
        
    $last = (string) 'hey!';

        
    $mesg = (string) $mesg;
        
    $catch = (array) $catch;
        
    $response = (array) $response;
      
        
    $default = array (
                
    'speak english you dumb cunt',
                
    "I can't understand a word you're saying.."
                
    );
        
        
        if(
    eregi('hey',$mesg)>0
        {
            return 
    $last;
        } 
        else if(
    strlen($mesg)>0
        {
            for(
    $i=0;$i<count($catch);$i++) 
            {
                if(
    eregi($catch[$i],$mesg)>0
                {
                    return 
    $response[$i];
                }
            }
        } else return 
    $defaultrand(0, (count($default)-1) ) ];
    }  



    $catch = array (
            
    '1',
            
    '2',
            
    'fuck you',
            
    'fuck me',
            
    'im not fat sorry',
            
    'lol'
            
    );
    $response = array (
                
    'M3GA@stoned.com, johnny10561@hotmail.com',
                
    'HotelunderSeige',
                
    'you to punji',
                
    'not your fat ass',
                
    'and im human',
                
    'go back to thailand commi, nothing is funny there'
                
    );
    $new_message give_response(end($mesg),$catch,$response); 
    This way the arrays are a bit more flexible. So if you decide to switch to MySQL for storage, it will be more easy because you can just add the assiciative array returned from `mysql_fetch_array()` or `mysql_fetch_assoc()`.

    Good luck ;)

    Edit:

    You might consider making $default outside the function as well :P I forgot about that.. - It's another thing you might want in the db
    Last edited by s-p-n; 31-05-09 at 04:01 PM. Reason: default



Advertisement