hacker.org Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Python programming?

 
Reply to topic    hacker.org Forum Index » The Hacker's Server View previous topic
View next topic
Python programming?
Author Message
OvO



Joined: 19 Mar 2010
Posts: 11

Post Python programming? Reply with quote
hi peeps...
I'm just learning to program with python at the moment.
and i was wondering if any of you guys have an idea for me for any program, doesn't matter what. just something i can tinker with for a while and is fairly easy mode would be awesome! :]

PS. I do know the absolute basics (like "while" statement and "print" and "input" and such alike.). just a hint would be great! :]
Thu Apr 29, 2010 10:37 pm View user's profile Send private message
CodeX



Joined: 17 Oct 2008
Posts: 350

Post Reply with quote
I'd suggest a Runaway Robot solver, it can be completed with python but can take a few minutes on the later levels and you'll probably have to change your approach to get there. If you do try this you can use urlopen from urllib (from urllib import urlopen), it's quite an interesting but simple challenge and I'm sure you'll be pleased when you manage to get to 513.
Thu Apr 29, 2010 10:59 pm View user's profile Send private message
OvO



Joined: 19 Mar 2010
Posts: 11

Post Reply with quote
Wow thanks :]
I'm going to try that for a while
it goes like
Code:

import urllib

somestring = urllib.urlopen('http://www.website.com').read()

right?
Fri Apr 30, 2010 11:12 am View user's profile Send private message
CodeX



Joined: 17 Oct 2008
Posts: 350

Post Reply with quote
yup, don't forget to play with the sting formatting which can be good for the uri with something like
Code:
from urllib import urlopen, urlencode
from re import match

uri = "http://www.hacker.org/runaway/index.php?name=%s&%s";
name = raw_input("Enter your username:\n");
password = raw_input("Enter your password or SPW:\n")

param2 = ""
if match("[0-9a-z]{32}",password): # The SPW is 32 lowercase hex digits
   param2 = "spw=%s"%(password)
else:
   param2 = "password=%s"%(urlencode(password))

uri = uri%(urlencode(name),param2)
response = urlopen(uri).read()

Fri Apr 30, 2010 1:19 pm View user's profile Send private message
OvO



Joined: 19 Mar 2010
Posts: 11

Post Reply with quote
will do, thanks :]
Sat May 01, 2010 12:10 am View user's profile Send private message
Display posts from previous:    
Reply to topic    hacker.org Forum Index » The Hacker's Server All times are GMT
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.