Permanent Programming 2

Put your programming skills to the test in these challenges.

Re: Permanent Programming 2

Post by Illusion03 on Thu Dec 30, 2010 1:43 am
([msg=51341]see Re: Permanent Programming 2[/msg])

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
Illusion03
New User
New User
 
Posts: 16
Joined: Wed Oct 22, 2008 11:27 am
Blog: View Blog (0)


Re: Permanent Programming 2

Post by OnlyHuman on Thu Dec 30, 2010 2:05 am
([msg=51342]see Re: Permanent Programming 2[/msg])

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.
OnlyHuman
Poster
Poster
 
Posts: 191
Joined: Sat Aug 22, 2009 1:37 am
Blog: View Blog (0)


Re: Permanent Programming 2

Post by Illusion03 on Sat Jan 01, 2011 10:00 am
([msg=51467]see Re: Permanent Programming 2[/msg])

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 ! :)
Illusion03
New User
New User
 
Posts: 16
Joined: Wed Oct 22, 2008 11:27 am
Blog: View Blog (0)


Re: Permanent Programming 2

Post by gsingh2011 on Sat Apr 09, 2011 11:11 pm
([msg=56196]see Re: Permanent Programming 2[/msg])

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.
gsingh2011
New User
New User
 
Posts: 11
Joined: Sun Mar 27, 2011 2:14 pm
Blog: View Blog (0)


Re: Permanent Programming 2

Post by adamcaa on Mon May 30, 2011 8:06 pm
([msg=57886]see Re: Permanent Programming 2[/msg])

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.
adamcaa
New User
New User
 
Posts: 10
Joined: Fri May 27, 2011 9:33 pm
Blog: View Blog (0)


Re: Permanent Programming 2

Post by Miner49er on Mon May 30, 2011 8:36 pm
([msg=57887]see Re: Permanent Programming 2[/msg])

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.
User avatar
Miner49er
New User
New User
 
Posts: 12
Joined: Tue Oct 19, 2010 8:18 pm
Blog: View Blog (0)


Re: Permanent Programming 2

Post by adamcaa on Mon May 30, 2011 8:43 pm
([msg=57888]see Re: Permanent Programming 2[/msg])

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.
adamcaa
New User
New User
 
Posts: 10
Joined: Fri May 27, 2011 9:33 pm
Blog: View Blog (0)


Re: Permanent Programming 2

Post by fashizzlepop on Mon May 30, 2011 9:57 pm
([msg=57893]see Re: Permanent Programming 2[/msg])

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

Post by adamcaa on Tue May 31, 2011 4:18 pm
([msg=57930]see Re: Permanent Programming 2[/msg])

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?
adamcaa
New User
New User
 
Posts: 10
Joined: Fri May 27, 2011 9:33 pm
Blog: View Blog (0)


Re: Permanent Programming 2

Post by fashizzlepop on Tue May 31, 2011 4:51 pm
([msg=57935]see Re: Permanent Programming 2[/msg])

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


PreviousNext

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests