Permanent Programming 11

Put your programming skills to the test in these challenges.

Re: Permanent Programming 11

Post by nawledge on Sat Feb 27, 2010 9:25 pm
([msg=35883]see Re: Permanent Programming 11[/msg])

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?
nawledge
New User
New User
 
Posts: 5
Joined: Fri Feb 26, 2010 3:54 am
Blog: View Blog (0)


Re: Permanent Programming 11

Post by sanddbox on Sat Feb 27, 2010 9:32 pm
([msg=35884]see Re: Permanent Programming 11[/msg])

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.
Image

HTS User Composition:
95% Male
4.98% Female
.01% Monica
.01% Goat
User avatar
sanddbox
Expert
Expert
 
Posts: 2331
Joined: Sat Jul 04, 2009 5:20 pm
Blog: View Blog (0)


Re: Permanent Programming 11

Post by faazshift on Sat Feb 27, 2010 9:37 pm
([msg=35885]see Re: Permanent Programming 11[/msg])

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/`.
faazshift
Contributor
Contributor
 
Posts: 516
Joined: Wed Jun 03, 2009 3:55 pm
Location: Riverton, Utah
Blog: View Blog (0)


Re: Permanent Programming 11

Post by nawledge on Sat Feb 27, 2010 10:16 pm
([msg=35890]see Re: Permanent Programming 11[/msg])

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!
nawledge
New User
New User
 
Posts: 5
Joined: Fri Feb 26, 2010 3:54 am
Blog: View Blog (0)


Re: Permanent Programming 11

Post by faazshift on Sat Feb 27, 2010 11:19 pm
([msg=35893]see Re: Permanent Programming 11[/msg])

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!
faazshift
Contributor
Contributor
 
Posts: 516
Joined: Wed Jun 03, 2009 3:55 pm
Location: Riverton, Utah
Blog: View Blog (0)


Re: Permanent Programming 11

Post by pownage1337 on Sun Mar 28, 2010 8:49 am
([msg=37412]see Re: Permanent Programming 11[/msg])

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.
pownage1337
New User
New User
 
Posts: 1
Joined: Sun Mar 28, 2010 8:47 am
Blog: View Blog (0)


Re: Permanent Programming 11

Post by maxflow on Mon Mar 29, 2010 11:29 am
([msg=37435]see Re: Permanent Programming 11[/msg])

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.
maxflow
New User
New User
 
Posts: 1
Joined: Mon Mar 29, 2010 11:11 am
Blog: View Blog (0)


Re: Permanent Programming 11

Post by msbachman on Sat May 29, 2010 2:50 am
([msg=39245]see Re: Permanent Programming 11[/msg])

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.
"I'm going to get into your sister. I'm going to get my hands on your daughter."
~Gatito
User avatar
msbachman
Contributor
Contributor
 
Posts: 681
Joined: Mon Jan 12, 2009 10:22 pm
Location: In the sky lol
Blog: View Blog (0)


Re: Permanent Programming 11

Post by xor-logic on Sun Jul 18, 2010 8:52 pm
([msg=42081]see Re: Permanent Programming 11[/msg])

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?
xor-logic
New User
New User
 
Posts: 24
Joined: Mon Jul 12, 2010 7:10 pm
Blog: View Blog (0)


Re: Permanent Programming 11

Post by msbachman on Sun Jul 18, 2010 9:18 pm
([msg=42083]see Re: Permanent Programming 11[/msg])

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.
"I'm going to get into your sister. I'm going to get my hands on your daughter."
~Gatito
User avatar
msbachman
Contributor
Contributor
 
Posts: 681
Joined: Mon Jan 12, 2009 10:22 pm
Location: In the sky lol
Blog: View Blog (0)


PreviousNext

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests