Tags: misc

Rating:

#Santa Walks Into a Bar

~~~~
[EN]
Santa walks into a bar and creates a friendship bound with you.
After some shots, he spells to you his secrets to delivery all gifts on Christmas: he has a magical linked list that inform the next kiddie to visit.
At the end of the night, he goes alway and left behind his wallet and the bag with the list of gifts to delivery. Try to discover if you will receive something.

[PT-BR]
Papai noel entra em um bar e cria um laço de amizade com voce.
Apos algumas bebidas, ele conta seu segredo para entregar todos os presentes de Natal: ele tem uma lista ligada que informa qual a porxima crianca que ele deve visitar. No final da noite, ele foi embora e esqueceu a carteira e a bolsa com a lista de presentes para entregar. Tente descobrir se voce ira receber alguma coisa.
~~~~

The given file is a *.zip* with lots of *.png* files within. Each file is a QR code that translates to a simple message indicating a name of a child. Our goal is to find the one addressed to us.

Althoug the chall mentions a linked list, there is indeed no need of it. Each translated QR code actually points to another file name, therefore we could simply run all the nodes of the list. However there are actually some few linked lists put toghether in this folder. If you start with a random node, say the first file in alphabetic order, you might end up with a message like "Fail!" being the last node of this list.

Instead of trying every possible list, we decided to simply check all files inside the folder sequentially. Nevertheless, we are still talking about a linked list anyhow :)

This silly script did the trick in a few minutes:

~~~~
import os
import qrtools

qr = qrtools.QR()
for idx, f in enumerate(os.listdir(".")):
if "solve" in f:
continue
qr.decode(f)
if "you" in qr.data:
print "File content >> %s" % qr.data
img = qr.data.rsplit(' ', 1)[1]+".png"
qr.decode(img)
print " " + img + " >> " + qr.data
~~~~

And the output:

~~~~
File content >> Next kiddie is you in 6f0600da67c1870c157d1f61e0c58091
6f0600da67c1870c157d1f61e0c58091.png >> Yu u no following right?
File content >> A child in you in ed7b0eaaf64c9bf6c90299f6cbe6d4e1
ed7b0eaaf64c9bf6c90299f6cbe6d4e1.png >> Fail