Java login not working
Hi, I'm trying to login to HBH using java, but for some reason my code isn't wokring. I'm not getting an error or anything, just no result at all. Could someone have a look at the code and point me in the right direction? Any help is appreciated. (I know I'll need PHPSESSID later on when going to the mission URL, but I should be getting some result at this stage first).
My code: http://pastebin.com/DN8rBUtv
Edit: after editing the code a little, I've managed to make it connect to HBH, but when I move to a URL different from the homepage(some of the timed challenges), it says I'm not logged in. I am passing the PHPSESSID in a cookie, is there something else I need other than the session id?
Yes, this website is based on PHP-fusion, there are two/three other cookies that are set but one of them is probably most important:
fusion_user=blah.blah;
This is necessary for the CMS to know that you're logged in (I think).
There are also two others: fusion_visited=TRUE; and fusion_lastvisit=time(seconds, probably a UNIX timestamp);
I don't think these are as important. Hope this helps!
Jim,
@COM: Ah fair do, I think it's harder to use Java for these challanges because it over complicates the simple, I hadn't read the code so I just took a guess… :P
Jim,
@j4m32: Thanks, Jim, you really helped me out a lot.
@COM: Actually, that's exactly what my problem was. Works like a charm now.
In case there are other "blatant" java users like me out there having trouble with this, here's how I did it: http://pastebin.com/DN8rBUtv
Of course that's just the connection part and you have to get the data and solve the challenge yourselves, and you don't really need to print everything to the screen, I just wanted to see that it works :)
BrandonHeat wrote: @COM: Actually, that's exactly what my problem was. Works like a charm now. Actually, no. Notice how you have a user agent in there now (which you didn't before when I checked it)? Yeah…
Thread revival:
OK, so my code works perferctly for HBH, I've already finished 5 or 6 of the programming challenges and everything is fine, but for the life of me I can't ajust my code to work for HTS. I've asked there, but nobody seems to know. Do you know what I need to add, I've trying setting all the request properties to match what I get with tamper data, filled in all the cookie values, but to no avail. If anyone here has also done some programming challenges at HackThisSite, could you please give me a hand. Thanks.