Shoutbox

javascript injections - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: javascript injections (/showthread.php?tid=77322)

javascript injections by LifelesS on 09-08-2007 at 01:00 PM

Hi everyone.

I'm trying to make a script like MySpace Manager but for hi5, but hi5 pages are .do...

My question is, how can I (if possible) use javascript injections to login using Microsoft.XMLHTTP:

say I want to login.

I open the browser on www.hi5.com
then type this on the url:

code:
javascript:void(document.loginForm.email.value="<email>");
void(document.loginForm.password.value="<password>");
void(document.loginForm.remember.checked=false);
void(document.loginForm.submit())

and it logins... My problem is how to use it on a script.
RE: javascript injections by Spunky on 09-08-2007 at 02:03 PM

why not open the actual login page ("login.do for example") and then send the username and password as POST variables?


RE: javascript injections by LifelesS on 09-08-2007 at 02:14 PM

how can I do it? :^)

I haven't use XMLHTTP before so I'm in the dark... I've read somethings about it, but still..


RE: javascript injections by Matti on 09-08-2007 at 03:16 PM

Based on the code from win_crook's reply to Web Services?.

code:
var sUrl = "http://www.hi5.com/friend/login.do";
var sEmail = "EMAIL";
var sPassword = "PASSWORD";

var ajax = new ActiveXObject("Microsoft.XMLHTTP");
ajax.open("POST", sUrl, true);
ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
var sEncodedEmail = encodeURIComponent(sEmail);
var sEncodedPassword = encodeURIComponent(sPassword);

ajax.onreadystatechange = function() {
   if(ajax.readyState == 4 && ajax.status == 200) {
      Debug.Trace("Success!\nResponse text: "+ajax.responseText);
   }
}

ajax.send("email="+sEncodedEmail+"&password="+sEncodedPassword);

RE: RE: javascript injections by LifelesS on 09-08-2007 at 05:23 PM

quote:
Originally posted by Mattike
Based on the code from win_crook's reply to Web Services?.
code:
var sUrl = "http://www.hi5.com/friend/login.do";
var sEmail = "EMAIL";
var sPassword = "PASSWORD";

var ajax = new ActiveXObject("Microsoft.XMLHTTP");
ajax.open("POST", sUrl, true);
ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
var sEncodedEmail = encodeURIComponent(sEmail);
var sEncodedPassword = encodeURIComponent(sPassword);

ajax.onreadystatechange = function() {
   if(ajax.readyState == 4 && ajax.status == 200) {
      Debug.Trace("Success!\nResponse text: "+ajax.responseText);
   }
}

ajax.send("email="+sEncodedEmail+"&password="+sEncodedPassword);


Thanks Mattike, going to try it out ^^


Edit: Works like candy, many thanks Mattike :bow:
RE: javascript injections by LifelesS on 09-09-2007 at 07:21 PM

Is it possible to use the remember feature of it?

I'm using

code:
ajax.send("email="+sEncodedEmail+"&password="+sEncodedPassword+"&remember=on");

but it doesn't work..
RE: javascript injections by Spunky on 09-09-2007 at 07:40 PM

Shouldn't remember be equal to true, not on?


RE: javascript injections by LifelesS on 09-09-2007 at 07:41 PM

I used Live HTTP headers and it send on :S

Going to try with true..


RE: javascript injections by Spunky on 09-09-2007 at 07:42 PM

The checkbox has 2 states when the form is submitted, either true (ticked) or false (not ticked). It's that that makes me think it needs changing


RE: javascript injections by LifelesS on 09-09-2007 at 07:46 PM

doesn't work either...

I guess I'll have to always call a login function..


RE: javascript injections by Spunky on 09-09-2007 at 07:47 PM

Wouldn't that be more secure anyway?


RE: javascript injections by LifelesS on 09-09-2007 at 07:48 PM

yeah, it would...

Thanks for the help :)


RE: javascript injections by ShawnZ on 09-09-2007 at 08:26 PM

you need to set remember and save the cookie somewhere.


RE: javascript injections by Spunky on 09-09-2007 at 08:27 PM

quote:
Originally posted by ShawnZ
you need to set remember and save the cookie somewhere.

if set = true the site should set the cookie shouldn't it?
RE: javascript injections by LifelesS on 09-09-2007 at 11:16 PM

now I'm with a little problem with the logout...

the logout link points to /friend/logoff.do

but If I point it to that url, it doesn't do anything, it needs the session id, like:

/friend/logoff.do;jsessionid=ahbz3I-KpO0c

I could use a regexp to get the session id from the html, the problem is that sometimes the session id doesn't show on the logoff link...

So I guess I need to get the session id from the cookie and add it to the /friend/logoff.do right? :S


RE: javascript injections by ShawnZ on 09-09-2007 at 11:37 PM

quote:
Originally posted by SpunkyLoveMuff
if set = true the site should set the cookie shouldn't it?

i said SAVE, not SET.
RE: javascript injections by davidpolitis on 09-11-2007 at 12:02 AM

Anyone have any idea how I can get the innerhtml or value etc. of an ID using XMLHTTP?

I don't wanna have to search for stuff returned by responseText.


RE: javascript injections by LifelesS on 09-11-2007 at 12:08 AM

I used a regular expression, it's simple...

code:
if(new RegExp(/\<a href=\"\/friend\/book\/displayManageBook\.do\"\>(\d+)\<\/a\>\<\/div\>/).exec(Content))

and change it for what you need, or you can search here if there's something that might help you:

MSDN
RE: javascript injections by davidpolitis on 09-11-2007 at 12:10 AM

Thanks LifelesS, goodluck with your script :P


RE: RE: javascript injections by LifelesS on 09-11-2007 at 12:14 AM

quote:
Originally posted by davidpolitis
Thanks LifelesS, goodluck with your script :P


Thanks :D

It's going alright. I've got the login/logout thingy working. If I'm lucky I can finish it in the next 2 days or something.
RE: javascript injections by smaster on 03-26-2008 at 01:34 AM

hey lifeless .. when u finish this script
can u post it here...

i want to make login functions

but i don't know how to do it ...