Permanent Programming 11

Put your programming skills to the test in these challenges.

Re: Permanent Programming 11

Post by Defience on Mon Oct 04, 2010 2:53 pm
([msg=47028]see Re: Permanent Programming 11[/msg])

hungryhobo14 wrote:So, I can read from the web page to get all the info, but I am having trouble submitting my answer. is this near correct? I am programming in python, on ubuntu

print "the solved string is" + solved

values = {'solution':solved, 'submitbutton':'submit'}

solution = urllib.urlencode(values)

request = urllib2.Request("http://www.hackthissite.org/missions/prog/11", solution)
request.add_header('Referer', 'http://www.hackthissite.org/')

url = urlOpener.open(request)


when I read the returned url, it is just the normal webpage, like I did not submit anything at all. I am new to webpage interaction and programming so any help would be nice


Are you assigning 'request' earlier in your code to open the initial page? If you are, then its opening the initial 'request ='.
If that's the case, just change your submission to something like request2:
Code: Select all
print "the solved string is" + solved

values = {'solution':solved, 'submitbutton':'submit'}

solution = urllib.urlencode(values)

request2 = urllib2.Request("http://www.hackthissite.org/missions/prog/11", solution)
request2.add_header('Referer', 'http://www.hackthissite.org/')

url = urlOpener.open(request2)


Your first request is to open the webpage to get the info, your second request is to submit your answer, not to get the info from the first request again.
User avatar
Defience
Addict
Addict
 
Posts: 1280
Joined: Thu Jun 12, 2008 3:16 pm
Blog: View Blog (0)


Re: Permanent Programming 11

Post by fashizzlepop on Mon Oct 04, 2010 3:28 pm
([msg=47029]see Re: Permanent Programming 11[/msg])

s3klyma wrote:okay..
so I've found that the only cookie I need to actually send
is the PHPSESSID.. I wasn't sure because there are so many.
What's _utm[a,b,c,z,ect.]?

But.. How am I supposed to decide what the value should be?
Every time you delete it, and re-login, it changes..

It would be helpful to know what language you are using.

Ie. In Perl (what I use for these challenges), you can set up LWP to use a cookie jar. With that you can just send your login which will store your cookies with LWP. From there you will grab your problem and submit the answer.
The glass is neither half-full nor half-empty; it's merely twice as big as it needs to be.
User avatar
fashizzlepop
Developer
Developer
 
Posts: 2303
Joined: Sat May 24, 2008 1:20 pm
Blog: View Blog (0)


Re: Permanent Programming 11

Post by hungryhobo14 on Mon Oct 04, 2010 6:51 pm
([msg=47058]see Re: Permanent Programming 11[/msg])

Defience wrote:
hungryhobo14 wrote:So, I can read from the web page to get all the info, but I am having trouble submitting my answer. is this near correct? I am programming in python, on ubuntu

print "the solved string is" + solved

values = {'solution':solved, 'submitbutton':'submit'}

solution = urllib.urlencode(values)

request = urllib2.Request("http://www.hackthissite.org/missions/prog/11", solution)
request.add_header('Referer', 'http://www.hackthissite.org/')

url = urlOpener.open(request)


when I read the returned url, it is just the normal webpage, like I did not submit anything at all. I am new to webpage interaction and programming so any help would be nice


Are you assigning 'request' earlier in your code to open the initial page? If you are, then its opening the initial 'request ='.
If that's the case, just change your submission to something like request2:
Code: Select all
print "the solved string is" + solved

values = {'solution':solved, 'submitbutton':'submit'}

solution = urllib.urlencode(values)

request2 = urllib2.Request("http://www.hackthissite.org/missions/prog/11", solution)
request2.add_header('Referer', 'http://www.hackthissite.org/')

url = urlOpener.open(request2)


Your first request is to open the webpage to get the info, your second request is to submit your answer, not to get the info from the first request again.


I tried this but I still get the same thing. as if nothing was submitted at all and the page just reloaded.
hungryhobo14
New User
New User
 
Posts: 3
Joined: Sat Apr 10, 2010 4:16 pm
Blog: View Blog (0)


Re: Permanent Programming 11

Post by Defience on Mon Oct 04, 2010 9:00 pm
([msg=47066]see Re: Permanent Programming 11[/msg])

This line:
Code: Select all
request2 = urllib2.Request("http://www.hackthissite.org/missions/prog/11", solution, COOKIEHERE)

--needs your cookie sent with it.

If that doesn't do the trick, you can send me your code and I'd be happy to look it over for you.
User avatar
Defience
Addict
Addict
 
Posts: 1280
Joined: Thu Jun 12, 2008 3:16 pm
Blog: View Blog (0)


Re: Permanent Programming 11

Post by secretformula on Sun Oct 24, 2010 8:39 pm
([msg=48049]see Re: Permanent Programming 11[/msg])

I was wondering, would it be cheating to just modify the countdowns value in memory to say 60 to give you a whole minute to run the program? I know it could probably be done with the conditions given lol
secretformula
New User
New User
 
Posts: 9
Joined: Sun Oct 24, 2010 8:38 pm
Blog: View Blog (0)


Re: Permanent Programming 11

Post by fashizzlepop on Sun Oct 24, 2010 9:10 pm
([msg=48051]see Re: Permanent Programming 11[/msg])

How would you go about modifying the countdown? It's counted by the server, not the JS button.
The glass is neither half-full nor half-empty; it's merely twice as big as it needs to be.
User avatar
fashizzlepop
Developer
Developer
 
Posts: 2303
Joined: Sat May 24, 2008 1:20 pm
Blog: View Blog (0)


Re: Permanent Programming 11

Post by secretformula on Sun Oct 24, 2010 9:34 pm
([msg=48054]see Re: Permanent Programming 11[/msg])

I did it just today. View the source of the document. You come across the following
Code: Select all
<!--
            var TimeRemaining;
            var Timer;

            TimeRemaining = 3
            Timer = setTimeout("countdown()", 1000);

            function countdown()
            {
               TimeRemaining--;
               document.submitform.submitbutton.value = "submit            (remaining time: " + TimeRemaining + " seconds)";
               if (TimeRemaining > 0)
                  Timer = setTimeout("countdown()", 1000);
               else
               {
                  document.submitform.submitbutton.value = "- - - - - - - - - - - - - - - -   too late   - - - - - - - - - - - - - - - -";
                  alert("Sorry, it's too late  :(");
               }
             }
           // -->

In the javascript console if you set TimeRemaining = 60 then the js will not time out. Does the server do some sort of backend checking also? I havent tested that part lol
secretformula
New User
New User
 
Posts: 9
Joined: Sun Oct 24, 2010 8:38 pm
Blog: View Blog (0)


Re: Permanent Programming 11

Post by Assassian360 on Sun Oct 24, 2010 10:03 pm
([msg=48055]see Re: Permanent Programming 11[/msg])

secretformula wrote:In the javascript console if you set TimeRemaining = 60 then the js will not time out. Does the server do some sort of backend checking also? I havent tested that part lol


yes, it would check the time. The javascript front end is just to allow you to see the time remaining and is not the actual part that imposes the restriction. Otherwise it would be too easy to get through the time based missions.
Assassian360
Poster
Poster
 
Posts: 135
Joined: Sat Jun 26, 2010 1:37 am
Blog: View Blog (0)


Re: Permanent Programming 11

Post by secretformula on Mon Oct 25, 2010 4:44 pm
([msg=48099]see Re: Permanent Programming 11[/msg])

That makes a lot of sense now sorry I hasily replied
secretformula
New User
New User
 
Posts: 9
Joined: Sun Oct 24, 2010 8:38 pm
Blog: View Blog (0)


Re: Permanent Programming 11

Post by asleep777 on Mon Nov 29, 2010 12:53 pm
([msg=49591]see Re: Permanent Programming 11[/msg])

Howdy!

I have gotten most of the errors that tell me my perl script did not log in, now I am just getting a 302 found when I am running the login part of the script. I am working in two parts, the shift part is complete, so to get more familiarity with perl, I am logging in with the script as well.

Code: Select all
#!/usr/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Request::Common qw(POST);
my $ua = LWP::UserAgent->new;
$ua->cookie_jar( {file => "$ENV{HOME}./cookies.txt" } );
my $req = POST 'http://www.hackthissite.org/user/login',[PHPSESSID => '4d07p5mgi4alr71p6v11vuk0f6'];
$req->header('Referer','http://www.hackthissite.org/user/login');
my $res = $ua->request($req);
if ($res->is_success) {
  print $res->content;
} else {
  print $res->status_line . "\n";
}


So what does the 302 Found response mean?

Well, I have answered the 392 Found question, and got the same result as if I have sent the request twice. However, It just returns me to the login page and doesn't show my user name which leads me to believe that I am not logged in..

So different question with same intent: What next?
asleep777
New User
New User
 
Posts: 5
Joined: Tue Jul 13, 2010 1:07 am
Blog: View Blog (0)


PreviousNext

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests