Perl

Moderators: Jonathan
Number of threads: 1259
Number of posts: 3644

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Login to a forum with socket... can't stay logged in Posted by nasaiya2 on 11 Jan 2009 at 12:28 PM
Hi,

I'm hoping someone can help me with this problem that has me banging my head against the keyboard.

I'm writing a script that connects via socket to a vbulletin forum, POSTS the login form, and then /should/ (once logged in) just GET a page to be parsed.

The forum seems to create a session upon your first visit to a page if you aren't logged in, so I GET the home page, snatch the session id out of it and post it with the login form just like the site does. The login is successful and the server returns the "you are logged in, you will be redirected to blah blah blah" page.

But the problem is no matter what I do after that I can't stay logged in! The site does set a sessionhash cookie and some other cookies which I AM reading and sending back to the server in my final GET request (I made sure by watching it with wireshark) but that doesn't do it...

I've compared my script's conversation with the server against the same conversation using lynx with wireshark and I can't find anything different except lynx stays logged in, and my script doesn't.

I'm wondering if anyone has any ideas. I could attach some code if necessary but I think I'm just missing something.

Thanks in advance!
Report
Re: Login to a forum with socket... can't stay logged in Posted by leeb003 on 12 Jan 2009 at 6:21 PM
Since you are using wireshark, do you notice any resets?
Have you tried WWW::Mechanize?
Report
Re: Login to a forum with socket... can't stay logged in Posted by nasaiya2 on 12 Jan 2009 at 8:15 PM
Thanks for the reply!

No there don't seem to be any resets coming. It's actually starting to look like the server won't take the session id cookie the script sends for some reason...

The SID actually gets sent to the login.php page as part of the login form which would explain why it allows me to get to the "login success" page. The login success page tells me to set a cookie with that same SID which I believe must be the only way it checks if I'm logged in.

Maybe I'm not sending the cookie properly but according to wireshark, my script's cookie is identical to the one lynx sends. I don't get it.

I've come to this conclusion after discovering that if I append "?s=theSessionId" to the url of the page I'm trying to access it does in fact think I'm logged in.

Do you see anything wrong with this cookie line? I sure don't...
"Cookie: bblastvisit=1231815759, bblastactivity=0, IDstack=%2C137742%2C, bbsessionhash=blahblahblah \r\n"





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.