Posts Tagged ‘python challenge’

Python Challenge level 13: “call him”

For level 13 you need a tip from the last challenge. Hint 1: phone that evil Hint 2: link to phonebook.php, which returns an XMLRPC error Fact 1: we know from the previous level that “Bert is evil” #!/usr/bin/env python import xmlrpclib server = xmlrpclib.Server(‘http://www.pythonchallenge.com /pc/phonebook.php’) ## we’ll need to discover Server API # print [...]

Read the rest of this entry »

Python Challenge level 12: “dealing evil”

Level 12 requires some hex-observation. Hint 1: image evil1.jpg with a shuffled deck and five piles The name evil1 seems suspicious, so maybe we can find something else poking around. Fact 1: there are more evil?.jpg and an evil2.gfx Fact 2: when inspected in an hex editor the gfx file seems to have several images [...]

Read the rest of this entry »

Python Challenge level 11: “odd even”

Level 11 requires playing with images once again. Fact 1: the image cave.jpg seems to have half ot its pixels blanked We’ll assume odd and even pixels belong to different images. This snippet will put me out of my misery and let me know ;) import Image src = Image.open(“cave.jpg”) w,h = src.size[0], src.size[1] print [...]

Read the rest of this entry »

Python Challenge level 10: “where are you looking at”

Level 10 doesn’t have anything new. Hint 1: len(a[30]) = ? Hint 2: a = [1, 11, 21, 1211, 111221, Fact 1: 'a' is the 'look and say sequence'. Im normally pretty good finding numeric patterns, but I must confess that I had to look up this one. I suppose I don't have the right [...]

Read the rest of this entry »

Python Challenge level 9: “connect the dots”

Level 9 needs some more drawing. Hint 1: first+second=? import Image,ImageDraw im = Image.new(‘RGB’, (500,500)) draw = ImageDraw.Draw(im) first=[146,399,163,403, ...] # chunked second=[156,141,165,135, ...] # chunked for i in range(0, len(first), 2): draw.line(first[i:i + 4], fill=’white’) for i in range(0, len(second), 2): draw.line(second[i:i + 4], fill=’white’) im.save(’09.jpg’) Is it a cow? Nope, it’s Level 10. [...]

Read the rest of this entry »

Python Challenge level 8: “working hard?”

Level 8 is easy. Hint 1: Where is the missing link? Hint 2: un and pn are provided Fact 1: the bee links to a page in a protected directory Fact 2: BZh91AY seems to be a bzip2 header (says Google) import bz2 un= ‘BZh91AY&SYAx….’ #complete the string here pw= ‘BZh91AY&SYx9….’ #likewise print “user:”,bz2.decompress(un) print [...]

Read the rest of this entry »

Python Challenge level 7: “smarty”

Level 7 needs the Image module. Fact 1: The PNG file has a weird grey area, so the information must be encoded there. import Image im = Image.open(“oxygen.png”) print “Image info:”,im.format, im.size, im.mode #we’ll limit the grey zone y_begin = 0 while True: p = im.getpixel((0, y_begin)) if p[0] == p[1] == p[2]: break y_begin [...]

Read the rest of this entry »

Python Challenge level 6: “now there are pairs”

Level 6 deals again with linked lists. Hint 1: Image is a zipper and there is a comment in the page (<!– <– zip –>). Once we open channel.zip, there are some more hints: “welcome to my zipped list“. Hint 2: start from 90052 Hint 3: answer is inside the zip import zipfile,re idx=”90052″ file [...]

Read the rest of this entry »

Python Challenge level 5: “peak hell”

Level 5 is the first challenge specific to Python since it involves the pickle module in charge of Python object serialization. Hint 1: pronounce it Fact 1: there is a refference to a file named banner.p in the html source, so we’ll download it and see Fact 2: once depickled, it looks like a run-length [...]

Read the rest of this entry »

Python Challenge level 4: “follow the chain”

Level 4 requires some web scraping. Nice :) Hint 1: urllib may help. DON’T TRY ALL NOTHINGS, since it will never end. 400 times is more than enough Hint 2: linkedlist.php?nothing=12345 import urllib,re url=’http://www.pythonchallenge.com/pc/def/ linkedlist.php?nothing=’ seed=”12345″ for i in range(400): text=urllib.urlopen(url+seed).read() seed=”".join(re.findall(r”nothing is (\d+)”,text)) try : int(seed) print ” Next:”,seed except : print ” Last:”,text [...]

Read the rest of this entry »