Valhalla Legends Forums Archive | Visual Basic Programming | Some problems with Winsock

AuthorMessageTime
QwertyMonster
Hey again. I've got another problem, sadly.

Okay, i'm making a simple bot for something called www.fanbox.com. My bot logs in fine with this code:

[code]
    pdata = "m=login&e=" & txtuser.text & "&z=" & txtpass.text & "&r=false"
    p = p & "POST /socnet/SignInSignUp.ashx HTTP/1.1" & vbCrLf
    p = p & "Host: www.fanbox.com" & vbCrLf
    p = p & "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20" & vbCrLf
    p = p & "Accept: text/javascript, text/html, application/xml, text/xml, */*" & vbCrLf
    p = p & "Accept-Language: en-us" & vbCrLf
    p = p & "Accept-Encoding: " & vbCrLf
    p = p & "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" & vbCrLf
    p = p & "Keep-Alive: 300" & vbCrLf
    p = p & "Connection: keep-alive" & vbCrLf
    p = p & "Content-Type: application/x-www-form-urlencoded" & vbCrLf
    p = p & "Referer: http://www.fanbox.com/" & vbCrLf
    p = p & "Content-Length: " & Len(pdata) & vbCrLf
    p = p & "Cookie: " & vbCrLf & vbCrLf
    p = p & pdata
    sckTest.SendData p
[/code]

And the response I get is "success". So right now, I *should* logged in. I then send a GET in the Data_Arrival, only to find out the connection has been lost and nothing happens. So a way around that was to make another winsock connect in the data_arrival of the first winsock. I extracted all the "Set-Cookie: " into a listbox for easier and use, and used it like so.

I send this:

[code]
    a = a & "GET /socnet/Desktop.aspx?src=logout&r=933808 HTTP/1.1" & vbCrLf
    a = a & "Host: profile.fanbox.com" & vbCrLf
    a = a & "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20" & vbCrLf
    a = a & "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" & vbCrLf
    a = a & "Accept-Language: en-us" & vbCrLf
    a = a & "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" & vbCrLf
    a = a & "Keep-Alive: 300" & vbCrLf
    a = a & "Connection: close" & vbCrLf
    a = a & "Cookie: " & List1.List(0) & "; " & List1.List(1) & "; " & List1.List(2) & "; " & List1.List(3) & "; " & List1.List(4) & "; " & List1.List(5) & "; " & List1.List(6) & vbCrLf & vbCrLf[/code]

That is what is sent next when you have successfully logged into FanBox. (I packet logged it). I get a dump of HTML. For debug purposes I save it into a .html file and view it. It says i'm not logged in.

What the hell is happening here? I can't work it out. It says i am logging in fine, but then when I go to do an action (such as a GET, or POST to the site), it says I am not logged in!

Thanks.
January 27, 2009, 2:50 AM
chyea
Why the hell are you using FanFox? It's also called FanBox, which is the name I know it by.

I interviewed for a job there last year and the company turned out to be a sort of scam operation. They hire and fire people like it's nothing. The turn around rate is like half a year there. From what I've read they hire people, have them spam forums and emails and stuff, then fire them. From what I remember, the site itself (FanBox) was a crappy waste of time, too.

What do you do on it? lol
January 27, 2009, 7:57 AM
QwertyMonster
My friend makes £500 a day from it. I'm making only £200 a day at the moment.

Anyway I have found out why it keeps getting logged out. My bot logs in fine, but then the host changes from "fanbox.com" to "profile.fanbox.com" so I have to re-connect, thus causing me to lose connection.

Does anyone have any ideas on how to not lose connection but change who i'm connected to? =\ Changing the "Host: blah" doesn't work.
January 27, 2009, 1:40 PM
FrostWraith
Try creating another socket?  Just run the connections on two different threads.
January 27, 2009, 2:38 PM
TheMinistered
Well the server considers you logged in, thats how html works IIRC.  You connect and make a request... in your case a login request, it replys then closes... Once it sends the reply (success) the page it disconnects, you have to connect again to send anymore requests...

When you login a website it basically sets a state for your ip/connection. It will then use this state to determine if you can view certain pages such as if you want to change your user profile on a website
you have to login then goto the page to change it, the server does this (this is psuedo code):

If userstate = loggedin then yes_he_can_view_changeuserprofile.html

[edit] I hope I'm making since to you cause I been up for 2 days and i'm quite tired... if you need help just aim me: vbaddict
February 14, 2009, 5:42 PM
Myndfyr
TM!  Welcome back!
February 14, 2009, 8:10 PM
TheMinistered
thanks, nice to be back ;p
February 19, 2009, 5:36 AM

Search