<% # Wii parental control password reset tool # # Copyright 2008-2009 Hector Martin Cantero # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 or version 3 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. %> Wii Parental Control Password Resetter
Wii Parental Control password reset tool
<% import time ctime = time.time() def opt_date(delta): t = time.gmtime(ctime + delta * 3600 * 24) if delta == 0: selected = ' selected="selected"' else: selected = "" return ''%(t.tm_mon,t.tm_mday,selected,time.strftime("%a, %d %b %Y",t)) class CRC32: def __init__(self): self.gentable() def crc32(self, input, crc=0xffffffffl): count = len(input) i = 0 while count != 0: count -= 1 temp1 = (crc >> 8) & 0xFFFFFF temp2 = self.table[(crc ^ ord(input[i])) & 0xFF] crc = temp1 ^ temp2 i += 1 return crc def gentable(self): self.table = [] for i in range(256): crc = i for j in range(8): if crc & 1: crc = (crc >> 1) ^ 0xEDB88320l else: crc >>= 1 self.table.append(crc) def error(s): %>
<%= s %>
<% def process(): try: int(form["number"]) #validate if len(form["number"]) != 8 or not all([x in "0123456789" for x in form["number"]]): raise ValueError() except: error("Please provide a valid 8-digit confirmation number") return try: int(form["date"]) #validate if len(form["date"]) != 4 or not all([x in "0123456789" for x in form["date"]]): raise ValueError() except: error("Invalid date") return fullnum = form["date"] + form["number"][4:8] crc = CRC32().crc32(fullnum) code = ((crc ^ 0xaaaa) + 0x14c1) % 100000 %>
Your unlock code: <%= "%05d"%code %>
<% if form.has_key("submit"): process() %>

Confirmation Number:

Current Date in your timezone:

Valid XHTML 1.0 Strict Valid CSS!
Source code