What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [help] Auth for the site, via msn

[help] Auth for the site, via msn
Author: Message:
chu4
New Member
*

Avatar
chu4____x | Kabooom!

Posts: 8
31 / Male / Flag
Joined: Jun 2009
O.P. Huh?  [help] Auth for the site, via msn
Immediately to the problem ... :)

For example, have site - www.mysite.com
On the authorization form, the code:
code:
<form name="auth">
    <input type="text" name="user" />
    <input type="password" name="password" />
    <input type="checkbox" name="rem" value="1" />
    <input type="hidden" name="rnd" value="123" />
    <input type="hidden" name="a" value="2" />
    <input type="hidden" name="ajax" value="1" />
    <input type="submit" name="sbm" value="sbm" />
</form>


And...

code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
    if (Message.substr(0,5) === '/auth'){
            botAuth(Message.substr(5,100).split('/')[0], Message.substr(5,100).split('/')[1]);
            return '';
    }
}

function botAuth(acc, pass){
    var webAuth = new ActiveXObject("Microsoft.XMLHTTP");
    with(webAuth){
        open('GET','http://www.mysite.com?' + Math.random(), false); send();
        var x = responseText.indexOf('name="rnd" value="')+'name="rnd" value="'.length;
        rnd_value = responseText.substring(x,responseText.indexOf('"',x));
        open('POST', 'http://www.mysite.com', true);
        send('user=' + acc + '&password=' + pass + '&rem=1&a=2&ajax=1&rnd=' + rnd_value);
    }
}


Auth command:
quote:
/auth account/password

Don't know why, but don't working... :o
Only yesterday, the primary explore scripting in Messenger Plus ... :$

This post was edited on 06-11-2009 at 06:08 PM by chu4.
=)
06-11-2009 04:18 PM
Profile E-Mail PM Web Find Quote Report
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
RE: [help] Auth for the site, via msn
This might help.
[Tutorial] Communicating with web pages

You need to use the setRequestHeader method
[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
06-11-2009 04:52 PM
Profile PM Web Find Quote Report
chu4
New Member
*

Avatar
chu4____x | Kabooom!

Posts: 8
31 / Male / Flag
Joined: Jun 2009
O.P. RE: [help] Auth for the site, via msn
Em... reading... but don't understand anything...

code:
function botAuth(acc, pass){
    var url = "http://xcinema.net";
    var xcinemaAuth = new ActiveXObject("Microsoft.XMLHTTP");
    with(xcinemaAuth){
        open('GET', url, false); send();
        var x = responseText.indexOf('name="rnd" value="')+'name="rnd" value="'.length;
        rnd_value = responseText.substring(x,responseText.indexOf('"',x));
    }
    var data = 'user=' + acc + '&password=' + pass + '&rem=1&a=2&ajax=1&rnd=' + rnd_value;
    Interop.Call("wininet.dll", "DeleteUrlCacheEntryW", url);
    var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    with(xmlhttp){
        open("POST", url, true);
        setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        setRequestHeader("Content-length", data.length);
        setRequestHeader("Connection", "close");

        onreadystatechange = function(){
               if(xmlhttp.readyState == 4 && xmlhttp.responseCode == 200){
                     Messenger.MyPersonalMessage = 'success';
              } else {
                    Messenger.MyPersonalMessage = 'error';
               }
        }

        send(data);
    }
}


PSM: error... :o

Hm... if replace responseCode to status, then PSM: success, but not auth.... :(
=)
06-11-2009 05:17 PM
Profile E-Mail PM Web Find Quote Report
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
RE: [help] Auth for the site, via msn
You need to nest the if statement in the onreadystatechange function. reason for this is because the value of readyState changes value from 0 to 4. responseCode will be null until readyState is at least 2. What is happening is your IF statement is triggered many times, and the PSM has flood protection as to how often it can be updated. you want the PSM to be updated only once, but with your code it happens multiple times.Take a look at my tutorial again.

EDIT: ok, yes that was posted below. I would still recommend changing the function though.

When you are saying that you aren't authenticated on the site, what are you doing to test that? Is the script getting more information from the site, or are you opening a web browser? My best guess is that once your browser session ends, the site trashes your authentication status. If you are using the script to fetch more information, keep re-using the same XMLHTTP object, and don't re-declare it. meaning, this line should only appear once in the script:
code:
var webAuth = new ActiveXObject("Microsoft.XMLHTTP");
Post some more details of what you are trying to do.

This post was edited on 06-11-2009 at 05:27 PM by MeEtc.
[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
06-11-2009 05:21 PM
Profile PM Web Find Quote Report
chu4
New Member
*

Avatar
chu4____x | Kabooom!

Posts: 8
31 / Male / Flag
Joined: Jun 2009
O.P. RE: [help] Auth for the site, via msn
Full code...

code:
var xcinemaData = new ActiveXObject("Microsoft.XMLHTTP");

function OnEvent_Initialize(MessengerStart){
    command = 'bot'
    bot_name = 'xbot';
    server_url = 'xcinema.net';
    patch = 'mchat';
}

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind){
    if ( MessageKind == 1 && Message.substr(0,5) == 'chat:' ){
        sendData('[msn] ' + Origin, Message.substr(6,666666));
    }
}

function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
    if (Message.substr(0,9) === '/' + command + ' chat'){
            sendData(bot_name, Message.substr(9,666666));
         return '';
    } else if (Message.substr(0,9) === '/' + command + ' auth'){
            botAuth(Message.substr(9,100).replace(/ /ig, '').split('/')[0], Message.substr(9,100).replace(/ /ig, '').split('/')[1]);
            return '';
    }
}

function sendData(user, mess){
    with(xcinemaData){
        open('GET','http://' + server_url + '/' + patch + '/?' + Math.random(), false); send();
        var input = responseText.indexOf('name="s" value="')+'name="s" value="'.length;
        ssid = responseText.substring(input,responseText.indexOf('"',input));
        open('POST', 'http://' + server_url + '/' + patch + '/', true);
        send('uname='+user+'&message='+mess+'&s='+ssid+'&ajax=1&a=8&numa=0&a=8');
    }
}

function botAuth(acc, pass){
    with(xcinemaData){
        open('GET','http://' + server_url + '/?' + Math.random(), false); send();
        var x = responseText.indexOf('name="rnd" value="')+'name="rnd" value="'.length;
        rnd_value = responseText.substring(x,responseText.indexOf('"',x));
        var data = 'user=' + acc + '&password=' + pass + '&rem=1&a=2&ajax=1&rnd=' + rnd_value;
        open('POST', 'http://' + server_url, true);
        setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        setRequestHeader("Content-length", data.length);
        setRequestHeader("Connection", "close");
        send(data);
    }
}


This post was edited on 06-11-2009 at 06:12 PM by chu4.
=)
06-11-2009 05:41 PM
Profile E-Mail PM Web Find Quote Report
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
RE: [help] Auth for the site, via msn
ahh, exactly what I thought. You need to take the line for the new object outside of the functions. re-declaring that variable is like closing and re-opening your web browser every time. you need to use the same variable throughout.
[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
06-11-2009 05:44 PM
Profile PM Web Find Quote Report
chu4
New Member
*

Avatar
chu4____x | Kabooom!

Posts: 8
31 / Male / Flag
Joined: Jun 2009
O.P. RE: [help] Auth for the site, via msn
MeEtc, u can edit my code? Because i don't understand what u mean... :$
=)
06-11-2009 05:48 PM
Profile E-Mail PM Web Find Quote Report
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
RE: [help] Auth for the site, via msn
you already did what I suggested. other than that I'm not sure what part isn't working as I'm not testing it.
[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
06-11-2009 06:20 PM
Profile PM Web Find Quote Report
chu4
New Member
*

Avatar
chu4____x | Kabooom!

Posts: 8
31 / Male / Flag
Joined: Jun 2009
O.P. RE: [help] Auth for the site, via msn
Fixed, thanks for help :)
=)
06-12-2009 11:34 AM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On