Page 7 of 12

Re: Permanent Programming 11

PostPosted: Sat Feb 27, 2010 9:25 pm
by nawledge
I was wrong. I have no idea how to login to hts with java. I've tried many different ways. But my best attempts get the Invalid Referrer page. I remember this being a bad user agent, i think, from earlier challenges. And tried setting the user agent to a mozilla example, to no avail. When I got the string from the page originally i just used my PHPSESSID cookie. It seems the way most posts in java work like /user/login?username=asd&password=234. The site doesn't seem to work that way.. Or maybe I'm missing the actual login page. Can anyone give me a good resource for learning this in java?

Re: Permanent Programming 11

PostPosted: Sat Feb 27, 2010 9:32 pm
by sanddbox
nawledge wrote:I was wrong. I have no idea how to login to hts with java. I've tried many different ways. But my best attempts get the Invalid Referrer page. I remember this being a bad user agent, i think, from earlier challenges. And tried setting the user agent to a mozilla example, to no avail. When I got the string from the page originally i just used my PHPSESSID cookie. It seems the way most posts in java work like /user/login?username=asd&password=234. The site doesn't seem to work that way.. Or maybe I'm missing the actual login page. Can anyone give me a good resource for learning this in java?


That's a GET request, not a POST request.

Re: Permanent Programming 11

PostPosted: Sat Feb 27, 2010 9:37 pm
by faazshift
Also, if your getting an invalid referer (yes, its misspelled, but thats how its spelled in the HTTP protocol) page, thats simple to fix. Just set the `Referer: ` header to something like `http://www.hackthissite.org/`.

Re: Permanent Programming 11

PostPosted: Sat Feb 27, 2010 10:16 pm
by nawledge
sanddbox wrote:
nawledge wrote:I was wrong. I have no idea how to login to hts with java. I've tried many different ways. But my best attempts get the Invalid Referrer page. I remember this being a bad user agent, i think, from earlier challenges. And tried setting the user agent to a mozilla example, to no avail. When I got the string from the page originally i just used my PHPSESSID cookie. It seems the way most posts in java work like /user/login?username=asd&password=234. The site doesn't seem to work that way.. Or maybe I'm missing the actual login page. Can anyone give me a good resource for learning this in java?


That's a GET request, not a POST request.


Yea, that's what I was talking about in my previous posts. After I get the string and did the math, if I release that connection to post in a new one, will the generated string not change?

-- Sat Feb 27, 2010 10:36 pm --

faazshift wrote:Also, if your getting an invalid referer (yes, its misspelled, but thats how its spelled in the HTTP protocol) page, thats simple to fix. Just set the `Referer: ` header to something like `http://www.hackthissite.org/`.


Thank you.. this bit of information got me to the "Sorry: Your answer is wrong page" !! A step forward! Thanks!

Re: Permanent Programming 11

PostPosted: Sat Feb 27, 2010 11:19 pm
by faazshift
nawledge wrote:Yea, that's what I was talking about in my previous posts. After I get the string and did the math, if I release that connection to post in a new one, will the generated string not change?

Explanation: You log in. The site makes a session and gives you a cookie with the sessions id. You request the mission page. The site generates the problem and stores the answer in the session. You figure out the answer and submit it. The site determines if it matches what the answer really is. You either pass, or you don't.

So, basically, it doesn't matter how many different connections you make, as long as you send the session-id cookie to the server each time after you get it. Just complete it within the time limit (which shouldn't be a problem with a fully automated program). So, as long as you are figuring out the right answer, you should be fine.

Good luck!

Re: Permanent Programming 11

PostPosted: Sun Mar 28, 2010 8:49 am
by pownage1337
The answer is correct, but you needed too much time. You had 3 seconds time, and needed 3.8 seconds.


I keep fluctuating between 3.5 and 4.5, so i guess I'll have to optimize my code a bit and perhaps make it auto-click the submit button and not have to do it manually.

I'm using a greasemonkey-driven Javascript, which is also slow due to executing after loading.. Oh well, nearly there!

Been stuck for ages on adding the shift instead of subtracting it, lol

EDIT: using form.submit gets me as close as 3.2 seconds! bummer! I won't give up on Javascript though!

EDIT2: Woohoo after shutting down all other programs that use my internet connection I managed to pipe it through below 3 seconds.

Re: Permanent Programming 11

PostPosted: Mon Mar 29, 2010 11:29 am
by maxflow
hello, i done my programe in c (socket programing), program works it solves the problem, but I can't post the answer, so maybe someone could give me a sample how the post data should look:

POST /missions/prog/11/index.php HTTP 1.0
Referer: http://www.hackthissite.org/missions/prog/11/index.php
Cookie: PHPSESSID=something
Content-Type: application/x-www-form-urlencoded
Content-Length: lenght(solution=answer)
solution=answer


what i mising?
another problem: to check my data I'm writing it to file, in order to make my program work fester i delete the write to file function and sudenly i get accses veluation at address: 0x0..011
with funktion everything works fine
Thanks.

Re: Permanent Programming 11

PostPosted: Sat May 29, 2010 2:50 am
by msbachman
Well, I'm in the same boat essentially as the person above, but my problem is a bit further back. I'm also using C, and I'm watching the traffic through wireshark. The traffic is going to the site but there's no response coming back.

A couple times I actually did get a full response back from the server, but it was weird. The page elements were being sent back to me like in slow motion, everything was loading at half speed. It took about four seconds for the page to be received (which is too long!). But since I only have the send portions of my socket code up and working, perhaps its the lack of the acknowledgement that's doing that (if that's pertinent whatsoever).

Here is the rough transcript of what I'm sending over:

Code: Select all
GET /missions/prog/11/index.php HTTP/1.1
Host: http://www.hackthissite.org
User-Agent: [edited]
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Cookie: [edited]


Each of these parts is separated with the "\r\n", excepting the last, which is followed with a "\r\n\r\n". That's literally pasted straight from the wireshark capture.

Any nudges in the right direction? I should mention, it's quite possible I'm doing something wrong that's simple, so don't hesitate with any suggestions that might have slipped my mind. I'm certainly no C socket expert.

If it's not been made clear the step that I'm on, what I'm doing is retrieving the page without going to it manually. Then, I plan on snagging the pertinent text and shifting it. I've got the shift down; it's the connecting part that's irking me.

-- Wed Jun 02, 2010 9:44 pm --

maxflow wrote:hello, i done my programe in c (socket programing), program works it solves the problem, but I can't post the answer, so maybe someone could give me a sample how the post data should look:

POST /missions/prog/11/index.php HTTP 1.0
Referer: http://www.hackthissite.org/missions/prog/11/index.php
Cookie: PHPSESSID=something
Content-Type: application/x-www-form-urlencoded
Content-Length: lenght(solution=answer)
solution=answer


what i mising?
another problem: to check my data I'm writing it to file, in order to make my program work fester i delete the write to file function and sudenly i get accses veluation at address: 0x0..011
with funktion everything works fine
Thanks.




I can't speak for the writing to file ( ended up doing it entirely in memory, with large char arrays), so I can't help you with that. But for the format for submitting it, I finally got it with the following form for the headers being sent across:
Code: Select all
POST /missions/prog/11/index.php HTTP/1.1
Host: www.hackthissite.org

User-Agent: [your user agent]
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 115

Connection: keep-alive

Referer: http://www.hackthissite.org/missions/prog/11/

Cookie: [your cookie]
Content-Type: application/x-www-form-urlencoded

Content-Length: 82


[there's a double \r\n\r\n here]
solution=Z8jT4JLYm.&submitbutton=submit++++++++++++%28remaining+time%3A+2+seconds%29

-----------------

I'm unsure of how precisely you're going about things, but one thing that really helped me was to use wireshark to snag what was going across the wire before the point at which I had all my socket code finished. The header code one way or another should look quite similar to that going across the wire.

As others have said, be sure to have your cookie going across in the headers! You can get this and all of the headers by clicking on the communications shown in Wireshark and going to 'follow TCP stream.'

I've got to say, you must have balls of steel to be trying this in C, I found it quite frustrating, but it was worth it in the end. Learned a lot in the process.

Good luck, hope this helps.

Re: Permanent Programming 11

PostPosted: Sun Jul 18, 2010 8:52 pm
by xor-logic
I am encountering a specific problem with the program I'm building to do this mission. So far I've written the code to connect to the HTS main page and fire off my login info, then grab the source for the resulting page so I can see if it works or not. Problem is I'm getting "Invalid Referrer". What's going on here?

Re: Permanent Programming 11

PostPosted: Sun Jul 18, 2010 9:18 pm
by msbachman
xor-logic wrote:I am encountering a specific problem with the program I'm building to do this mission. So far I've written the code to connect to the HTS main page and fire off my login info, then grab the source for the resulting page so I can see if it works or not. Problem is I'm getting "Invalid Referrer". What's going on here?


HTS seems to care about the referrer. It's a field you can send over the other headers; you're apparently sending the cookie, so somewhere in there, include a line that says "Referer: [somewhere on hts]."

I gave a similar solution to prog. 12 just today, but if you're still stuck try it with a browser with wireshark running in the background. That's what I did to know what to send.