Page 11 of 14

Re: Permanent Programming 2

PostPosted: Thu Dec 30, 2010 1:43 am
by Illusion03
Thanks human for your reply but i did used
Code: Select all
curl_setopt($ch,CURLOPT_FOLLOWLOCATION, true);
in my curl php code and the i tried to access
Code: Select all
curl_setopt($ch, CURLOPT_URL, 'http://www.hackthissite.org/missions/prog/2/PNG');
and after executing i m just getting nothing out of it ! CURLOPT_FOLLOWLOCATION did the job and redirection is being performed as i am not getting 301(Moved permanently error) , But the thing that is annoying me is if the redirection occur then why ain't I am not able to download the PNG image , So if u can point out what might be the problem I'll be thankfull ! :D

Re: Permanent Programming 2

PostPosted: Thu Dec 30, 2010 2:05 am
by OnlyHuman
Hmmm... Weird. Is your script visiting the challenge page first? I know that when I visit with my browser, I won't get an image when attempting to access the image url directly. I must visit the challenge url beforehand, or all I get is a blank page. When examining the header, I still get the 301, but it redirects properly. And, given how CURLOPT_FOLLOWLOCATION works, it should redirect properly with cURL as well. In fact, now that I've visited the challenge page, I keep refreshing the image and 200 OKs all the way through. You have to forgive me if this doesn't get the problem solved, it's been a really long time since I've done this one. Another thing you might try is file_get_contents(), which works over a network, to get the image. That might be a drastic solution though, as the output could interfere with the code you've already written to solve the challenge. Still if it's the only option, then you might have to take it.

Re: Permanent Programming 2

PostPosted: Sat Jan 01, 2011 10:00 am
by Illusion03
Finally Completed programming 2, It was fun coding it in php using Curl.

Few points I'll like to mention for those who are Using Curl php scripts to solve this challenge.

1)Make sure you login to the site , give right credentials,right referrer, right URL,POST(TRUE). :twisted:
2)Make Sure you visit the challenge page first in order to activate the timer before proceeding.
3) Keep in mind how to deal with Redirection error like 301(Moved permanently),if any.
4)After processing the image, you need to send you answer back to the challenge URL(Make sure it is correct and you are sending it correctly),POST(TRUE).

This challenge can be completed under half an hour if you know what you are doing ! On total its Easy !
\*Have Fun *\ :D


Thanks For Human for his brilliant suggestion on this challenge ! :)

Re: Permanent Programming 2

PostPosted: Sat Apr 09, 2011 11:11 pm
by gsingh2011
Can I pm my python code to someone? I've tried some images people have posted on this forum, and according to the replies my output is one character off. So if someone could check my code please let me know. Thanks.

Re: Permanent Programming 2

PostPosted: Mon May 30, 2011 8:06 pm
by adamcaa
I'm not sure how to download the image file. I've tried calling wget from a perl script with different options and nothing seems to be workinging here. Do I need to directly interact with the server using http protocol? Any tips with this would be great. I would also like some opinions on which programming/scripting language would be best suited for this mission. I know some perl/javascript/c#/java/c/c++/shell scripting. I'm considering learning python and more php if any of those would be better. I'm plan on learning them anyways but depending on what kind of feedback I get I may start sooner rather than later.

Re: Permanent Programming 2

PostPosted: Mon May 30, 2011 8:36 pm
by Miner49er
adamcaa wrote:I'm not sure how to download the image file. I've tried calling wget from a perl script with different options and nothing seems to be workinging here.

You can download/save the image by right clicking on it and clicking "Save As". That would be the easy way anyway.

Re: Permanent Programming 2

PostPosted: Mon May 30, 2011 8:43 pm
by adamcaa
yes I'm sure that would work, I was just looking to automate the whole process. I don't know much about Ruby but i'm wonding if this mission could be solved with it.

Re: Permanent Programming 2

PostPosted: Mon May 30, 2011 9:57 pm
by fashizzlepop
You can solve this mission with duct tape and a tyrannosaurus rex. Perl would be much easier of course. Just have your program follow the link to the image and grab it.

Re: Permanent Programming 2

PostPosted: Tue May 31, 2011 4:18 pm
by adamcaa
OK I've been using perl with perl module Image::Grab to reach out to
url: http://www.hackthissite.org/missions/prog/2/PNG/

to write this to: PNG.png
however this does not produce and image file

I've tried this script on another url that has a file extension of .png and it works

is there a hidden work around or can this not be done?
maybe someone can take a look at my script?

Re: Permanent Programming 2

PostPosted: Tue May 31, 2011 4:51 pm
by fashizzlepop
You should have to call up the challenge page first in order for it to be generated for you; the page where you end up submitting the answer.